mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-05 13:44:32 +02:00
lwip: Make LWIP_ERROR behave as if assertions were off, even if they are on
This commit is contained in:
committed by
Angus Gratton
parent
f5e7f2bb8f
commit
857a7f186e
@@ -37,6 +37,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "arch/sys_arch.h"
|
#include "arch/sys_arch.h"
|
||||||
|
|
||||||
@@ -73,7 +74,21 @@ typedef int sys_prot_t;
|
|||||||
|
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
#define LWIP_NOASSERT
|
#define LWIP_NOASSERT
|
||||||
#endif
|
#else // Assertions enabled
|
||||||
//#define LWIP_ERROR
|
|
||||||
|
// If assertions are on, the default LWIP_ERROR handler behaviour is to
|
||||||
|
// abort w/ an assertion failure. Don't do this, instead just print the error (if LWIP_DEBUG is set)
|
||||||
|
// and run the handler (same as the LWIP_ERROR behaviour if LWIP_NOASSERT is set).
|
||||||
|
#ifdef LWIP_DEBUG
|
||||||
|
#define LWIP_ERROR(message, expression, handler) do { if (!(expression)) { \
|
||||||
|
puts(message); handler;}} while(0)
|
||||||
|
#else
|
||||||
|
// If LWIP_DEBUG is not set, return the error silently (default LWIP behaviour, also.)
|
||||||
|
#define LWIP_ERROR(message, expression, handler) do { if (!(expression)) { \
|
||||||
|
handler;}} while(0)
|
||||||
|
#endif // LWIP_DEBUG
|
||||||
|
|
||||||
|
#endif /* NDEBUG */
|
||||||
|
|
||||||
|
|
||||||
#endif /* __ARCH_CC_H__ */
|
#endif /* __ARCH_CC_H__ */
|
||||||
|
Reference in New Issue
Block a user