From c211ce8be163ab65011d05ba9853817fb2923166 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 11 Jun 2016 12:49:21 -0600 Subject: [PATCH] DEBUGASSERT() is not enabled with CONFIG_DEBUG_ASSERTIONS, not CONFIG_DEBUG --- Kconfig | 15 +++++++++++++-- include/assert.h | 10 +++++----- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Kconfig b/Kconfig index ceea41ec91..b0afa42a9c 100644 --- a/Kconfig +++ b/Kconfig @@ -413,7 +413,7 @@ if DEBUG comment "Debug SYSLOG Output Controls" -config DEBUG_WARNINGS +config DEBUG_WARN bool "Enable Warnings Output" default n ---help--- @@ -424,12 +424,23 @@ config DEBUG_WARNINGS config DEBUG_INFO bool "Enable Informational Debug Output" default n - depends on DEBUG_WARNINGS + depends on DEBUG_WARN ---help--- Enables verbose "informational" debug output. If you enable CONFIG_DEBUG_INFO, then very chatty (and often annoying) output will be generated. +config DEBUG_ASSERTIONS + bool "Enable Debug Assertions" + default n + ---help--- + Enables the DEBUGASSERT() macro. When CONFIG_DEBUG_ASSERTIONS is + defined, DEBUGASSERT() will cause the system to halt if the + assertion fails. If CONFIG_DEBUG_ASSERTIONS is not defined + DEBUGASSERT() compiled out of the system. In general, you would + set CONFIG_DEBUG_ASSERTIONS=y during debug, but disable the + assertions on a final, buckled up system. + comment "Subsystem Debug Options" config DEBUG_AUDIO diff --git a/include/assert.h b/include/assert.h index c636dae9a9..8f218f2cdd 100644 --- a/include/assert.h +++ b/include/assert.h @@ -52,9 +52,9 @@ #undef ASSERT /* Assert if the condition is not true */ #undef VERIFY /* Assert if a function returns a negative value */ #undef PANIC /* Unconditional abort */ -#undef DEBUGASSERT /* Like ASSERT, but only if CONFIG_DEBUG is defined */ -#undef DEBUGVERIFY /* Like VERIFY, but only if CONFIG_DEBUG is defined */ -#undef DEBUGPANIC /* Like PANIC, but only if CONFIG_DEBUG is defined */ +#undef DEBUGASSERT /* Like ASSERT, but only if CONFIG_DEBUG_ASSERTIONS is defined */ +#undef DEBUGVERIFY /* Like VERIFY, but only if CONFIG_DEBUG_ASSERTIONS is defined */ +#undef DEBUGPANIC /* Like PANIC, but only if CONFIG_DEBUG_ASSERTIONS is defined */ #ifdef CONFIG_HAVE_FILENAME @@ -89,7 +89,7 @@ #endif -#ifdef CONFIG_DEBUG +#ifdef CONFIG_DEBUG_ASSERTIONS # define DEBUGASSERT(f) ASSERT(f) # define DEBUGVERIFY(f) VERIFY(f) @@ -101,7 +101,7 @@ # define DEBUGVERIFY(f) ((void)(f)) # define DEBUGPANIC() -# endif /* CONFIG_DEBUG */ +# endif /* CONFIG_DEBUG_ASSERTIONS */ /* The C standard states that if NDEBUG is defined, assert will do nothing. * Users can define and undefine NDEBUG as they see fit to choose when assert