From d05683460508b5356aa4b56a29aa6dfefcc8f84e Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Thu, 3 Feb 2022 03:47:49 +0800 Subject: [PATCH] Add CONFIG_NDEBUG Kconfig to control NDEBUG definition Signed-off-by: Xiang Xiao --- Kconfig | 4 ++++ tools/Config.mk | 3 +++ 2 files changed, 7 insertions(+) diff --git a/Kconfig b/Kconfig index f5dcc67996b..87fefc98b1f 100644 --- a/Kconfig +++ b/Kconfig @@ -557,6 +557,10 @@ endmenu # Customize Header Files menu "Debug Options" +config NDEBUG + bool "Define NDEBUG globally" + default y + config DEBUG_ALERT bool default n diff --git a/tools/Config.mk b/tools/Config.mk index fb80439433d..7a0700b08aa 100644 --- a/tools/Config.mk +++ b/tools/Config.mk @@ -535,6 +535,9 @@ endef # ARCHxxx means the predefined setting(either toolchain, arch, or system specific) ARCHDEFINES += ${shell $(DEFINE) "$(CC)" __NuttX__} +ifeq ($(CONFIG_NDEBUG),y) + ARCHDEFINES += ${shell $(DEFINE) "$(CC)" NDEBUG} +endif # The default C/C++ search path