Move some build time checkings inside init.c for task #7142 "Sanity check user-configurable values".

This commit is contained in:
fbernon 2007-09-05 13:19:25 +00:00
parent 5865a78c1e
commit c1f89c5640
6 changed files with 16 additions and 14 deletions

View File

@ -19,6 +19,10 @@ HISTORY
++ New features: ++ 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 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 * 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 memp_malloc, and use a new MEMP_NUM_IGMP_GROUP option (see opt.h to define the

View File

@ -534,9 +534,6 @@ inet_ntoa(struct in_addr addr)
* Note ntohs() and ntohl() are merely references to the htonx counterparts. * 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) #if (LWIP_PLATFORM_BYTESWAP == 0) && (BYTE_ORDER == LITTLE_ENDIAN)
/** /**

View File

@ -57,6 +57,9 @@
/* Compile-time sanity checks for configuration errors. /* Compile-time sanity checks for configuration errors.
* These can be done independently of LWIP_DEBUG, without penalty. * 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) #if (!LWIP_ARP && ARP_QUEUEING)
#error "If you want to use ARP Queueing, you have to define LWIP_ARP=1 in your lwipopts.h" #error "If you want to use ARP Queueing, you have to define LWIP_ARP=1 in your lwipopts.h"
#endif #endif
@ -102,6 +105,15 @@
#if (((!LWIP_DHCP) || (!LWIP_ARP)) && DHCP_DOES_ARP_CHECK) #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" #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 #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))) #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" #error "One and exactly one of LWIP_EVENT_API and LWIP_CALLBACK_API has to be enabled in lwipopts.h"
#endif #endif

View File

@ -73,11 +73,6 @@
#if LWIP_AUTOIP /* don't build if not configured for use in lwipopts.h */ #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 */ /* 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 #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)) #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))

View File

@ -55,9 +55,6 @@ const s32_t snmp_version = 0;
const char snmp_publiccommunity[7] = "public"; const char snmp_publiccommunity[7] = "public";
/* statically allocated buffers for SNMP_CONCURRENT_REQUESTS */ /* 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]; struct snmp_msg_pstat msg_input_list[SNMP_CONCURRENT_REQUESTS];
/* UDP Protocol Control Block */ /* UDP Protocol Control Block */
struct udp_pcb *snmp1_pcb = NULL; struct udp_pcb *snmp1_pcb = NULL;

View File

@ -60,9 +60,6 @@ struct snmp_trap_dst
/* set to 0 when disabled, >0 when enabled */ /* set to 0 when disabled, >0 when enabled */
u8_t enable; 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]; struct snmp_trap_dst trap_dst[SNMP_TRAP_DESTINATIONS];
/** TRAP message structure */ /** TRAP message structure */