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

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

commit a537215681bdbb9f2384deb13d748436d702f4f8
Author: Marco Casaroli <[email protected]>
AuthorDate: Sun Nov 8 18:04:25 2026 +0100

    sched_note: Keep the format of a sched_note_printf() with many arguments.
    
    With CONFIG_DRIVERS_NOTE_STRIP_FORMAT, sched_note_printf() puts the
    format in the .printf_format section and encodes the type of each
    argument in a 32-bit tag.  The tag has room for 14 arguments, and a
    static assertion stops the build for a call with more.
    
    With CONFIG_SYSLOG_TO_SCHED_NOTE, every syslog() call is a
    sched_note_printf() call.  The task dump in sched/misc/assert.c has up
    to 19 arguments, so the build fails:
    
      misc/assert.c:412:3: error: static assertion failed: "The number of
      sched_note_nprintf parameters needs to be less than 14"
    
    For a call with more than 14 arguments, keep the format string and give
    type 0, as sched_note_printf() does without
    CONFIG_DRIVERS_NOTE_STRIP_FORMAT.  The note driver then reads the
    arguments from the format.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 include/nuttx/sched_note.h | 25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/include/nuttx/sched_note.h b/include/nuttx/sched_note.h
index 8cea95495d0..14cb25f45c0 100644
--- a/include/nuttx/sched_note.h
+++ b/include/nuttx/sched_note.h
@@ -192,17 +192,26 @@
         sched_note_vprintf_ip(tag, SCHED_NOTE_IP, fmt, 0, &(va))
 
 #ifdef CONFIG_DRIVERS_NOTE_STRIP_FORMAT
+/* The type tag describes at most 14 arguments.  A call with more arguments
+ * keeps its format string and gives type 0.
+ */
+
 #  define sched_note_printf(tag, fmt, ...) \
           do \
             { \
-              static const locate_data(".printf_format") \
-              char __fmt__[] = fmt; \
-              uint32_t __type__ = NOTE_PRINTF_TAG(__VA_ARGS__); \
-              static_assert(GET_ARG_COUNT(__VA_ARGS__) <= 14, \
-                            "The number of sched_note_nprintf " \
-                            "parameters needs to be less than 14"); \
-              sched_note_printf_ip(tag, SCHED_NOTE_IP, __fmt__, \
-                                   __type__, ##__VA_ARGS__); \
+              if (GET_ARG_COUNT(__VA_ARGS__) > 14) \
+                { \
+                  sched_note_printf_ip(tag, SCHED_NOTE_IP, fmt, 0, \
+                                       ##__VA_ARGS__); \
+                } \
+              else \
+                { \
+                  static const locate_data(".printf_format") \
+                  char __fmt__[] = fmt; \
+                  uint32_t __type__ = NOTE_PRINTF_TAG(__VA_ARGS__); \
+                  sched_note_printf_ip(tag, SCHED_NOTE_IP, __fmt__, \
+                                       __type__, ##__VA_ARGS__); \
+                } \
             } \
           while (0)
 #else

Reply via email to