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 e2e98f87a99aa662a8b116e1c9d17debad092a7f
Author: yinshengkai <[email protected]>
AuthorDate: Tue Apr 8 18:12:55 2025 +0800

    libc: fix lib_backtrace warning
    
    backtrace_dump() printed the size_t capacity, used count and slot with
    %u, and the reference count with %u.  Use %zu for the size_t values
    and print the reference count as an int.
    
    Signed-off-by: yinshengkai <[email protected]>
---
 libs/libc/misc/lib_backtrace.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libs/libc/misc/lib_backtrace.c b/libs/libc/misc/lib_backtrace.c
index 8c84d274145..4c3ab140fa9 100644
--- a/libs/libc/misc/lib_backtrace.c
+++ b/libs/libc/misc/lib_backtrace.c
@@ -464,7 +464,7 @@ void backtrace_dump(void)
   FAR struct backtrace_pool_s *bp = &g_backtrace_pool;
   FAR struct backtrace_entry_s *entry;
   size_t conflict = 0;
-  uint32_t slot;
+  size_t slot;
 
   syslog(LOG_INFO, "%-8s %-8s %s", "slot", "refcount", "backtrace");
   for (slot = 0; slot < bp->capacity; slot++)
@@ -473,13 +473,13 @@ void backtrace_dump(void)
       while (entry)
         {
           backtrace_format(buf, sizeof(buf), entry->stack, entry->depth);
-          syslog(LOG_INFO, "%-8zu %-8u %s\n", slot, entry->ref, buf);
+          syslog(LOG_INFO, "%-8zu %-8d %s\n", slot, (int)entry->ref, buf);
           conflict += entry->next != NULL;
           entry = entry->next;
         }
     }
 
-  syslog(LOG_INFO, "capacity: %u, used: %u, conflict: %zu\n",
+  syslog(LOG_INFO, "capacity: %zu, used: %zu, conflict: %zu\n",
          bp->capacity, bp->used, conflict);
 }
 #endif

Reply via email to