From c1f89c56403ab56b23af7749d9a51ad0e19e37c2 Mon Sep 17 00:00:00 2001 From: fbernon Date: Wed, 5 Sep 2007 13:19:25 +0000 Subject: [PATCH] Move some build time checkings inside init.c for task #7142 "Sanity check user-configurable values". --- CHANGELOG | 4 ++++ src/core/inet.c | 3 --- src/core/init.c | 12 ++++++++++++ src/core/ipv4/autoip.c | 5 ----- src/core/snmp/msg_in.c | 3 --- src/core/snmp/msg_out.c | 3 --- 6 files changed, 16 insertions(+), 14 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 4074c023..d0723951 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -19,6 +19,10 @@ HISTORY ++ New features: + 2007-09-05 Frédéric Bernon + * inet.c, autoip.c, msg_in.c, msg_out.c, init.c: Move some build time checkings + inside init.c for task #7142 "Sanity check user-configurable values". + 2007-09-04 Frédéric Bernon, Bill Florac * igmp.h, igmp.c, memp_std.h, memp.c, init.c, opt.h: Replace mem_malloc call by memp_malloc, and use a new MEMP_NUM_IGMP_GROUP option (see opt.h to define the diff --git a/src/core/inet.c b/src/core/inet.c index 00d125d9..008595d1 100644 --- a/src/core/inet.c +++ b/src/core/inet.c @@ -534,9 +534,6 @@ inet_ntoa(struct in_addr addr) * Note ntohs() and ntohl() are merely references to the htonx counterparts. */ -#ifndef BYTE_ORDER -#error BYTE_ORDER is not defined -#endif #if (LWIP_PLATFORM_BYTESWAP == 0) && (BYTE_ORDER == LITTLE_ENDIAN) /** diff --git a/src/core/init.c b/src/core/init.c index 00ff8e25..2c2a098b 100644 --- a/src/core/init.c +++ b/src/core/init.c @@ -57,6 +57,9 @@ /* Compile-time sanity checks for configuration errors. * These can be done independently of LWIP_DEBUG, without penalty. */ +#ifndef BYTE_ORDER + #error "BYTE_ORDER is not defined, you have to define it in your cc.h" +#endif #if (!LWIP_ARP && ARP_QUEUEING) #error "If you want to use ARP Queueing, you have to define LWIP_ARP=1 in your lwipopts.h" #endif @@ -102,6 +105,15 @@ #if (((!LWIP_DHCP) || (!LWIP_ARP)) && DHCP_DOES_ARP_CHECK) #error "If you want to use DHCP ARP checking, you have to define LWIP_DHCP=1 and LWIP_ARP=1 in your lwipopts.h" #endif +#if (!LWIP_ARP && LWIP_AUTOIP) + #error "If you want to use AUTOIP, you have to define LWIP_ARP=1 in your lwipopts.h" +#endif +#if (LWIP_SNMP && (SNMP_CONCURRENT_REQUESTS<=0)) + #error "If you want to use SNMP, you have to define SNMP_CONCURRENT_REQUESTS>=1 in your lwipopts.h" +#endif +#if (LWIP_SNMP && (SNMP_TRAP_DESTINATIONS<=0)) + #error "If you want to use SNMP, you have to define SNMP_TRAP_DESTINATIONS>=1 in your lwipopts.h" +#endif #if (LWIP_TCP && ((LWIP_EVENT_API && LWIP_CALLBACK_API) || (!LWIP_EVENT_API && !LWIP_CALLBACK_API))) #error "One and exactly one of LWIP_EVENT_API and LWIP_CALLBACK_API has to be enabled in lwipopts.h" #endif diff --git a/src/core/ipv4/autoip.c b/src/core/ipv4/autoip.c index 2d2a1042..33df78c9 100644 --- a/src/core/ipv4/autoip.c +++ b/src/core/ipv4/autoip.c @@ -73,11 +73,6 @@ #if LWIP_AUTOIP /* don't build if not configured for use in lwipopts.h */ -/* LWIP_ARP option should be configured in lwipopts.h */ -#if !LWIP_ARP -#error LWIP_ARP is need for LWIP_AUTOIP. Set it from your lwipopts.h. -#endif /* !LWIP_ARP */ - /* pseudo random macro based on netif informations. You could use "rand()" from the C Library if you define LWIP_AUTOIP_RAND in lwipopts.h */ #ifndef LWIP_AUTOIP_RAND #define LWIP_AUTOIP_RAND(netif) ( (((u32_t)((netif->hwaddr[5]) & 0xff) << 24) | ((u32_t)((netif->hwaddr[3]) & 0xff) << 16) | ((u32_t)((netif->hwaddr[2]) & 0xff) << 8) | ((u32_t)((netif->hwaddr[4]) & 0xff))) + (netif->autoip?netif->autoip->tried_llipaddr:0)) diff --git a/src/core/snmp/msg_in.c b/src/core/snmp/msg_in.c index a369edfa..828eba4a 100644 --- a/src/core/snmp/msg_in.c +++ b/src/core/snmp/msg_in.c @@ -55,9 +55,6 @@ const s32_t snmp_version = 0; const char snmp_publiccommunity[7] = "public"; /* statically allocated buffers for SNMP_CONCURRENT_REQUESTS */ -#if (SNMP_CONCURRENT_REQUESTS == 0) -#error "need at least one snmp_msg_pstat" -#endif struct snmp_msg_pstat msg_input_list[SNMP_CONCURRENT_REQUESTS]; /* UDP Protocol Control Block */ struct udp_pcb *snmp1_pcb = NULL; diff --git a/src/core/snmp/msg_out.c b/src/core/snmp/msg_out.c index c8961c9b..4defddc0 100644 --- a/src/core/snmp/msg_out.c +++ b/src/core/snmp/msg_out.c @@ -60,9 +60,6 @@ struct snmp_trap_dst /* set to 0 when disabled, >0 when enabled */ u8_t enable; }; -#if (SNMP_TRAP_DESTINATIONS == 0) -#error "need at least one trap destination" -#endif struct snmp_trap_dst trap_dst[SNMP_TRAP_DESTINATIONS]; /** TRAP message structure */