summaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
authorMichael Brown2006-03-23 20:33:57 +0100
committerMichael Brown2006-03-23 20:33:57 +0100
commitaf23ff8a24a9de9b725335527529e5cc743311eb (patch)
tree5208732478b9f9f1793931ad56adf2e394b7d324 /src/include
parentAdded missing #endif (diff)
downloadipxe-af23ff8a24a9de9b725335527529e5cc743311eb.tar.gz
ipxe-af23ff8a24a9de9b725335527529e5cc743311eb.tar.xz
ipxe-af23ff8a24a9de9b725335527529e5cc743311eb.zip
Assertions are now handled via the POSIX-like <assert.h>.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/compiler.h23
-rw-r--r--src/include/dev.h11
2 files changed, 6 insertions, 28 deletions
diff --git a/src/include/compiler.h b/src/include/compiler.h
index 79781bc72..08a2d3648 100644
--- a/src/include/compiler.h
+++ b/src/include/compiler.h
@@ -15,7 +15,7 @@
* Global compiler definitions.
*
* This file is implicitly included by every @c .c file in Etherboot.
- * It defines global macros such as DBG() and ASSERT().
+ * It defines global macros such as DBG().
*
* We arrange for each object to export the symbol @c obj_OBJECT
* (where @c OBJECT is the object name, e.g. @c rtl8139) as a global
@@ -138,25 +138,8 @@ __asm__ ( ".equ\tDEBUG_LEVEL, " DEBUG_SYMBOL_STR );
#define DBG2 DBG_PRINT
#endif
-/**
- * Assert a condition.
- *
- * If the condition is not true, a debug message will be printed.
- * Assertions only take effect if the debug level is non-zero (see
- * DBG()).
- *
- */
-#define ASSERT(x)
-
-#if DEBUG_SYMBOL >= 1
-#undef ASSERT
-#define ASSERT(x) \
- do { \
- if ( ! (x) ) { \
- DBG ( "ASSERT(%s) failed at %s line %d [%s]\n", #x, \
- __FILE__, __LINE__, __FUNCTION__ ); \
- } \
- } while (0)
+#if DEBUG_SYMBOL == 0
+#define NDEBUG
#endif
/** Declare a data structure as packed. */
diff --git a/src/include/dev.h b/src/include/dev.h
index d6e31dabb..fa549deb2 100644
--- a/src/include/dev.h
+++ b/src/include/dev.h
@@ -6,6 +6,7 @@
#include "buffer.h"
#include "dhcp.h" /* for dhcp_dev_id */
#include "tables.h"
+#include <assert.h>
/*
* Forward declarations
@@ -100,17 +101,11 @@ struct bus_dev {
*
*/
-#define LINKER_ASSERT(test,error_symbol) \
- if ( ! (test) ) { \
- extern void error_symbol ( void ); \
- error_symbol(); \
- }
-
#define BUS_LOC_CHECK(datatype) \
- LINKER_ASSERT( ( sizeof (datatype) <= sizeof (struct bus_loc) ), \
+ linker_assert( ( sizeof (datatype) <= sizeof (struct bus_loc) ), \
__BUS_LOC_SIZE_is_too_small__see_dev_h )
#define BUS_DEV_CHECK(datatype) \
- LINKER_ASSERT( ( sizeof (datatype) <= sizeof (struct bus_dev) ), \
+ linker_assert( ( sizeof (datatype) <= sizeof (struct bus_dev) ), \
__BUS_DEV_SIZE_is_too_small__see_dev_h )
/*