diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2013-04-11 09:13:11 +0000 |
---|---|---|
committer | <> | 2014-04-23 12:05:38 +0000 |
commit | 6af3fdec2262dd94954acc5e426ef71cbd4521d3 (patch) | |
tree | 9be02de9a80f7935892a2d03741adee44723e65d /gcc/testsuite/gcc.dg/cpp | |
parent | 19be2b4342ac32e9edc78ce6fed8f61b63ae98d1 (diff) | |
download | gcc-tarball-6af3fdec2262dd94954acc5e426ef71cbd4521d3.tar.gz |
Imported from /home/lorry/working-area/delta_gcc-tarball/gcc-4.7.3.tar.bz2.gcc-4.7.3
Diffstat (limited to 'gcc/testsuite/gcc.dg/cpp')
19 files changed, 199 insertions, 39 deletions
diff --git a/gcc/testsuite/gcc.dg/cpp/assert4.c b/gcc/testsuite/gcc.dg/cpp/assert4.c index 0bd88ce068..514195313b 100644 --- a/gcc/testsuite/gcc.dg/cpp/assert4.c +++ b/gcc/testsuite/gcc.dg/cpp/assert4.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2003, 2006, 2008 Free Software Foundation, Inc. +/* Copyright (C) 2003, 2006, 2008, 2009, 2011 Free Software Foundation, Inc. Test builtin preprocessor assertions. By Kaveh Ghazi <ghazi@caip.rutgers.edu>. */ @@ -7,7 +7,7 @@ /* Check for #system assertions. */ -#if defined __gnu_linux__ +#if defined __linux__ # if !#system(linux) || !#system(unix) || !#system(posix) # error # endif @@ -128,25 +128,9 @@ # error #endif -#if defined __netware__ -# if !#system(netware) -# error -# endif -#elif #system(netware) -# error -#endif - /* Check for #cpu and #machine assertions. */ -#if defined __arc__ -# if !#cpu(arc) || !#machine(arc) -# error -# endif -#elif #cpu(arc) || #machine(arc) -# error -#endif - #if defined __alpha__ # if !#cpu(alpha) || !#machine(alpha) \ || (defined __alpha_cix__ && !#cpu(cix)) \ diff --git a/gcc/testsuite/gcc.dg/cpp/include2a.c b/gcc/testsuite/gcc.dg/cpp/include2a.c index 6a11c92cff..9370d0944e 100644 --- a/gcc/testsuite/gcc.dg/cpp/include2a.c +++ b/gcc/testsuite/gcc.dg/cpp/include2a.c @@ -11,6 +11,6 @@ /* These error is No such file or directory, just once. However, this message is locale-dependent, so don't test for it. */ -/* { dg-error "silly" "" { target *-*-* } 0 } */ -/* { dg-error "missing" "" { target *-*-* } 0 } */ -/* { dg-message "terminated" "" { target *-*-* } 0 } */ +/* { dg-error "silly" "silly" { target *-*-* } 0 } */ +/* { dg-error "missing" "missing" { target *-*-* } 0 } */ +/* { dg-message "terminated" "terminated" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.dg/cpp/macro-exp-tracking-1.c b/gcc/testsuite/gcc.dg/cpp/macro-exp-tracking-1.c new file mode 100644 index 0000000000..d975c8cee9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/macro-exp-tracking-1.c @@ -0,0 +1,21 @@ +/* + { dg-options "-ftrack-macro-expansion=1" } + { dg-do compile } +*/ + +#define OPERATE(OPRD1, OPRT, OPRD2) \ +do \ +{ \ + OPRD1 OPRT OPRD2; /* { dg-message "expansion" }*/ \ +} while (0) + +#define SHIFTL(A,B) \ + OPERATE (A,<<,B) /* { dg-message "expanded|expansion" } */ + +void +foo () +{ + SHIFTL (0.1,0.2); /* { dg-message "expanded" } */ +} + +/* { dg-error "invalid operands" "" { target *-*-* } 13 } */ diff --git a/gcc/testsuite/gcc.dg/cpp/macro-exp-tracking-2.c b/gcc/testsuite/gcc.dg/cpp/macro-exp-tracking-2.c new file mode 100644 index 0000000000..684af4c750 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/macro-exp-tracking-2.c @@ -0,0 +1,21 @@ +/* + { dg-options "-ftrack-macro-expansion=1" } + { dg-do compile } +*/ + +#define OPERATE(OPRD1, OPRT, OPRD2) \ + OPRD1 OPRT OPRD2; /* { dg-message "expansion" } */ + +#define SHIFTL(A,B) \ + OPERATE (A,<<,B) /* { dg-message "expanded|expansion" } */ + +#define MULT(A) \ + SHIFTL (A,1) /* { dg-message "expanded|expansion" } */ + +void +foo () +{ + MULT (1.0); /* { dg-message "expanded" } */ +} + +/* { dg-error "invalid operands to binary <<" "" { target *-*-* } { 10 } } */ diff --git a/gcc/testsuite/gcc.dg/cpp/macro-exp-tracking-3.c b/gcc/testsuite/gcc.dg/cpp/macro-exp-tracking-3.c new file mode 100644 index 0000000000..119053ef9f --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/macro-exp-tracking-3.c @@ -0,0 +1,14 @@ +/* + { dg-options "-fshow-column -ftrack-macro-expansion=1" } + { dg-do compile } + */ + +#define SQUARE(A) A * A /* { dg-message "expansion" } */ + +void +foo() +{ + SQUARE (1 << 0.1); /* { dg-message "expanded" } */ +} + +/* { dg-error "16:invalid operands to binary <<" "" {target *-*-* } { 11 } } */ diff --git a/gcc/testsuite/gcc.dg/cpp/macro-exp-tracking-4.c b/gcc/testsuite/gcc.dg/cpp/macro-exp-tracking-4.c new file mode 100644 index 0000000000..1f9fe6ad26 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/macro-exp-tracking-4.c @@ -0,0 +1,14 @@ +/* + { dg-options "-fshow-column -ftrack-macro-expansion=2" } + { dg-do compile } + */ + +#define SQUARE(A) A * A /* { dg-message "expansion" } */ + +void +foo() +{ + SQUARE (1 << 0.1); /* { dg-message "expanded" } */ +} + +/* { dg-error "13:invalid operands to binary <<" "" { target *-*-* } { 11 } } */ diff --git a/gcc/testsuite/gcc.dg/cpp/macspace2.c b/gcc/testsuite/gcc.dg/cpp/macspace2.c index 1494fed18c..6e6be96b1f 100644 --- a/gcc/testsuite/gcc.dg/cpp/macspace2.c +++ b/gcc/testsuite/gcc.dg/cpp/macspace2.c @@ -59,5 +59,5 @@ #define ag"abc" /* { dg-error "requires whitespace" } */ int dummy; -/* { dg-error "missing terminating" "" { target *-*-* } 6 } */ -/* { dg-error "missing terminating" "" { target *-*-* } 10 } */ +/* { dg-error "missing terminating" "missing-terminating" { target *-*-* } 6 } */ +/* { dg-error "missing terminating" "missing-terminating" { target *-*-* } 10 } */ diff --git a/gcc/testsuite/gcc.dg/cpp/missing-header-1.c b/gcc/testsuite/gcc.dg/cpp/missing-header-1.c index dbcc2b3616..a597a46961 100644 --- a/gcc/testsuite/gcc.dg/cpp/missing-header-1.c +++ b/gcc/testsuite/gcc.dg/cpp/missing-header-1.c @@ -3,8 +3,8 @@ /* { dg-options "" } */ #include "nonexistent.h" -/* { dg-message "nonexistent.h" "" { target *-*-* } 0 } */ -/* { dg-message "terminated" "" { target *-*-* } 0 } */ +/* { dg-message "nonexistent.h" "nonexistent.h" { target *-*-* } 0 } */ +/* { dg-message "terminated" "terminated" { target *-*-* } 0 } */ /* This declaration should not receive any diagnostic. */ foo bar; diff --git a/gcc/testsuite/gcc.dg/cpp/missing-header-MD.c b/gcc/testsuite/gcc.dg/cpp/missing-header-MD.c index 7ed2e60851..793fb179b8 100644 --- a/gcc/testsuite/gcc.dg/cpp/missing-header-MD.c +++ b/gcc/testsuite/gcc.dg/cpp/missing-header-MD.c @@ -3,8 +3,8 @@ /* { dg-options "-MD" } */ #include "nonexistent.h" -/* { dg-message "nonexistent.h" "" { target *-*-* } 0 } */ -/* { dg-message "terminated" "" { target *-*-* } 0 } */ +/* { dg-message "nonexistent.h" "nonexistent.h" { target *-*-* } 0 } */ +/* { dg-message "terminated" "terminated" { target *-*-* } 0 } */ /* This declaration should not receive any diagnostic. */ foo bar; diff --git a/gcc/testsuite/gcc.dg/cpp/missing-header-MMD.c b/gcc/testsuite/gcc.dg/cpp/missing-header-MMD.c index 2c1da30ea3..bba85ede97 100644 --- a/gcc/testsuite/gcc.dg/cpp/missing-header-MMD.c +++ b/gcc/testsuite/gcc.dg/cpp/missing-header-MMD.c @@ -3,8 +3,8 @@ /* { dg-options "-MMD" } */ #include "nonexistent.h" -/* { dg-message "nonexistent.h" "" { target *-*-* } 0 } */ -/* { dg-message "terminated" "" { target *-*-* } 0 } */ +/* { dg-message "nonexistent.h" "nonexistent.h" { target *-*-* } 0 } */ +/* { dg-message "terminated" "terminated" { target *-*-* } 0 } */ /* This declaration should not receive any diagnostic. */ foo bar; diff --git a/gcc/testsuite/gcc.dg/cpp/missing-sysheader-MD.c b/gcc/testsuite/gcc.dg/cpp/missing-sysheader-MD.c index e1324af25c..2983f2d585 100644 --- a/gcc/testsuite/gcc.dg/cpp/missing-sysheader-MD.c +++ b/gcc/testsuite/gcc.dg/cpp/missing-sysheader-MD.c @@ -3,8 +3,8 @@ /* { dg-options "-MD" } */ #include <nonexistent.h> -/* { dg-message "nonexistent.h" "" { target *-*-* } 0 } */ -/* { dg-message "terminated" "" { target *-*-* } 0 } */ +/* { dg-message "nonexistent.h" "nonexistent.h" { target *-*-* } 0 } */ +/* { dg-message "terminated" "terminated" { target *-*-* } 0 } */ /* This declaration should not receive any diagnostic. */ foo bar; diff --git a/gcc/testsuite/gcc.dg/cpp/missing-sysheader-MMD.c b/gcc/testsuite/gcc.dg/cpp/missing-sysheader-MMD.c index fb629ae1c3..351228661d 100644 --- a/gcc/testsuite/gcc.dg/cpp/missing-sysheader-MMD.c +++ b/gcc/testsuite/gcc.dg/cpp/missing-sysheader-MMD.c @@ -3,8 +3,8 @@ /* { dg-options "-MMD" } */ #include <nonexistent.h> -/* { dg-message "nonexistent.h" "" { target *-*-* } 0 } */ -/* { dg-message "terminated" "" { target *-*-* } 0 } */ +/* { dg-message "nonexistent.h" "nonexistent.h" { target *-*-* } 0 } */ +/* { dg-message "terminated" "terminated" { target *-*-* } 0 } */ /* This declaration should not receive any diagnostic. */ foo bar; diff --git a/gcc/testsuite/gcc.dg/cpp/pr28709.c b/gcc/testsuite/gcc.dg/cpp/pr28709.c index 11cccbe8b5..0d97cbde9d 100644 --- a/gcc/testsuite/gcc.dg/cpp/pr28709.c +++ b/gcc/testsuite/gcc.dg/cpp/pr28709.c @@ -4,5 +4,5 @@ /* { dg-do compile } */ #define foo - ## >> foo; -/* { dg-error "expected identifier.*'-'" "" { target *-*-* } 6 } */ -/* { dg-error pasting "" { target *-*-* } 6 } */ +/* { dg-error "expected identifier.*'-'" "expected" { target *-*-* } 6 } */ +/* { dg-error pasting "pasting" { target *-*-* } 6 } */ diff --git a/gcc/testsuite/gcc.dg/cpp/pr30786.c b/gcc/testsuite/gcc.dg/cpp/pr30786.c index f39f83cc88..2c3610847f 100644 --- a/gcc/testsuite/gcc.dg/cpp/pr30786.c +++ b/gcc/testsuite/gcc.dg/cpp/pr30786.c @@ -1,8 +1,8 @@ /* PR preprocessor/30786 - _Pragma at end of file should not ICE */ /* { dg-do compile } */ -/* { dg-error "parenthesized" "" { target *-*-* } 9 } */ -/* { dg-error "expected" "" { target *-*-* } 9 } */ +/* { dg-error "parenthesized" "parenthesized" { target *-*-* } 9 } */ +/* { dg-error "expected" "expected" { target *-*-* } 9 } */ int x; diff --git a/gcc/testsuite/gcc.dg/cpp/pragma-3.c b/gcc/testsuite/gcc.dg/cpp/pragma-3.c new file mode 100644 index 0000000000..53daee7664 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/pragma-3.c @@ -0,0 +1,40 @@ +/* + { dg-options "-fopenmp" } + { dg-do preprocess } + { dg-require-effective-target fopenmp } + */ + +void foo (void) +{ + int i1, j1, k1; +#define p parallel +#define P(x) private (x##1) +#define S(x) shared (x##1) +#define F(x) firstprivate (x##1) +#pragma omp \ + p \ + P(i) \ + S(j) \ + F(k) + ; +} + +/* + The bug here was that we had a line like: + # 33554432 "../../gcc/testsuite/gcc.dg/cpp/pragma-3.c" + + Before line: + + #pragma omp parallel private (i1) shared (j1) firstprivate (k1) + + Note the very big integer there. Normally we should just have + this: + + # 13 "../../gcc/testsuite/gcc.dg/cpp/pragma-3.c" + #pragma omp parallel private (i1) shared (j1) firstprivate (k1) + + So let's check that we have no line with a number of 3 or more + digit after #: + + { dg-final { scan-file-not pragma-3.i "# \[0-9\]{3} \[^\n\r\]*pragma-3.c" } } +*/ diff --git a/gcc/testsuite/gcc.dg/cpp/pragma-diagnostic-1.c b/gcc/testsuite/gcc.dg/cpp/pragma-diagnostic-1.c new file mode 100644 index 0000000000..3a2f9da1fc --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/pragma-diagnostic-1.c @@ -0,0 +1,32 @@ +/* + { dg-options "-Wuninitialized" } + { dg-do compile } +*/ + +void f (unsigned); + +#define CODE_WITH_WARNING \ + int a; \ + f (a) + +#pragma GCC diagnostic ignored "-Wuninitialized" + +void +g (void) +{ + CODE_WITH_WARNING; +} + +#pragma GCC diagnostic push + +#pragma GCC diagnostic error "-Wuninitialized" + +void +h (void) +{ + CODE_WITH_WARNING; /* { dg-error "uninitialized" } */ +} + +/* + { dg-message "some warnings being treated as errors" "" {target *-*-*} 0 } +*/ diff --git a/gcc/testsuite/gcc.dg/cpp/pragma-diagnostic-2.c b/gcc/testsuite/gcc.dg/cpp/pragma-diagnostic-2.c new file mode 100644 index 0000000000..7ab95b0c63 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/pragma-diagnostic-2.c @@ -0,0 +1,34 @@ +/* + { dg-options "-Wuninitialized -ftrack-macro-expansion=2" } + { dg-do compile } +*/ + +void f (unsigned); + +#define CODE_WITH_WARNING \ + int a; /* { dg-message "expansion|declared here" } */ \ + f (a) /* { dg-message "expansion" } */ + +#pragma GCC diagnostic ignored "-Wuninitialized" + +void +g (void) +{ + CODE_WITH_WARNING; +} + +#pragma GCC diagnostic push + +#pragma GCC diagnostic error "-Wuninitialized" + +void +h (void) +{ + CODE_WITH_WARNING; /* { dg-message "expanded" } */ +} + +/* + { dg-message "some warnings being treated as errors" "" {target *-*-*} 0 } +*/ + +/* { dg-error "uninitialized" "" { target *-*-* } { 10 } } */ diff --git a/gcc/testsuite/gcc.dg/cpp/warn-multichar-2.c b/gcc/testsuite/gcc.dg/cpp/warn-multichar-2.c index f9fd4f6dfa..5b5a0cc377 100644 --- a/gcc/testsuite/gcc.dg/cpp/warn-multichar-2.c +++ b/gcc/testsuite/gcc.dg/cpp/warn-multichar-2.c @@ -1,5 +1,5 @@ // { dg-do preprocess } // { dg-options "-std=gnu99 -fdiagnostics-show-option -Werror=multichar" } /* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ -#if 'abc' // { dg-error "multi-character character constant .-Werror=multichar." } +#if 'ab' // { dg-error "multi-character character constant .-Werror=multichar." } #endif diff --git a/gcc/testsuite/gcc.dg/cpp/warn-multichar.c b/gcc/testsuite/gcc.dg/cpp/warn-multichar.c index f5b02dad47..9188a15868 100644 --- a/gcc/testsuite/gcc.dg/cpp/warn-multichar.c +++ b/gcc/testsuite/gcc.dg/cpp/warn-multichar.c @@ -1,5 +1,5 @@ // { dg-do preprocess } // { dg-options "-std=gnu99 -fdiagnostics-show-option -Wmultichar" } -#if 'abc' // { dg-warning "multi-character character constant .-Wmultichar." } +#if 'ab' // { dg-warning "multi-character character constant .-Wmultichar." } #endif |