This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit e3e92aac04664089d04c4dbf7b1ce576a289763a
Author: Bowen Wang <[email protected]>
AuthorDate: Wed Nov 25 13:07:40 2026 +0800

    debug: add DEBUG_FUNCTIONNAME to drop the function name from debug output
    
    _emerg(), _alert(), _err(), _warn(), _info() and the subsystem macros
    built on them prepend "%s: " and __FUNCTION__ to every message unless
    DEFAULT_SMALL is set. DEFAULT_SMALL also changes the defaults of a few
    hundred other options, so a board that only needs the space taken by
    the function names has no way to drop them alone.
    
    Add DEBUG_FUNCTIONNAME, defaulting to !DEFAULT_SMALL so that no existing
    configuration changes, and use it instead of DEFAULT_SMALL in
    include/nuttx/debug.h.
    
    Signed-off-by: Bowen Wang <[email protected]>
---
 Kconfig               | 11 +++++++++++
 include/nuttx/debug.h |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/Kconfig b/Kconfig
index 72a07803089..5d72871a053 100644
--- a/Kconfig
+++ b/Kconfig
@@ -774,6 +774,17 @@ config ASSERTIONS_FILENAME
                function when it is enabled. This option maybe will take up a 
lot
                of space from applications.
 
+config DEBUG_FUNCTIONNAME
+       bool "Prefix debug messages with the function name"
+       default !DEFAULT_SMALL
+       ---help---
+               Prefix each message of the _emerg(), _alert(), _err(), _warn()
+               and _info() families with the name of the calling function.
+               Disabling it removes the name strings and the extra argument
+               from every such call.
+
+               Defaults to y unless DEFAULT_SMALL is selected.
+
 config DEBUG_ALERT
        bool
        default n
diff --git a/include/nuttx/debug.h b/include/nuttx/debug.h
index 130a2857dba..ae142ecff23 100644
--- a/include/nuttx/debug.h
+++ b/include/nuttx/debug.h
@@ -85,7 +85,7 @@
  */
 
 #if !defined(EXTRA_FMT) && !defined(EXTRA_ARG) && \
-    defined(CONFIG_HAVE_FUNCTIONNAME) && !defined(CONFIG_DEFAULT_SMALL)
+    defined(CONFIG_HAVE_FUNCTIONNAME) && defined(CONFIG_DEBUG_FUNCTIONNAME)
 #  define EXTRA_FMT "%s: "
 #  define EXTRA_ARG ,__FUNCTION__
 #endif

Reply via email to