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: Andrew Pinski <pinskia at gmail dot com>
- To: Rainer Orth <ro at cebitec dot uni-bielefeld dot de>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Richard Henderson <rth at redhat dot com>, Jakub Jelinek <jakub at redhat dot com>, Ian Lance Taylor <iant at google dot com>
- Date: Thu, 23 Oct 2014 12:12:54 -0700
- 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>
On Wed, Oct 22, 2014 at 4:43 AM, Rainer Orth
<ro@cebitec.uni-bielefeld.de> wrote:
> The gnu11 patch broke Solaris 10 and 11 bootstrap: <sys/feature_test.h>
> has
>
> /*
> * It is invalid to compile an XPG3, XPG4, XPG4v2, or XPG5 application
> * using c99. The same is true for POSIX.1-1990, POSIX.2-1992, POSIX.1b,
> * and POSIX.1c applications. Likewise, it is invalid to compile an XPG6
> * or a POSIX.1-2001 application with anything other than a c99 or later
> * compiler. Therefore, we force an error in both cases.
> */
> #if defined(_STDC_C99) && (defined(__XOPEN_OR_POSIX) && !defined(_XPG6))
> #error "Compiler or options invalid for pre-UNIX 03 X/Open applications \
> and pre-2001 POSIX applications"
> #elif !defined(_STDC_C99) && \
> (defined(__XOPEN_OR_POSIX) && defined(_XPG6))
> #error "Compiler or options invalid; UNIX 03 and POSIX.1-2001 applications \
> require the use of c99"
> #endif
>
> so the headers now error out for any definition of (say) _XOPEN_SOURCE < 600.
>
> Obviously, the gnu11 patch is going to cause lots of trouble once GCC 5
> is released.
>
> The following patch handles this situation, using the most conservative
> (and most ugly since using platform-specific code) approach of defining
> the necessary feature test macros only for Solaris. I suppose the two
> _XOPEN_SOURCE defines (both present from when the code was added) could
> easily be changed to 600 instead; not sure why _POSIX_SOURCE would be
> necessary in sigsetmask.c (also present from day one).
>
> Anyway, this patch restores bootstrap, as verified on
> i386-pc-solaris2.11 and sparc-sun-solaris2.11.
>
> Ok for mainline?
>
> Rainer
>
>
> 2014-10-22 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
>
> libobjc:
> * thr.c (_XOPEN_SOURCE) [__sun__ && __svr4__]: Define as 600.
This is fine.
Thanks,
Andrew
>
> libiberty:
> * sigsetmask.c (_POSIX_C_SOURCE) [__sun__ && __svr4__ &&
> __STDC_VERSION__ >= 200112L]: Define as 200112L.
>
> libgomp:
> * config/posix/lock.c (_XOPEN_SOURCE) [__sun__ && __svr4__]:
> Define as 600.
>
>
>
> --
> -----------------------------------------------------------------------------
> Rainer Orth, Center for Biotechnology, Bielefeld University
>