This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RFA: Testsuite: Prevent limits.h from using #include_next in strictANSI mode
- From: Nick Clifton <nickc at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 10 Nov 2004 14:29:31 +0000
- Subject: RFA: Testsuite: Prevent limits.h from using #include_next in strictANSI mode
Hi Guys,
Please may I have permission to apply the following patch ? It fixes
several unexpected failures in the GCC and G++ testsuites for the
xstormy16 port, and probably for other ports as well.
The problem was that a GCC version of the system header file
<limits.h> was being included, and this header used the
#include_next <> preprocessor operation to chain on to the next
version of the header file. This causes failures when the test file
concerned is being compiled in a strict ANSI mode, since
#include_next is a GCC extension.
The patch fixes the problem by undefining __GNUC__ before <limits.h>
is included if strict ANSI mode has been enabled. Tested with no
regressions and 13 resolved unexpected failures on the xstormy16-elf
port.
Cheers
Nick
gcc/testsuite/ChangeLog
2004-11-09 Nick Clifton <nickc@redhat.com>
* g++.dg/abi/bitfield4.C: When in strict ANSI mode, undefine
__GNUC__ so that <limits.h> will not attempt to use the GCC
extension #include_next <>.
* g++.dg/init/enum2.c: Likewise.
* g++.old-deja/g++.benjamin/bool01.C: Likewise.
* g++.old-deja/g++.benjamin/p12475.C: Likewise.
* g++.old-deja/g++.jason/rfg10.C: Likewise.
* gcc.dg/c90-intconst-1.c: Likewise.
* gcc.dg/c99-intconst-1.c: Likewise.
* gcc.dg/c90-intprom-1.c: Likewise.
* gcc.dg/c99-intprom-1.c: Likewise.
* gcc.dg/init-string-2.c Likewise.
* gcc.dg/smod-1.c Likewise.
* gcc.dg/cpp/ucs.c Likewise.
* gcc.dg/cpp/arith-3.c Likewise.
Index: g++.dg/abi/bitfield4.C
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/g++.dg/abi/bitfield4.C,v
retrieving revision 1.1
diff -c -3 -p -r1.1 bitfield4.C
*** g++.dg/abi/bitfield4.C 8 Aug 2002 22:52:20 -0000 1.1
--- g++.dg/abi/bitfield4.C 10 Nov 2004 14:21:41 -0000
***************
*** 6,11 ****
--- 6,17 ----
Contributed by Nathan Sidwell <nathan@codesourcery.com>
*/
+ #if defined __STRICT_ANSI__
+ /* Make sure that __GNUC__ is not defined so that <limits.h> will not
+ be tempted to use #include_next. This is a GCC extension and will
+ not work in strict ANSI mode. */
+ #undef __GNUC__
+ #endif
#include <limits.h>
#include <stdio.h>
Index: g++.dg/init/enum2.C
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/g++.dg/init/enum2.C,v
retrieving revision 1.2
diff -c -3 -p -r1.2 enum2.C
*** g++.dg/init/enum2.C 29 Jul 2003 01:14:24 -0000 1.2
--- g++.dg/init/enum2.C 10 Nov 2004 14:21:41 -0000
***************
*** 1,3 ****
--- 1,9 ----
+ #if defined __STRICT_ANSI__
+ /* Make sure that __GNUC__ is not defined so that <limits.h> will not
+ be tempted to use #include_next. This is a GCC extension and will
+ not work in strict ANSI mode. */
+ #undef __GNUC__
+ #endif
#include <limits.h>
enum test {
z = 0,
Index: g++.old-deja/g++.benjamin/bool01.C
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/g++.old-deja/g++.benjamin/bool01.C,v
retrieving revision 1.7
diff -c -3 -p -r1.7 bool01.C
*** g++.old-deja/g++.benjamin/bool01.C 1 May 2003 02:02:33 -0000 1.7
--- g++.old-deja/g++.benjamin/bool01.C 10 Nov 2004 14:21:42 -0000
***************
*** 2,7 ****
--- 2,13 ----
//980323 bkoz
//test for bools with inclusive ors
+ #if defined __STRICT_ANSI__
+ /* Make sure that __GNUC__ is not defined so that <limits.h> will not
+ be tempted to use #include_next. This is a GCC extension and will
+ not work in strict ANSI mode. */
+ #undef __GNUC__
+ #endif
#include <assert.h>
#include <limits.h>
Index: g++.old-deja/g++.benjamin/p12475.C
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/g++.old-deja/g++.benjamin/p12475.C,v
retrieving revision 1.7
diff -c -3 -p -r1.7 p12475.C
*** g++.old-deja/g++.benjamin/p12475.C 1 May 2003 02:02:33 -0000 1.7
--- g++.old-deja/g++.benjamin/p12475.C 10 Nov 2004 14:21:42 -0000
***************
*** 1,6 ****
--- 1,12 ----
// { dg-do assemble }
// prms-id: 12475
+ #if defined __STRICT_ANSI__
+ /* Make sure that __GNUC__ is not defined so that <limits.h> will not
+ be tempted to use #include_next. This is a GCC extension and will
+ not work in strict ANSI mode. */
+ #undef __GNUC__
+ #endif
#include <limits.h>
#if LONG_MAX == 2147483647
Index: g++.old-deja/g++.jason/rfg10.C
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/g++.old-deja/g++.jason/rfg10.C,v
retrieving revision 1.4
diff -c -3 -p -r1.4 rfg10.C
*** g++.old-deja/g++.jason/rfg10.C 23 Sep 2004 21:27:19 -0000 1.4
--- g++.old-deja/g++.jason/rfg10.C 10 Nov 2004 14:21:42 -0000
***************
*** 1,6 ****
--- 1,12 ----
// { dg-do assemble }
// Bug: g++ doesn't notice the overflow in the enum values.
+ #if defined __STRICT_ANSI__
+ /* Make sure that __GNUC__ is not defined so that <limits.h> will not
+ be tempted to use #include_next. This is a GCC extension and will
+ not work in strict ANSI mode. */
+ #undef __GNUC__
+ #endif
#include <limits.h>
enum COLOR
Index: gcc.dg/c90-intconst-1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/c90-intconst-1.c,v
retrieving revision 1.1
diff -c -3 -p -r1.1 c90-intconst-1.c
*** gcc.dg/c90-intconst-1.c 20 Nov 2001 12:29:30 -0000 1.1
--- gcc.dg/c90-intconst-1.c 10 Nov 2004 14:21:44 -0000
***************
*** 4,9 ****
--- 4,15 ----
/* { dg-do compile } */
/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */
+ #if defined __STRICT_ANSI__
+ /* Make sure that __GNUC__ is not defined so that <limits.h> will not
+ be tempted to use #include_next. This is a GCC extension and will
+ not work in strict ANSI mode. */
+ #undef __GNUC__
+ #endif
#include <limits.h>
/* Assertion that constant C is of type T. */
Index: gcc.dg/c90-intprom-1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/c90-intprom-1.c,v
retrieving revision 1.1
diff -c -3 -p -r1.1 c90-intprom-1.c
*** gcc.dg/c90-intprom-1.c 10 Apr 2004 18:47:50 -0000 1.1
--- gcc.dg/c90-intprom-1.c 10 Nov 2004 14:21:44 -0000
***************
*** 3,8 ****
--- 3,14 ----
/* { dg-do compile } */
/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */
+ #if defined __STRICT_ANSI__
+ /* Make sure that __GNUC__ is not defined so that <limits.h> will not
+ be tempted to use #include_next. This is a GCC extension and will
+ not work in strict ANSI mode. */
+ #undef __GNUC__
+ #endif
#include <limits.h>
#define CHECK(T1, T2, TC) \
Index: gcc.dg/c99-intconst-1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/c99-intconst-1.c,v
retrieving revision 1.3
diff -c -3 -p -r1.3 c99-intconst-1.c
*** gcc.dg/c99-intconst-1.c 2 Jun 2002 19:37:32 -0000 1.3
--- gcc.dg/c99-intconst-1.c 10 Nov 2004 14:21:44 -0000
***************
*** 4,9 ****
--- 4,15 ----
/* { dg-do compile } */
/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
+ #if defined __STRICT_ANSI__
+ /* Make sure that __GNUC__ is not defined so that <limits.h> will not
+ be tempted to use #include_next. This is a GCC extension and will
+ not work in strict ANSI mode. */
+ #undef __GNUC__
+ #endif
#include <limits.h>
/* Assertion that constant C is of type T. */
Index: gcc.dg/c99-intprom-1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/c99-intprom-1.c,v
retrieving revision 1.1
diff -c -3 -p -r1.1 c99-intprom-1.c
*** gcc.dg/c99-intprom-1.c 10 Apr 2004 18:47:50 -0000 1.1
--- gcc.dg/c99-intprom-1.c 10 Nov 2004 14:21:44 -0000
***************
*** 3,8 ****
--- 3,14 ----
/* { dg-do compile } */
/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
+ #if defined __STRICT_ANSI__
+ /* Make sure that __GNUC__ is not defined so that <limits.h> will not
+ be tempted to use #include_next. This is a GCC extension and will
+ not work in strict ANSI mode. */
+ #undef __GNUC__
+ #endif
#include <limits.h>
#define CHECK(T1, T2, TC) \
Index: gcc.dg/init-string-2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/init-string-2.c,v
retrieving revision 1.1
diff -c -3 -p -r1.1 init-string-2.c
*** gcc.dg/init-string-2.c 25 Jul 2004 09:12:21 -0000 1.1
--- gcc.dg/init-string-2.c 10 Nov 2004 14:21:44 -0000
***************
*** 7,12 ****
--- 7,18 ----
/* { dg-do compile } */
/* { dg-options "-std=c99 -pedantic-errors -fshort-enums -fshort-wchar" } */
+ #if defined __STRICT_ANSI__
+ /* Make sure that __GNUC__ is not defined so that <limits.h> will not
+ be tempted to use #include_next. This is a GCC extension and will
+ not work in strict ANSI mode. */
+ #undef __GNUC__
+ #endif
#include <limits.h>
#include <stddef.h>
Index: gcc.dg/smod-1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/smod-1.c,v
retrieving revision 1.2
diff -c -3 -p -r1.2 smod-1.c
*** gcc.dg/smod-1.c 19 Oct 2004 20:57:30 -0000 1.2
--- gcc.dg/smod-1.c 10 Nov 2004 14:21:44 -0000
***************
*** 5,10 ****
--- 5,16 ----
/* { dg-options "-std=c99" } */
/* { dg-options "-std=c99 -mtune=i486" { target i?86-*-* } } */
+ #if defined __STRICT_ANSI__
+ /* Make sure that __GNUC__ is not defined so that <limits.h> will not
+ be tempted to use #include_next. This is a GCC extension and will
+ not work in strict ANSI mode. */
+ #undef __GNUC__
+ #endif
#include <limits.h>
extern void abort(void);
Index: gcc.dg/cpp/arith-3.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/cpp/arith-3.c,v
retrieving revision 1.3
diff -c -3 -p -r1.3 arith-3.c
*** gcc.dg/cpp/arith-3.c 27 May 2002 20:23:13 -0000 1.3
--- gcc.dg/cpp/arith-3.c 10 Nov 2004 14:21:44 -0000
***************
*** 11,16 ****
--- 11,22 ----
/* { dg-do preprocess } */
/* { dg-options "-std=c99 -fno-show-column" } */
+ #if defined __STRICT_ANSI__
+ /* Make sure that __GNUC__ is not defined so that <limits.h> will not
+ be tempted to use #include_next. This is a GCC extension and will
+ not work in strict ANSI mode. */
+ #undef __GNUC__
+ #endif
#include <limits.h>
#define APPEND2(NUM, SUFF) NUM ## SUFF
Index: gcc.dg/cpp/ucs.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/cpp/ucs.c,v
retrieving revision 1.5
diff -c -3 -p -r1.5 ucs.c
*** gcc.dg/cpp/ucs.c 5 Jul 2003 00:23:59 -0000 1.5
--- gcc.dg/cpp/ucs.c 10 Nov 2004 14:21:44 -0000
***************
*** 8,13 ****
--- 8,19 ----
Neil Booth, 22 May 2001.
Richard Henderson, 3 Apr 2002. */
+ #if defined __STRICT_ANSI__
+ /* Make sure that __GNUC__ is not defined so that <limits.h> will not
+ be tempted to use #include_next. This is a GCC extension and will
+ not work in strict ANSI mode. */
+ #undef __GNUC__
+ #endif
#include <limits.h>
#define unsigned +0