Commit dde9c193 by Dodji Seketeli Committed by Dodji Seketeli

Adjust relevant test cases wrt -ftrack-macro-expansion=[0|2]

Even after all the patches I have already submitted, some test cases
where errors happens on tokens that are defined in macros see their
output change in an incompatible way, when you run them with or
without -ftrack-macro-expansion.

I think this is expected, because the (spelling) locus inside the
definition of the macro pointed to with -ftrack-macro-expansion is
different from the locus of the expansion point of the macro pointed
to without -ftrack-macro-expansion.

In those cases this patch either adjusts the test case and forces it
be run either with -ftrack-macro-expansion, or it just forces it to be
run without -ftrack-macro-expansion.

There are so many libstdc++ tests that were failing because of that
benign issue that I preferred to just run them with
-ftrack-macro-expansion diabled, after inspecting each of them to be
sure there was nothing more serious underneath.

Boostrapped on x86_64-unknown-linux-gnu against trunk with and without
-ftrack-macro-expansion turned on.

gcc/testsuite/

	* objc.dg/foreach-7.m: Force the test case to run without
	-ftrack-macro-expansion.
	* c-c++-common/tm/attrib-1.c: Likewise.
	* c-c++-common/warn-ommitted-condop.c: Likewise.
	* gcc.dg/assign-warn-1.c: Likewise.
	* gcc.dg/assign-warn-2.c: Likewise.
	* gcc.dg/attr-alloc_size.c: Likewise.
	* gcc.dg/builtin-stringop-chk-1.c: Likewise.
	* gcc.dg/builtin-stringop-chk-2.c: Likewise.
	* gcc.dg/builtin-strncat-chk-1.c: Likewise.
	* gcc.dg/c90-const-expr-9.c: Likewise.
	* gcc.dg/c99-const-expr-9.c: Likewise.
	* gcc.dg/cpp/direct2.c: Likewise.  Adjust.
	* gcc.dg/cpp/direct2s.c: Likewise.
	* gcc/testsuite/gcc.dg/cpp/pr28709.c: Likewise.
	* gcc.dg/cpp/pragma-diagnostic-1.c: Likewise.
	* gcc.dg/dfp/composite-type.c: Likewise.
	* gcc.dg/uninit-6-O0.c: Adjust the test case and force it to run
	with -ftrack-macro-expansion
	* g++.dg/cpp0x/constexpr-ex3.C: Likewise.
	* g++.dg/cpp0x/constexpr-overflow.C: Likewise.
	* g++.dg/ext/cleanup-1.C: Likewise.
	* g++.dg/ext/gnu-inline-global-reject.C: Likewise.
	* g++.dg/template/sfinae10.C: Likewise.
	* g++.dg/tm/wrap-2.C: Likewise.
	* g++.dg/warn/Wconversion-real-integer.C: Likewise.
	* g++.dg/warn/Wsign-conversion.C: Likewise.
	* g++.dg/warn/multiple-overflow-warn-1.C: Likewise.
	* g++.old-deja/g++.mike/p10769b.C: Likewise.
	* g++.dg/warn/Wdouble-promotion.C: Adjust the test case and force
	it to run with -ftrack-macro-expansion.
	* libstdc++-v3/scripts/testsuite_flags.in: By default, run the
	test cases without -ftrack-macro-expansion.

From-SVN: r186976
parent 34c88790
2012-04-30 Dodji Seketeli <dodji@redhat.com> 2012-04-30 Dodji Seketeli <dodji@redhat.com>
Adjust relevant test cases wrt -ftrack-macro-expansion=[0|2]
* objc.dg/foreach-7.m: Force the test case to run without
-ftrack-macro-expansion.
* c-c++-common/tm/attrib-1.c: Likewise.
* c-c++-common/warn-ommitted-condop.c: Likewise.
* gcc.dg/assign-warn-1.c: Likewise.
* gcc.dg/assign-warn-2.c: Likewise.
* gcc.dg/attr-alloc_size.c: Likewise.
* gcc.dg/builtin-stringop-chk-1.c: Likewise.
* gcc.dg/builtin-stringop-chk-2.c: Likewise.
* gcc.dg/builtin-strncat-chk-1.c: Likewise.
* gcc.dg/c90-const-expr-9.c: Likewise.
* gcc.dg/c99-const-expr-9.c: Likewise.
* gcc.dg/cpp/direct2.c: Likewise. Adjust.
* gcc.dg/cpp/direct2s.c: Likewise.
* gcc/testsuite/gcc.dg/cpp/pr28709.c: Likewise.
* gcc.dg/cpp/pragma-diagnostic-1.c: Likewise.
* gcc.dg/dfp/composite-type.c: Likewise.
* gcc.dg/uninit-6-O0.c: Adjust the test case and force it to run
with -ftrack-macro-expansion
* g++.dg/cpp0x/constexpr-ex3.C: Likewise.
* g++.dg/cpp0x/constexpr-overflow.C: Likewise.
* g++.dg/ext/cleanup-1.C: Likewise.
* g++.dg/ext/gnu-inline-global-reject.C: Likewise.
* g++.dg/template/sfinae10.C: Likewise.
* g++.dg/tm/wrap-2.C: Likewise.
* g++.dg/warn/Wconversion-real-integer.C: Likewise.
* g++.dg/warn/Wsign-conversion.C: Likewise.
* g++.dg/warn/multiple-overflow-warn-1.C: Likewise.
* g++.old-deja/g++.mike/p10769b.C: Likewise.
* g++.dg/warn/Wdouble-promotion.C: Adjust the test case and force
it to run with -ftrack-macro-expansion.
* libstdc++-v3/scripts/testsuite_flags.in: By default, run the
test cases without -ftrack-macro-expansion.
Fix location for static class members Fix location for static class members
* g++.dg/template/sfinae6_neg.C: Adjust. * g++.dg/template/sfinae6_neg.C: Adjust.
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-fgnu-tm" } */ /* { dg-options "-fgnu-tm -ftrack-macro-expansion=0" } */
#define TC __attribute__((transaction_callable)) #define TC __attribute__((transaction_callable))
#define TU __attribute__((transaction_unsafe)) #define TU __attribute__((transaction_unsafe))
......
/* { dg-options "-Wparentheses" } */ /* { dg-options "-Wparentheses -ftrack-macro-expansion=0" } */
extern void f2 (int); extern void f2 (int);
......
// { dg-options "-std=c++0x" } // { dg-options "-std=c++0x -ftrack-macro-expansion=0" }
#define SA(X) static_assert (X, #X) #define SA(X) static_assert (X, #X)
......
// { dg-options "-std=c++0x -w" } // { dg-options "-std=c++0x -w -ftrack-macro-expansion=0" }
#include <limits.h> #include <limits.h>
extern constexpr int max_s = INT_MAX + 1; // { dg-error "" } extern constexpr int max_s = INT_MAX + 1; // { dg-error "" }
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-Wall" } */ /* { dg-options "-Wall -ftrack-macro-expansion=0" } */
/* Validate expected warnings and errors. */ /* Validate expected warnings and errors. */
#define U __attribute__((unused)) #define U __attribute__((unused))
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
*/ */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options " -ansi -Wno-long-long" } */ /* { dg-options " -ansi -Wno-long-long -ftrack-macro-expansion=0" } */
#include "gnu-inline-common.h" #include "gnu-inline-common.h"
......
// DR 339 // DR 339
// //
// Test of the use of various unary operators with SFINAE // Test of the use of various unary operators with SFINAE
// { dg-options "-fmessage-length=0 -pedantic-errors -Wno-long-long -ftrack-macro-expansion=0 " }
// Boilerplate helpers // Boilerplate helpers
typedef char yes_type; typedef char yes_type;
struct no_type { char data[2]; }; struct no_type { char data[2]; };
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-fgnu-tm" } */ /* { dg-options "-fgnu-tm -ftrack-macro-expansion=0" } */
#define W(X) __attribute__((transaction_wrap(X))) #define W(X) __attribute__((transaction_wrap(X)))
void f1(void); void f1(void);
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
gcc/testsuite/gcc.dg/Wconversion-real-integer.c */ gcc/testsuite/gcc.dg/Wconversion-real-integer.c */
/* { dg-do compile } /* { dg-do compile }
/* { dg-options "-Wconversion" } */ /* { dg-options "-Wconversion -ftrack-macro-expansion=0" } */
/* { dg-require-effective-target int32plus } */ /* { dg-require-effective-target int32plus } */
#include <limits.h> #include <limits.h>
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-Wdouble-promotion" } */ /* { dg-options "-Wdouble-promotion -ftrack-macro-expansion=2" } */
#include <stddef.h> #include <stddef.h>
/* Some targets do not provide <complex.h> so we define I ourselves. */ /* Some targets do not provide <complex.h> so we define I ourselves. */
#define I 1.0iF #define I 1.0iF
#define ID ((_Complex double)I) #define ID ((_Complex double)I) // { dg-warning "implicit" }
float f; float f;
double d; double d;
...@@ -36,7 +36,7 @@ usual_arithmetic_conversions(void) ...@@ -36,7 +36,7 @@ usual_arithmetic_conversions(void)
local_cf = cf + 1.0; /* { dg-warning "implicit" } */ local_cf = cf + 1.0; /* { dg-warning "implicit" } */
local_cf = cf - d; /* { dg-warning "implicit" } */ local_cf = cf - d; /* { dg-warning "implicit" } */
local_cf = cf + 1.0 * ID; /* { dg-warning "implicit" } */ local_cf = cf + 1.0 * ID; /* { dg-message "expanded from here" } */
local_cf = cf - cd; /* { dg-warning "implicit" } */ local_cf = cf - cd; /* { dg-warning "implicit" } */
local_f = i ? f : d; /* { dg-warning "implicit" } */ local_f = i ? f : d; /* { dg-warning "implicit" } */
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
C++ equivalent of gcc/testsuite/gcc.dg/Wsign-conversion.c */ C++ equivalent of gcc/testsuite/gcc.dg/Wsign-conversion.c */
// { dg-do compile } // { dg-do compile }
// { dg-options "-fsigned-char -Wsign-conversion" } // { dg-options "-fsigned-char -Wsign-conversion -ftrack-macro-expansion=0" }
#include <limits.h> #include <limits.h>
void fsc (signed char sc); void fsc (signed char sc);
......
/* PR c/19978 : Test for duplicated warnings (unary operators). */ /* PR c/19978 : Test for duplicated warnings (unary operators). */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-Woverflow" } */ /* { dg-options "-Woverflow -ftrack-macro-expansion=0" } */
#include <limits.h> #include <limits.h>
......
// { dg-do assemble } // { dg-do assemble }
// { dg-options "" } // { dg-options "-ftrack-macro-expansion=0" }
// prms-id: 10769 // prms-id: 10769
#define PMF2PF(PMF) ((void (*)())(PMF)) #define PMF2PF(PMF) ((void (*)())(PMF))
......
/* Test diagnostics for bad implicit type conversions. */ /* Test diagnostics for bad implicit type conversions. */
/* Origin: Joseph Myers <jsm@polyomino.org.uk> */ /* Origin: Joseph Myers <jsm@polyomino.org.uk> */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-pedantic" } */ /* { dg-options "-pedantic -ftrack-macro-expansion=0" } */
#define TESTARG(ID, TL, TR) void ID##F(TL); void ID##F2(TR x) { ID##F(x); } extern int dummy #define TESTARG(ID, TL, TR) void ID##F(TL); void ID##F2(TR x) { ID##F(x); } extern int dummy
#define TESTARP(ID, TL, TR) struct { void (*x)(TL); } ID##Fp; void ID##F2(TR x) { ID##Fp.x(x); } extern int dummy #define TESTARP(ID, TL, TR) struct { void (*x)(TL); } ID##Fp; void ID##F2(TR x) { ID##Fp.x(x); } extern int dummy
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
-pedantic-errors test. */ -pedantic-errors test. */
/* Origin: Joseph Myers <jsm@polyomino.org.uk> */ /* Origin: Joseph Myers <jsm@polyomino.org.uk> */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-pedantic-errors" } */ /* { dg-options "-pedantic-errors -ftrack-macro-expansion=0" } */
#define TESTARG(ID, TL, TR) void ID##F(TL); void ID##F2(TR x) { ID##F(x); } extern int dummy #define TESTARG(ID, TL, TR) void ID##F(TL); void ID##F2(TR x) { ID##F(x); } extern int dummy
#define TESTARP(ID, TL, TR) struct { void (*x)(TL); } ID##Fp; void ID##F2(TR x) { ID##Fp.x(x); } extern int dummy #define TESTARP(ID, TL, TR) struct { void (*x)(TL); } ID##Fp; void ID##F2(TR x) { ID##Fp.x(x); } extern int dummy
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O2 -Wall" } */ /* { dg-options "-O2 -Wall -ftrack-macro-expansion=0" } */
extern void abort (void); extern void abort (void);
......
/* Test whether buffer overflow warnings for __*_chk builtins /* Test whether buffer overflow warnings for __*_chk builtins
are emitted properly. */ are emitted properly. */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O2 -std=gnu99" } */ /* { dg-options "-O2 -std=gnu99 -ftrack-macro-expansion=0" } */
/* { dg-options "-mstructure-size-boundary=8 -O2 -std=gnu99" { target arm*-*-* } } */ /* { dg-options "-mstructure-size-boundary=8 -O2 -std=gnu99" { target arm*-*-* } } */
extern void abort (void); extern void abort (void);
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
incorrectly determined to be 0 while it should be (size_t) -1 incorrectly determined to be 0 while it should be (size_t) -1
(== unknown). */ (== unknown). */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O2" } */ /* { dg-options "-O2 -ftrack-macro-expansion=0" } */
#include "../gcc.c-torture/execute/builtins/chk.h" #include "../gcc.c-torture/execute/builtins/chk.h"
......
/* Test whether buffer overflow warnings for __strncat_chk builtin /* Test whether buffer overflow warnings for __strncat_chk builtin
are emitted properly. */ are emitted properly. */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O2 -std=gnu99" } */ /* { dg-options "-O2 -std=gnu99 -ftrack-macro-expansion=0" } */
extern void abort (void); extern void abort (void);
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
expansion. */ expansion. */
/* Origin: Joseph Myers <joseph@codesourcery.com> */ /* Origin: Joseph Myers <joseph@codesourcery.com> */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ /* { dg-options "-std=iso9899:1990 -pedantic-errors -ftrack-macro-expansion=0" } */
struct s { struct s {
int a; int a;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
expansion. */ expansion. */
/* Origin: Joseph Myers <joseph@codesourcery.com> */ /* Origin: Joseph Myers <joseph@codesourcery.com> */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ /* { dg-options "-std=iso9899:1999 -pedantic-errors -ftrack-macro-expansion=0" } */
struct s { struct s {
int a; int a;
......
...@@ -4,18 +4,20 @@ ...@@ -4,18 +4,20 @@
/* Test of prohibition on directives which result from macro expansion. /* Test of prohibition on directives which result from macro expansion.
See also direct2s.c */ See also direct2s.c */
/* { dg-do compile } */ /*
{ dg-options "-ftrack-macro-expansion=0" }
{ dg-do compile } */
#define HASH # #define HASH #
#define HASHDEFINE #define #define HASHDEFINE #define
#define HASHINCLUDE #include #define HASHINCLUDE #include
HASH include "somerandomfile" /*{ dg-error "stray" "non-include" }*/ HASH include "somerandomfile" /*{ dg-error "stray" "non-include" }*/
/*{ dg-bogus "No such" "don't execute non-include" { target *-*-* } 13 }*/ /*{ dg-bogus "No such" "don't execute non-include" { target *-*-* } 15 }*/
int resync_parser_1; /*{ dg-error "parse|syntax|expected" "" { target *-*-* } 13 }*/ int resync_parser_1; /*{ dg-error "parse|syntax|expected" "" { target *-*-* } 15 }*/
HASHINCLUDE <somerandomfile> /*{ dg-error "stray|expected" "non-include 2" }*/ HASHINCLUDE <somerandomfile> /*{ dg-error "stray|expected" "non-include 2" }*/
/*{ dg-bogus "No such" "don't execute non-include 2" { target *-*-* } 17 }*/ /*{ dg-bogus "No such" "don't execute non-include 2" { target *-*-* } 19 }*/
int resync_parser_2; int resync_parser_2;
void g1 () void g1 ()
...@@ -43,4 +45,4 @@ void f () ...@@ -43,4 +45,4 @@ void f ()
#define starslash *##/ #define starslash *##/
slashstar starslash /* { dg-error "parse error|syntax error|expected" "not a comment" } */ slashstar starslash /* { dg-error "parse error|syntax error|expected" "not a comment" } */
/* { dg-error "does not give" "paste warning(s)" { target *-*-* } 45 } */ /* { dg-error "does not give" "paste warning(s)" { target *-*-* } 47 } */
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
should be identical. */ should be identical. */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-save-temps -ansi -pedantic-errors" } */ /* { dg-options "-save-temps -ansi -pedantic-errors -ftrack-macro-expansion=0" } */
#define HASH # #define HASH #
#define HASHDEFINE #define #define HASHDEFINE #define
......
/* Copyright (C) 2006 Free Software Foundation, Inc. */ /* Copyright (C) 2006 Free Software Foundation, Inc. */
/* PR preprocessor/28709 */ /* PR preprocessor/28709 */
/* { dg-do compile } */ /* { dg-options "-ftrack-macro-expansion=0" }
{ dg-do compile } */
#define foo - ## >> #define foo - ## >>
foo; foo;
/* { dg-error "expected identifier.*'-'" "" { target *-*-* } 6 } */ /* { dg-error "expected identifier.*'-'" "" { target *-*-* } 8 } */
/* { dg-error pasting "" { target *-*-* } 6 } */ /* { dg-error pasting "" { target *-*-* } 8 } */
/* /*
{ dg-options "-Wuninitialized" } { dg-options "-Wuninitialized -ftrack-macro-expansion=0" }
{ dg-do compile } { dg-do compile }
*/ */
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O -Wall" } */ /* { dg-options "-O -Wall -ftrack-macro-expansion=0" } */
/* C99 6.2.7: Compatible type and composite type. */ /* C99 6.2.7: Compatible type and composite type. */
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
This one inspired by java/class.c:build_utf8_ref. */ This one inspired by java/class.c:build_utf8_ref. */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-Wuninitialized" } */ /* { dg-options "-Wuninitialized -ftrack-macro-expansion=2" } */
#include <stddef.h> #include <stddef.h>
...@@ -24,7 +24,7 @@ do { \ ...@@ -24,7 +24,7 @@ do { \
tmp->car = 0; tmp->cdr = 0; tmp->type = TYPE; \ tmp->car = 0; tmp->cdr = 0; tmp->type = TYPE; \
tmp->data = VALUE; \ tmp->data = VALUE; \
if (TREE->car) \ if (TREE->car) \
LAST->cdr = tmp; \ LAST->cdr = tmp; /* { dg-bogus "field" "uninitialized variable warning" { xfail *-*-* } } */ \
else \ else \
TREE->car = tmp; \ TREE->car = tmp; \
LAST = tmp; \ LAST = tmp; \
...@@ -39,7 +39,7 @@ make_something(int a, int b, int c) ...@@ -39,7 +39,7 @@ make_something(int a, int b, int c)
rv = malloc (sizeof (struct tree)); rv = malloc (sizeof (struct tree));
rv->car = 0; rv->car = 0;
APPEND(rv, field, INTEGER_T, a); /* { dg-bogus "field" "uninitialized variable warning" { xfail *-*-* } } */ APPEND(rv, field, INTEGER_T, a);
APPEND(rv, field, PTR_T, b); APPEND(rv, field, PTR_T, b);
APPEND(rv, field, INTEGER_T, c); APPEND(rv, field, INTEGER_T, c);
......
/* Test basic Objective-C foreach syntax. This tests warnings and errors. */ /* Test basic Objective-C foreach syntax. This tests warnings and errors. */
/* { dg-do compile } */ /*
{ dg-options "-ftrack-macro-expansion=0" }
{ dg-do compile }
*/
#import "../objc-obj-c++-shared/TestsuiteObject.h" #import "../objc-obj-c++-shared/TestsuiteObject.h"
#import <objc/objc.h> #import <objc/objc.h>
...@@ -37,10 +40,10 @@ int main (void) ...@@ -37,10 +40,10 @@ int main (void)
id object = nil; id object = nil;
for (typedef int my_typedef in array) /* { dg-error "declaration of non-variable" } */ for (typedef int my_typedef in array) /* { dg-error "declaration of non-variable" } */
; /* { dg-error "iterating variable in fast enumeration is not an object" "" { target *-*-* } 39 } */ ; /* { dg-error "iterating variable in fast enumeration is not an object" "" { target *-*-* } 42 } */
for (function () in nil) /* { dg-error "invalid iterating variable in fast enumeration" } */ for (function () in nil) /* { dg-error "invalid iterating variable in fast enumeration" } */
; /* { dg-error "iterating variable in fast enumeration is not an object" "" { target *-*-* } 42 } */ ; /* { dg-error "iterating variable in fast enumeration is not an object" "" { target *-*-* } 45 } */
for (object_function () in nil) /* { dg-error "invalid iterating variable in fast enumeration" } */ for (object_function () in nil) /* { dg-error "invalid iterating variable in fast enumeration" } */
; ;
......
...@@ -54,7 +54,7 @@ case ${query} in ...@@ -54,7 +54,7 @@ case ${query} in
echo ${CC} echo ${CC}
;; ;;
--cxxflags) --cxxflags)
CXXFLAGS_default="-D_GLIBCXX_ASSERT -fmessage-length=0" CXXFLAGS_default="-D_GLIBCXX_ASSERT -fmessage-length=0 -ftrack-macro-expansion=0"
CXXFLAGS_config="@SECTION_FLAGS@ @CXXFLAGS@ @EXTRA_CXX_FLAGS@" CXXFLAGS_config="@SECTION_FLAGS@ @CXXFLAGS@ @EXTRA_CXX_FLAGS@"
echo ${CXXFLAGS_default} ${CXXFLAGS_config} echo ${CXXFLAGS_default} ${CXXFLAGS_config}
;; ;;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment