From 041133285628bcd7fde39a7fd8ce08e40f10f423 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Wed, 7 Mar 2018 07:52:41 +0800 Subject: [PATCH] api_msg.h: Fix build error when LWIP_NETIF_API && !LWIP_SOCKET && !LWIP_NETCONN netifapi related lwIP internal definitions should be guarded by #if LWIP_NETIF_API rather than #if LWIP_NETCONN || LWIP_SOCKET. Fix below build errors: cc -g -DLWIP_DEBUG -Wall -pedantic -Wparentheses -Wsequence-point -Wswitch-default -Wextra -Wundef -Wshadow -Wpointer-arith -Wcast-qual -Wc++-compat -Wwrite-strings -Wold-style-definition -Wcast-align -Wmissing-prototypes -Wredundant-decls -Wnested-externs -Wunreachable-code -Wuninitialized -Wmissing-prototypes -Wredundant-decls -Waggregate-return -Wlogical-not-parentheses -Wlogical-op -Wc90-c99-compat -Wtrampolines -I. -I../../.. -I../../../../lwip/src/include -I../../../ports/unix/port/include -I../../../../mbedtls/include -Wno-redundant-decls -DLWIP_HAVE_MBEDTLS=1 -c ../../../../lwip/src/api/netifapi.c In file included from ../../../../lwip/src/api/netifapi.c:46:0: ../../../../lwip/src/include/lwip/netifapi.h:76:50: error: unknown type name 'netifapi_void_fn'; did you mean 'netif_init_fn'? err_t netifapi_netif_common(struct netif *netif, netifapi_void_fn voidfunc, ^~~~~~~~~~~~~~~~ netif_init_fn ../../../../lwip/src/include/lwip/netifapi.h:77:29: error: unknown type name 'netifapi_errt_fn'; did you mean 'netif_input_fn'? netifapi_errt_fn errtfunc); ^~~~~~~~~~~~~~~~ netif_input_fn ../../../../lwip/src/api/netifapi.c: In function 'netifapi_do_netif_add': ../../../../lwip/src/api/netifapi.c:67:22: error: dereferencing pointer to incomplete type 'struct netifapi_msg' if (!netif_add( msg->netif, ^~ Fixes: 30a2283993cf ("Move netifapi private definitions to priv/api_msg.h") Signed-off-by: Axel Lin --- src/include/lwip/priv/api_msg.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/include/lwip/priv/api_msg.h b/src/include/lwip/priv/api_msg.h index a64e4c31..9dfd088f 100644 --- a/src/include/lwip/priv/api_msg.h +++ b/src/include/lwip/priv/api_msg.h @@ -39,10 +39,6 @@ #include "lwip/opt.h" -#if LWIP_NETCONN || LWIP_SOCKET /* don't build if not configured for use in lwipopts.h */ -/* Note: Netconn API is always available when sockets are enabled - - * sockets are implemented on top of them */ - #include "lwip/arch.h" #include "lwip/ip_addr.h" #include "lwip/err.h" @@ -55,6 +51,10 @@ extern "C" { #endif +#if LWIP_NETCONN || LWIP_SOCKET /* don't build if not configured for use in lwipopts.h */ +/* Note: Netconn API is always available when sockets are enabled - + * sockets are implemented on top of them */ + #if LWIP_MPU_COMPATIBLE #if LWIP_NETCONN_SEM_PER_THREAD #define API_MSG_M_DEF_SEM(m) *m @@ -216,6 +216,10 @@ void lwip_netconn_do_gethostbyname(void *arg); struct netconn* netconn_alloc(enum netconn_type t, netconn_callback callback); void netconn_free(struct netconn *conn); +#endif /* LWIP_NETCONN || LWIP_SOCKET */ + +#if LWIP_NETIF_API /* don't build if not configured for use in lwipopts.h */ + /* netifapi related lwIP internal definitions */ #if LWIP_MPU_COMPATIBLE @@ -256,10 +260,10 @@ struct netifapi_msg { } msg; }; +#endif /* LWIP_NETIF_API */ + #ifdef __cplusplus } #endif -#endif /* LWIP_NETCONN || LWIP_SOCKET */ - #endif /* LWIP_HDR_API_MSG_H */