Building a testdir of all of Gnulib on Solaris 10 with Oracle Studio 12.6 and no optimization CC="cc -D_STDC_C99= -O"; CXX="CC -O"; export CC CXX I see a link error:
cc -Wno-error -Wno-error -g -o test-spawn-pipe-child test-spawn-pipe-child.o -lm -lm -lm -lm -lm -lm -lm -lm -lm -lm -lm Undefined first referenced symbol in file print_stack_trace test-spawn-pipe-child.o ld: fatal: symbol referencing errors. No output written to test-spawn-pipe-child gmake[4]: *** [Makefile:24978: test-spawn-pipe-child] Error 2 The cause is that the ASSERT macro invokes print_stack_trace() inside an 'if (0)', which is not getting optimized away. This patch fixes it. 2026-05-10 Bruno Haible <[email protected]> spawn-pipe tests: Fix link error with non-optimizing compilers. * tests/test-spawn-pipe-child.c (print_stack_trace): Define to empty. diff --git a/tests/test-spawn-pipe-child.c b/tests/test-spawn-pipe-child.c index 5080348399..cf4b27655c 100644 --- a/tests/test-spawn-pipe-child.c +++ b/tests/test-spawn-pipe-child.c @@ -38,6 +38,8 @@ #define BACKUP_STDERR_FILENO 10 #define ASSERT_STREAM myerr #undef CONTINUE_AFTER_ASSERT +#undef print_stack_trace +#define print_stack_trace() /* nothing */ #include "macros.h" static FILE *myerr;
