This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [libgomp, libiberty, libobjc] Fix gnu11 fallout on Solaris 10+
- From: Rainer Orth <ro at CeBiTec dot Uni-Bielefeld dot DE>
- To: Richard Henderson <rth at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org, Jakub Jelinek <jakub at redhat dot com>, Ian Lance Taylor <iant at google dot com>, Andrew Pinski <pinskia at gmail dot com>
- Date: Mon, 03 Nov 2014 17:22:42 +0100
- Subject: Re: [libgomp, libiberty, libobjc] Fix gnu11 fallout on Solaris 10+
- Authentication-results: sourceware.org; auth=none
- References: <ydd4muwtjmi dot fsf at lokon dot CeBiTec dot Uni-Bielefeld dot DE> <54495012 dot 1070906 at redhat dot com> <ydda94l3kyc dot fsf at CeBiTec dot Uni-Bielefeld dot DE> <544E6043 dot 9090104 at redhat dot com>
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