From c13e08a7f5653b102eb6ef104b16d2941ce31d00 Mon Sep 17 00:00:00 2001 From: jani Date: Mon, 10 Feb 2003 11:15:19 +0000 Subject: [PATCH] make debugs and asserts platform independent.No more use of abort and printf.delete 2 references to arch/cpu.h and arch/lib.h --- src/include/lwip/arch.h | 1 - src/include/lwip/debug.h | 12 +++++------- src/include/lwip/def.h | 1 - 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/include/lwip/arch.h b/src/include/lwip/arch.h index 5f61fac7..d4f1bff7 100644 --- a/src/include/lwip/arch.h +++ b/src/include/lwip/arch.h @@ -40,7 +40,6 @@ #define BIG_ENDIAN 4321 #endif -#include "arch/cpu.h" #include "arch/cc.h" #ifndef PACK_STRUCT_BEGIN diff --git a/src/include/lwip/debug.h b/src/include/lwip/debug.h index f7c616d4..aadefc43 100644 --- a/src/include/lwip/debug.h +++ b/src/include/lwip/debug.h @@ -32,14 +32,13 @@ #ifndef __LWIP_DEBUG_H__ #define __LWIP_DEBUG_H__ -#include - #include "lwipopts.h" #ifdef LWIP_DEBUG -#define LWIP_ASSERT(x,y) if(!(y)) {printf("Assertion \"%s\" failed at line %d in %s\n", \ - x, __LINE__, __FILE__); fflush(NULL); abort();} +#define LWIP_ASSERT(x,y) do { if(!(y)) LWIP_PLATFORM_ASSERT(x) } while(0) +#define DEBUGF(debug, x) do { if(debug) LWIP_PLATFORM_DIAG(x) } while(0) +#define LWIP_ERROR(x) do { LWIP_PLATFORM_DIAG(x) } while(0) /* These defines control the amount of debugging output: */ #define MEM_TRACKING @@ -188,16 +187,15 @@ #define DHCP_DEBUG 0 #endif -#include -#define DEBUGF(debug, x) do { if(debug){ printf x; } } while(0) #else /* LWIP_DEBUG */ -/* DEBUG is not defined, so we define null macros for LWIP_ASSERT and DEBUGF */ +/* DEBUG is not defined, so we define null macros for LWIP_ASSERT , DEBUGF and LWIP_ERROR */ #define LWIP_ASSERT(x,y) #define DEBUGF(debug, x) +#define LWIP_ERROR(x) /* And we define those to be zero: */ diff --git a/src/include/lwip/def.h b/src/include/lwip/def.h index 14c9ca47..6cc41380 100644 --- a/src/include/lwip/def.h +++ b/src/include/lwip/def.h @@ -38,7 +38,6 @@ #define NULL ((void *)0) #endif -#include "arch/lib.h" #endif /* __LWIP_DEF_H__ */