From 46719f2264fc63deaa712f4dc164d3b33c66e05f Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Tue, 5 Jul 2016 13:28:51 +0100 Subject: [libc] Allow assertions to be globally enabled or disabled Assertions are enabled for objects built with any debug level (including an explicit debug level of zero). It is sometimes useful to be able to enable assertions across all objects; this currently requires manually hacking include/assert.h. Allow assertions to be globally enabled by adding ASSERT=1 to the build command line. For example: make bin/8086100e.mrom ASSERT=1 Similarly, allow assertions to be globally disabled by adding ASSERT=0 to the build command line. If no ASSERT=... is specified on the build command line, then only objects mentioned in DEBUG=... will have assertions enabled (as is currently the case). Note than globally enabling assertions imposes a relatively heavy runtime penalty, primarily due to the various sanity checks performed by list_add(), list_for_each_entry(), etc. Signed-off-by: Michael Brown --- src/include/assert.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/include') diff --git a/src/include/assert.h b/src/include/assert.h index 07f3ecb8c..dd71fa713 100644 --- a/src/include/assert.h +++ b/src/include/assert.h @@ -12,11 +12,13 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); +#ifndef ASSERTING #ifdef NDEBUG #define ASSERTING 0 #else #define ASSERTING 1 #endif +#endif extern unsigned int assertion_failures; -- cgit v1.2.3-55-g7522