net: sockets_offload: Fix build error with NO_OPTIMIZATIONS

When CONFIG_NO_OPTIMIZATIONS the compiler will not inline
socket_offload_dns_is_enabled(), which means calls to
socket_offload* remain, and the linker will fail with

in function `zsock_getaddrinfo': undefined reference to
`socket_offload_getaddrinfo'
in function `zsock_freeaddrinfo': undefined reference to
`socket_offload_freeaddrinfo'

Instead of relaying on that function being inlined and the
if'ed code being removed, let's just use the preprocessor.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This commit is contained in:
Alberto Escolar Piedras 2025-06-16 10:14:05 +02:00 committed by Daniel DeGrasse
commit dc24583858

View file

@ -67,10 +67,7 @@ void socket_offload_dns_enable(bool enable);
#if defined(CONFIG_NET_SOCKETS_OFFLOAD)
bool socket_offload_dns_is_enabled(void);
#else
static inline bool socket_offload_dns_is_enabled(void)
{
return false;
}
#define socket_offload_dns_is_enabled() false
#endif /* defined(CONFIG_NET_SOCKETS_OFFLOAD) */