bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* test-simple-atomic.c compilation error on Solaris
@ 2021-03-18 19:41 Tom G. Christensen
  2021-03-19  2:51 ` Bruno Haible
  0 siblings, 1 reply; 2+ messages in thread
From: Tom G. Christensen @ 2021-03-18 19:41 UTC (permalink / raw)
  To: bug-gnulib

Hello,

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.


It needs <unistd.h> before defining the macro.
Same issue as 617bc96d54db37c138bafb1872056de4453a248b.

-tgc


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: test-simple-atomic.c compilation error on Solaris
  2021-03-18 19:41 test-simple-atomic.c compilation error on Solaris Tom G. Christensen
@ 2021-03-19  2:51 ` Bruno Haible
  0 siblings, 0 replies; 2+ messages in thread
From: Bruno Haible @ 2021-03-19  2:51 UTC (permalink / raw)
  To: bug-gnulib

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];
 



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-19  2:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-18 19:41 test-simple-atomic.c compilation error on Solaris Tom G. Christensen
2021-03-19  2:51 ` Bruno Haible

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).