[Top][All Lists]

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

cond tests: fix compilation error on Solaris

From: Bruno Haible
Subject: cond tests: fix compilation error on Solaris
Date: Fri, 11 May 2018 00:37:29 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-119-generic; KDE/5.18.0; x86_64; ; )

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 
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  <address@hidden>

        cond tests: Fix compilation error on Solaris.
        * tests/test-cond.c: Include <unistd.h> before defining 'yield' as a

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)

reply via email to

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