Skip to content

Commit

Permalink
Use 'int' type for backtrace() return value
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Explorer09 authored and BenBE committed Aug 13, 2024
1 parent 81432ba commit 3cfc289
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions CRT.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3cfc289

Please sign in to comment.