What platform (compiler) are you using? The macro argument . may not be
compatible - it is a C99 addition and your compiler might not support it. I
don't know where it came from since it's not in the lwIP code I've seen.
Does
#define LWIP_PLATFORM_DIAG( x ) do{ sys_debug x ;} while( 0 )
work for you? This matches what I have.
Bill
From: [email protected]
[mailto:[email protected]] On Behalf
Of Alexandre Malo
Sent: Thursday, May 28, 2009 4:47 PM
To: [email protected]
Subject: Fw: [lwip-users] using LWIP_DEBUG
Problem resolved!
It was a problem in cc.h wich I dont quite understand really.
Problem occured with LWIP_PLATFORM_DIAG in LWIP_DEBUGF.
I was given the code so I dont know on what purpose it was not well write.
Here is what was making all the trouble.
//Orignial LWIP_PLATFORM_DIAG wich was doing the error
//#define LWIP_PLATFORM_DIAG( x, ... ) do{ sys_debug( x );} while( 0 )
#define LWIP_PLATFORM_DIAG( x ) sys_debug x
--------------------------------------------------
void sys_debug( const char *const fmt, ... )
{
printf(fmt);
}
-------------------------------------------------
------------------------------------------------------------------
What was calling LWIP_PLATFORM_DIAG is LWIP_DEBUGF
------------------------------------------------------------------
#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) { \
for (;;)\
{\
\
}\
} \
} \
} while(0)
#else /* LWIP_DEBUG */
#define LWIP_DEBUGF(debug,x)
#endif /* LWIP_DEBUG */
-------------------------------------------------------------
If anyone have an idea on why there was a bug with the original version.
Im not really good with macro yet and I wish to learn. Thanks!
Alexandre Malo
_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users