This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [libgomp, libiberty, libobjc] Fix gnu11 fallout on Solaris 10+


Richard Henderson <rth@redhat.com> writes:

> On 10/24/2014 01:56 AM, Rainer Orth wrote:
>> And even with the _XOPEN_SOURCE business out of the way, there's still
>> the question what to do about _POSIX_SOURCE in libiberty/sigsetmask.c.
>> Given that it was introduced almost 20 years ago, it may well be
>> unnecessary for the systems we still care about.
>
> Probably.

I've included the following patch in my Solaris 10, 11, and Linux/x86_64
bootstraps for some time now.  I guess the risk of just defining
_XOPEN_SOURCE to 600 is manageable and eventual fallout restricted to
GCC; not sure about the libiberty change, given that it probably
supports far more and older systems than GCC does.

Anyway: ok for mainline?

Thanks.
	Rainer


2014-10-22  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	libobjc:
	* thr.c (_XOPEN_SOURCE): Define as 600.

	libiberty:
	* sigsetmask.c (_POSIX_SOURCE): Remove.

	libgomp:
	* config/posix/lock.c (_XOPEN_SOURCE) Define as 600.

# HG changeset patch
# Parent 0ae9b18fcb6f31523dd31f1825a3bb540ad84289
Fix gnu11 fallout on Solaris 10+

diff --git a/libgomp/config/posix/lock.c b/libgomp/config/posix/lock.c
--- a/libgomp/config/posix/lock.c
+++ b/libgomp/config/posix/lock.c
@@ -30,8 +30,9 @@
    to do better and streamline the locking as well as reduce the size
    of the types exported.  */
 
-/* We need Unix98 extensions to get recursive locks.  */
-#define _XOPEN_SOURCE 500
+/* We need UNIX98/XPG5 extensions to get recursive locks.  Request XPG6 since
+   Solaris requires this for C99 and later.  */
+#define _XOPEN_SOURCE 600
 
 #include "libgomp.h"
 
diff --git a/libiberty/sigsetmask.c b/libiberty/sigsetmask.c
--- a/libiberty/sigsetmask.c
+++ b/libiberty/sigsetmask.c
@@ -15,7 +15,6 @@ be the value @code{1}).
 
 */
 
-#define _POSIX_SOURCE
 #include <ansidecl.h>
 /* Including <sys/types.h> seems to be needed by ISC. */
 #include <sys/types.h>
diff --git a/libobjc/thr.c b/libobjc/thr.c
--- a/libobjc/thr.c
+++ b/libobjc/thr.c
@@ -27,8 +27,9 @@ see the files COPYING3 and COPYING.RUNTI
 #define _LIBOBJC
 /* The line below is needed for declarations of functions such as
    pthread_mutexattr_settype, without which gthr-posix.h may fail to
-   compile within libobjc.  */
-#define _XOPEN_SOURCE 500
+   compile within libobjc.  While we only need XPG5 for this, Solaris
+   requires XPG6 for C99 and later.  */
+#define _XOPEN_SOURCE 600
 #include "config.h"
 #include "tconfig.h"
 #include "coretypes.h"
-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]