You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ra...@apache.org on 2024/11/03 10:44:48 UTC

(nuttx) 01/03: sched/misc/assert.c: don't compile dump_task logic if CONFIG_DEBUG_ALERT=n

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

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

commit d45998e7dbfe6f1c741749ed3c254888fb4080b4
Author: raiden00pl <ra...@railab.me>
AuthorDate: Sun Nov 3 11:07:24 2024 +0100

    sched/misc/assert.c: don't compile dump_task logic if CONFIG_DEBUG_ALERT=n
    
    Don't compile dump_task logic if CONFIG_DEBUG_ALERT=n.
    With _alert() disabled this logic does nothing, but the compiler
    is not smart enough to optimize this code.
    
    on minimal stm32f3 configuration it saves 396B of flash.
---
 sched/misc/assert.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sched/misc/assert.c b/sched/misc/assert.c
index 53948a16cc..c77d1d617c 100644
--- a/sched/misc/assert.c
+++ b/sched/misc/assert.c
@@ -109,6 +109,7 @@ static bool g_cpu_paused[CONFIG_SMP_NCPUS];
 static uintptr_t g_last_regs[CONFIG_SMP_NCPUS][XCPTCONTEXT_REGS]
                  aligned_data(XCPTCONTEXT_ALIGN);
 
+#ifdef CONFIG_DEBUG_ALERT
 static FAR const char * const g_policy[4] =
 {
   "FIFO", "RR", "SPORADIC"
@@ -121,6 +122,7 @@ static FAR const char * const g_ttypenames[4] =
   "Kthread",
   "Invalid"
 };
+#endif
 
 /****************************************************************************
  * Private Functions
@@ -326,6 +328,7 @@ static void dump_stacks(FAR struct tcb_s *rtcb, uintptr_t sp)
 
 #endif
 
+#ifdef CONFIG_DEBUG_ALERT
 /****************************************************************************
  * Name: dump_task
  ****************************************************************************/
@@ -422,6 +425,7 @@ static void dump_task(FAR struct tcb_s *tcb, FAR void *arg)
          , args
         );
 }
+#endif
 
 /****************************************************************************
  * Name: dump_backtrace
@@ -522,7 +526,9 @@ static void dump_tasks(void)
     }
 #endif
 
+#ifdef CONFIG_DEBUG_ALERT
   nxsched_foreach(dump_task, NULL);
+#endif
 
 #ifdef CONFIG_SCHED_BACKTRACE
   nxsched_foreach(dump_backtrace, NULL);