bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: test-simple-atomic.c compilation error on Solaris


From: Bruno Haible
Subject: Re: test-simple-atomic.c compilation error on Solaris
Date: Fri, 19 Mar 2021 03:51:05 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-203-generic; KDE/5.18.0; x86_64; ; )

Hi Tom,

> The test-simple-atomic test is failing to build on Solaris (tested 10 
> and older).
> 
> Here's the error from Solaris 10:
> 
> make[3]: Entering directory 
> `/export/home/tgc/tmp/daily_build/gnulib/000-gnulib-simple-363497c93/gltests'
> depbase=`echo test-simple-atomic.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
> /usr/tgcware/gcc9/bin/gcc -DHAVE_CONFIG_H -DEXEEXT=\"\" -I. -I.. 
> -DGNULIB_STRICT_CHECKING=1 -DIN_GNULIB_TESTS=1 -I. -I. -I.. -I./.. 
> -I../gllib -I./../gllib -I/usr/tgcware/include -D_REENTRANT  -g -O2 -MT 
> test-simple-atomic.o -MD -MP -MF $depbase.Tpo -c -o test-simple-atomic.o 
> test-simple-atomic.c &&\
> mv -f $depbase.Tpo $depbase.Po
> In file included from ../gllib/unistd.h:40,
>                   from ../gllib/stdlib.h:100,
>                   from ../gllib/glthread/thread.h:74,
>                   from test-simple-atomic.c:43:
> /usr/include/unistd.h:542:23: error: macro "yield" passed 1 arguments, 
> but takes just 0
>    542 | extern void yield(void);
>        |                       ^
> test-simple-atomic.c:38: note: macro "yield" defined here
>     38 | # define yield() gl_thread_yield ()
>        |
> make[3]: *** [test-simple-atomic.o] Error 1
> make[3]: Target `check-am' not remade because of errors.

I can reproduce it with a testdir of all of gnulib.
This patch fixes it.


2021-03-18  Bruno Haible  <bruno@clisp.org>

        simple-atomic tests: Fix compilation error on Solaris 10.
        Reported by Tom G. Christensen <tgc@jupiterrise.com> in
        <https://lists.gnu.org/archive/html/bug-gnulib/2021-03/msg00085.html>.
        * tests/test-simple-atomic.c (yield): Define only after all #includes.

diff --git a/tests/test-simple-atomic.c b/tests/test-simple-atomic.c
index 04baf05..e30506a 100644
--- a/tests/test-simple-atomic.c
+++ b/tests/test-simple-atomic.c
@@ -34,17 +34,17 @@
    implementation.  */
 #define REPEAT_COUNT 1000
 
+#include "glthread/thread.h"
+#include "glthread/yield.h"
+
+#include "macros.h"
+
 #if EXPLICIT_YIELD
 # define yield() gl_thread_yield ()
 #else
 # define yield()
 #endif
 
-#include "glthread/thread.h"
-#include "glthread/yield.h"
-
-#include "macros.h"
-
 /* Counters for each thread.  */
 static unsigned int counter[THREAD_COUNT][5];
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]