From 3cfc28968feee6ebbbf2058f2046ba0bab87c89f Mon Sep 17 00:00:00 2001 From: Explorer09 Date: Mon, 12 Aug 2024 20:00:27 +0800 Subject: [PATCH] Use 'int' type for backtrace() return value The libc backtrace() API uses 'int' type for "number of pointers" return value, and backtrace_symbols_fd() accepts this value as argument in 'int' type, too. Using size_t would unnecessarily generate a "-Wshorten-64-to-32" warning in Clang 19. --- CRT.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CRT.c b/CRT.c index 5d617215b..a60857a17 100644 --- a/CRT.c +++ b/CRT.c @@ -1260,8 +1260,8 @@ static void print_backtrace(void) { #elif defined(HAVE_EXECINFO_H) void* backtraceArray[256]; - size_t size = backtrace(backtraceArray, ARRAYSIZE(backtraceArray)); - backtrace_symbols_fd(backtraceArray, size, STDERR_FILENO); + int nptrs = backtrace(backtraceArray, ARRAYSIZE(backtraceArray)); + backtrace_symbols_fd(backtraceArray, nptrs, STDERR_FILENO); #else #error No implementation for print_backtrace()! #endif