diff mbox

[testsuite] Fix gcc.dg/atomic/c11-atomic-exec-[45].c tests on Solaris 10+

Message ID ydd8uwsiapy.fsf@lokon.CeBiTec.Uni-Bielefeld.DE
State New
Headers show

Commit Message

Rainer Orth Nov. 13, 2013, 3:26 p.m. UTC
Two of the new gcc.dg/atomic tests were failing to compile on Solaris 10+:

FAIL: gcc.dg/atomic/c11-atomic-exec-4.c  -O0  (test for excess errors)
Excess errors:
/var/gcc/regression/trunk/10-gcc/build/gcc/include-fixed/sys/feature_tests.h:346:2: error: #error "Compiler or options invalid for pre-UNIX 03 X/Open applications      and pre-2001 POSIX applications"

WARNING: gcc.dg/atomic/c11-atomic-exec-4.c  -O0  compilation failed to produce executable

<sys/feature_tests.h> has

#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"

This doesn't happen on Solaris 9 which lacks C99 support in system
headers.

The following patch fixes this.  Tested by the appropriate runtest
invocation on i386-pc-solaris2.10, ok for mainline?

	Rainer


2013-11-13  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* gcc.dg/atomic/c11-atomic-exec-4.c: Define _XOPEN_SOURCE=600 on
	*-*-solaris2.1[0-9]*.
	* gcc.dg/atomic/c11-atomic-exec-5.c: Likewise.

Comments

Joseph Myers Nov. 13, 2013, 4:30 p.m. UTC | #1
On Wed, 13 Nov 2013, Rainer Orth wrote:

> The following patch fixes this.  Tested by the appropriate runtest
> invocation on i386-pc-solaris2.10, ok for mainline?

OK.  The _POSIX_C_SOURCE definition was intended to allow for any systems 
whose system headers don't like pthreads in strict ISO C mode without a 
feature test macro, but I suppose it's inevitable that the particular 
feature test macros needed are going to vary from system to system.
diff mbox

Patch

# HG changeset patch
# Parent c636e28757231d8549c20a35a4cd3f94296082f5
Fix gcc.dg/atomic/c11-atomic-exec-[45].c tests on Solaris 10+

diff --git a/gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-4.c b/gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-4.c
--- a/gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-4.c
+++ b/gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-4.c
@@ -3,6 +3,7 @@ 
    out in two threads.  */
 /* { dg-do run } */
 /* { dg-options "-std=c11 -pedantic-errors -pthread -D_POSIX_C_SOURCE=200809L" } */
+/* { dg-additional-options "-D_XOPEN_SOURCE=600" { target *-*-solaris2.1[0-9]* } }
 /* { dg-require-effective-target pthread } */
 
 #include <stdint.h>
diff --git a/gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-5.c b/gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-5.c
--- a/gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-5.c
+++ b/gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-5.c
@@ -4,6 +4,7 @@ 
    get properly cleared).  */
 /* { dg-do run } */
 /* { dg-options "-std=c11 -pedantic-errors -pthread -D_POSIX_C_SOURCE=200809L" } */
+/* { dg-additional-options "-D_XOPEN_SOURCE=600" { target *-*-solaris2.1[0-9]* } }
 /* { dg-require-effective-target fenv_exceptions } */
 /* { dg-require-effective-target pthread } */