A testdir for 'cond' fails to compile on Solaris 10: gcc -O2 -DHAVE_CONFIG_H -I. -I../../gltests -I.. -DGNULIB_STRICT_CHECKING=1 -DIN_GNULIB_TESTS=1 -I. -I../../gltests -I.. -I../../gltests/.. -I../gllib -I../../gltests/../gllib -I/home/haible/prefix-x86/include -Wall -D_REENTRANT -g -O2 -MT test-cond.o -MD -MP -MF .deps/test-cond.Tpo -c -o test-cond.o ../../gltests/test-cond.c In file included from ./unistd.h:40:0, from ../../gltests/test-cond.c:61: /usr/include/unistd.h:542:23: error: macro "yield" passed 1 arguments, but takes just 0 extern void yield(void); ^ *** Error code 1
The reason is that on Solaris, <unistd.h> declares yield(), which we have defined as a macro in this compilation unit. This patch fixes it. 2018-05-10 Bruno Haible <br...@clisp.org> cond tests: Fix compilation error on Solaris. * tests/test-cond.c: Include <unistd.h> before defining 'yield' as a macro. diff --git a/tests/test-cond.c b/tests/test-cond.c index d2bf560..658596f 100644 --- a/tests/test-cond.c +++ b/tests/test-cond.c @@ -36,6 +36,7 @@ #include <stdlib.h> #include <string.h> #include <sys/time.h> +#include <unistd.h> #include "glthread/cond.h" #include "glthread/lock.h" @@ -58,7 +59,6 @@ /* * Condition check */ -#include <unistd.h> static int cond_value = 0; gl_cond_define_initialized(static, condtest) gl_lock_define_initialized(static, lockcond)