diff --git a/net/src/net_posix.c b/net/src/net_posix.c index b1127ea2..c938dbf6 100644 --- a/net/src/net_posix.c +++ b/net/src/net_posix.c @@ -25,6 +25,15 @@ #include "eos/net.h" +/* eos/net.h puts every eNet declaration behind EOS_ENABLE_NET, but this + * file is in eos_net's source list unconditionally. Built without the + * feature -- which is the default configuration, since CMakeLists.txt only + * defines EOS_ENABLE_NET for the test build -- the header contributed no + * types and every definition below failed with "unknown type name + * eos_socket_t". Guarding the body compiles it away instead, which is what + * a disabled feature is supposed to do. */ +#if EOS_ENABLE_NET + #include #include #include @@ -203,3 +212,5 @@ int eos_net_resolve(const char *hostname, uint32_t *ip) freeaddrinfo(res); return 0; } + +#endif /* EOS_ENABLE_NET */ diff --git a/tests/test_net.c b/tests/test_net.c index d3c0f61c..02a8aee1 100644 --- a/tests/test_net.c +++ b/tests/test_net.c @@ -1,4 +1,5 @@ // SPDX-License-Identifier: MIT +#include #include #include #include