debug: split debug enable checks from LWIP_DEBUGF to LWIP_DEBUG_ENABLED

In order to reuse the debug-enable checks for PPP debug macros,
move the flag and level checks from LWIP_DEBUGF to a new macro
that can be used elsewhere.
This commit is contained in:
Simon Goldschmidt 2020-01-10 20:50:25 +01:00
parent b43f081b9a
commit 827b60c155

View File

@ -140,11 +140,12 @@
#endif
#ifdef LWIP_DEBUG
#define LWIP_DEBUGF(debug, message) do { \
if ( \
((debug) & LWIP_DBG_ON) && \
#define LWIP_DEBUG_ENABLED(debug) (((debug) & LWIP_DBG_ON) && \
((debug) & LWIP_DBG_TYPES_ON) && \
((s16_t)((debug) & LWIP_DBG_MASK_LEVEL) >= LWIP_DBG_MIN_LEVEL)) { \
((s16_t)((debug) & LWIP_DBG_MASK_LEVEL) >= LWIP_DBG_MIN_LEVEL))
#define LWIP_DEBUGF(debug, message) do { \
if (LWIP_DEBUG_ENABLED(debug)) { \
LWIP_PLATFORM_DIAG(message); \
if ((debug) & LWIP_DBG_HALT) { \
while(1); \
@ -153,6 +154,7 @@
} while(0)
#else /* LWIP_DEBUG */
#define LWIP_DEBUG_ENABLED(debug) 0
#define LWIP_DEBUGF(debug, message)
#endif /* LWIP_DEBUG */