diff options
author | Brad King <brad.king@kitware.com> | 2024-04-17 17:12:26 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2024-04-17 17:14:11 (GMT) |
commit | b26ce8a1c98d7cc99318b9bff7c460735991030d (patch) | |
tree | eedfc79c4333218c927488b03222038f09534c36 /Tests | |
parent | 56f333ef2fc416772f08ce9fc77cd17be620755f (diff) | |
download | CMake-b26ce8a1c98d7cc99318b9bff7c460735991030d.zip CMake-b26ce8a1c98d7cc99318b9bff7c460735991030d.tar.gz CMake-b26ce8a1c98d7cc99318b9bff7c460735991030d.tar.bz2 |
Tests/FindBacktrace: Fix compilation as C90
Revise the test from commit 9433755e5d (FindBacktrace: Add imported
library, 2024-04-06) to work when compiled as C90.
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/FindBacktrace/Test/backtrace.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Tests/FindBacktrace/Test/backtrace.c b/Tests/FindBacktrace/Test/backtrace.c index 1a60b14..e143bc7 100644 --- a/Tests/FindBacktrace/Test/backtrace.c +++ b/Tests/FindBacktrace/Test/backtrace.c @@ -13,6 +13,7 @@ void myfunc3(void) int nptrs; void* buffer[BT_BUF_SIZE]; char** strings; + size_t j; nptrs = backtrace(buffer, BT_BUF_SIZE); printf("backtrace() returned %d addresses\n", nptrs); @@ -26,8 +27,9 @@ void myfunc3(void) exit(EXIT_FAILURE); } - for (size_t j = 0; j < nptrs; j++) + for (j = 0; j < nptrs; j++) { printf("%s\n", strings[j]); + } free(strings); } @@ -40,10 +42,11 @@ myfunc2(void) void myfunc(int ncalls) { - if (ncalls > 1) + if (ncalls > 1) { myfunc(ncalls - 1); - else + } else { myfunc2(); + } } int main(int argc, char* argv[]) |