mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-05-21 07:36:55 +08:00
debug.h, api_msg.c: change LWIP_ERROR to use it to check errors like invalid pointers or parameters, and let the possibility to redefined it in cc.h. Use this macro to check "conn" parameter in api_msg.c functions (some others change will be done...).
This commit is contained in:
@@ -62,20 +62,23 @@
|
||||
#define LWIP_DBG_HALT 0x08U
|
||||
|
||||
#ifndef LWIP_NOASSERT
|
||||
# define LWIP_ASSERT(x,y) do { if(!(y)) LWIP_PLATFORM_ASSERT(x); } while(0)
|
||||
#else
|
||||
# define LWIP_ASSERT(x,y)
|
||||
#endif
|
||||
#define LWIP_ASSERT(x,y) do { if(!(y)) LWIP_PLATFORM_ASSERT(x); } while(0)
|
||||
#else /* LWIP_NOASSERT */
|
||||
#define LWIP_ASSERT(x,y)
|
||||
#endif /* LWIP_NOASSERT */
|
||||
|
||||
/** print "m" message only if "e" is true, and execute "h" expression */
|
||||
#ifndef LWIP_ERROR
|
||||
#define LWIP_ERROR(m,e,h) do { if (e) { LWIP_PLATFORM_ASSERT(m); h;}} while(0)
|
||||
#endif /* LWIP_ERROR */
|
||||
|
||||
#ifdef LWIP_DEBUG
|
||||
/** print debug message only if debug message type is enabled...
|
||||
* AND is of correct type AND is at least LWIP_DBG_LEVEL
|
||||
*/
|
||||
# define LWIP_DEBUGF(debug,x) do { if (((debug) & LWIP_DBG_ON) && ((debug) & LWIP_DBG_TYPES_ON) && ((s16_t)((debug) & LWIP_DBG_MASK_LEVEL) >= LWIP_DBG_MIN_LEVEL)) { LWIP_PLATFORM_DIAG(x); if ((debug) & LWIP_DBG_HALT) while(1); } } while(0)
|
||||
# define LWIP_ERROR(x) do { LWIP_PLATFORM_DIAG(x); } while(0)
|
||||
#else /* LWIP_DEBUG */
|
||||
# define LWIP_DEBUGF(debug,x)
|
||||
# define LWIP_ERROR(x)
|
||||
#define LWIP_DEBUGF(debug,x) do { if (((debug) & LWIP_DBG_ON) && ((debug) & LWIP_DBG_TYPES_ON) && ((s16_t)((debug) & LWIP_DBG_MASK_LEVEL) >= LWIP_DBG_MIN_LEVEL)) { LWIP_PLATFORM_DIAG(x); if ((debug) & LWIP_DBG_HALT) while(1); } } while(0)
|
||||
#else /* LWIP_DEBUG */
|
||||
#define LWIP_DEBUGF(debug,x)
|
||||
#endif /* LWIP_DEBUG */
|
||||
|
||||
#endif /* __LWIP_DEBUG_H__ */
|
||||
|
||||
Reference in New Issue
Block a user