diff options
Diffstat (limited to 'gcc-4.9/gcc/testsuite/c-c++-common/cpp')
19 files changed, 174 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cpp/diagnostic-pragma-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/diagnostic-pragma-1.c new file mode 100644 index 000000000..9867c94a8 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/diagnostic-pragma-1.c @@ -0,0 +1,11 @@ +// { dg-do compile } + +#pragma GCC warning "warn-a" // { dg-warning warn-a } +#pragma GCC error "err-b" // { dg-error err-b } + +#define CONST1 _Pragma("GCC warning \"warn-c\"") 1 +#define CONST2 _Pragma("GCC error \"err-d\"") 2 + +char a[CONST1]; // { dg-warning warn-c } +char b[CONST2]; // { dg-error err-d } + diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cpp/normalize-3.c b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/normalize-3.c new file mode 100644 index 000000000..ae0184cfb --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/normalize-3.c @@ -0,0 +1,35 @@ +/* { dg-do preprocess } */ +/* { dg-options "-std=c99 -fextended-identifiers -Wnormalized=id" { target c } } */ +/* { dg-options "-fextended-identifiers -Wnormalized=id" { target c++ } } */ + +\u00AA +\u00B7 +\u0F43 /* { dg-warning "not in NFC" } */ +a\u05B8\u05B9\u05B9\u05BBb + a\u05BB\u05B9\u05B8\u05B9b /* { dg-warning "not in NFC" } */ +\u09CB +\u09C7\u09BE /* { dg-warning "not in NFC" } */ +\u0B4B +\u0B47\u0B3E /* { dg-warning "not in NFC" } */ +\u0BCA +\u0BC6\u0BBE /* { dg-warning "not in NFC" } */ +\u0BCB +\u0BC7\u0BBE /* { dg-warning "not in NFC" } */ +\u0CCA +\u0CC6\u0CC2 /* { dg-warning "not in NFC" } */ +\u0D4A +\u0D46\u0D3E /* { dg-warning "not in NFC" } */ +\u0D4B +\u0D47\u0D3E /* { dg-warning "not in NFC" } */ + +K +\u212A + +\u03AC +\u1F71 /* { dg-warning "not in NFC" } */ + +\uAC00 +\u1100\u1161 +\uAC01 +\u1100\u1161\u11A8 +\uAC00\u11A8 diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cpp/openmp-define-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/openmp-define-1.c new file mode 100644 index 000000000..c5379223c --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/openmp-define-1.c @@ -0,0 +1,6 @@ +/* { dg-do preprocess } */ +/* { dg-require-effective-target fopenmp } */ + +#ifdef _OPENMP +# error _OPENMP defined +#endif diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cpp/openmp-define-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/openmp-define-2.c new file mode 100644 index 000000000..8823e291b --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/openmp-define-2.c @@ -0,0 +1,7 @@ +/* { dg-options "-fno-openmp" } */ +/* { dg-do preprocess } */ +/* { dg-require-effective-target fopenmp } */ + +#ifdef _OPENMP +# error _OPENMP defined +#endif diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cpp/openmp-define-3.c b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/openmp-define-3.c new file mode 100644 index 000000000..6986c5507 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/openmp-define-3.c @@ -0,0 +1,11 @@ +/* { dg-options "-fopenmp" } */ +/* { dg-do preprocess } */ +/* { dg-require-effective-target fopenmp } */ + +#ifndef _OPENMP +# error _OPENMP not defined +#endif + +#if _OPENMP != 201307 +# error _OPENMP defined to wrong value +#endif diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cpp/pr45457.c b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/pr45457.c new file mode 100644 index 000000000..14879cd79 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/pr45457.c @@ -0,0 +1,18 @@ +/* PR preprocessor/45457 */ +/* { dg-do compile } */ + +const char *a = +#ifdef __DBL_DENORM_MIN__ +"a" +#endif +#if defined(__DBL_EPSILON__) +"b" +#endif +#ifndef __DBL_MAX__ +"c" +#endif +#if !defined(__DBL_MIN__) +"d" +#endif +; +double b = __DBL_DENORM_MIN__ + __DBL_EPSILON__ + __DBL_MAX__ + __DBL_MIN__; diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cpp/pr58844-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/pr58844-1.c new file mode 100644 index 000000000..3abf8a768 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/pr58844-1.c @@ -0,0 +1,8 @@ +/* PR preprocessor/58844 */ +/* { dg-do compile } */ +/* { dg-options "-ftrack-macro-expansion=0" } */ + +#define A x######x +int A = 1; +#define A x######x /* { dg-message "previous definition" } */ +#define A x##x /* { dg-warning "redefined" } */ diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cpp/pr58844-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/pr58844-2.c new file mode 100644 index 000000000..1e219152f --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/pr58844-2.c @@ -0,0 +1,8 @@ +/* PR preprocessor/58844 */ +/* { dg-do compile } */ +/* { dg-options "-ftrack-macro-expansion=2" } */ + +#define A x######x +int A = 1; +#define A x######x /* { dg-message "previous definition" } */ +#define A x##x /* { dg-warning "redefined" } */ diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cpp/pr60400-1.h b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/pr60400-1.h new file mode 100644 index 000000000..3e32175fe --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/pr60400-1.h @@ -0,0 +1,3 @@ +??=ifndef PR60400_1_H +??=define PR60400_1_H +??=endif diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cpp/pr60400-2.h b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/pr60400-2.h new file mode 100644 index 000000000..d9a590636 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/pr60400-2.h @@ -0,0 +1,4 @@ +??=ifndef PR60400_2_H +??=define PR60400_2_H +??=include "pr60400-1.h" +??=endif diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cpp/pr60400.c b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/pr60400.c new file mode 100644 index 000000000..fc3e0d9f4 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/pr60400.c @@ -0,0 +1,13 @@ +/* PR preprocessor/60400 */ +/* { dg-do compile } */ +/* { dg-options "-trigraphs -Wtrigraphs" } */ + +??=include "pr60400-1.h" +??=include "pr60400-2.h" + +/* { dg-warning "trigraph" "" { target *-*-* } 1 } */ +/* { dg-warning "trigraph" "" { target *-*-* } 2 } */ +/* { dg-warning "trigraph" "" { target *-*-* } 3 } */ +/* { dg-warning "trigraph" "" { target *-*-* } 4 } */ +/* { dg-warning "trigraph" "" { target *-*-* } 5 } */ +/* { dg-warning "trigraph" "" { target *-*-* } 6 } */ diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cpp/ucnid-2011-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/ucnid-2011-1.c new file mode 100644 index 000000000..e3c6d2608 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/ucnid-2011-1.c @@ -0,0 +1,15 @@ +/* { dg-do preprocess } */ +/* { dg-options "-std=c11 -pedantic -fextended-identifiers" { target c } } */ +/* { dg-options "-std=c++11 -pedantic -fextended-identifiers" { target c++ } } */ + +\u00A8 + +B\u0300 + +\u0300 /* { dg-error "not valid at the start of an identifier" } */ + +A\u0300 /* { dg-warning "not in NFC" } */ + +\U00010000 +\U0001FFFD +\U000E1234 diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-directive-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-directive-1.c new file mode 100644 index 000000000..e23d240c2 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-directive-1.c @@ -0,0 +1,4 @@ +// { dg-do preprocess } +// { dg-options "-std=gnu99 -fdiagnostics-show-option" { target c } } +// { dg-options "-fdiagnostics-show-option" { target c++ } } +#warning "Printed" // { dg-warning "\"Printed\" .-Wcpp." } diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-directive-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-directive-2.c new file mode 100644 index 000000000..65edd7bb9 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-directive-2.c @@ -0,0 +1,5 @@ +// { dg-do preprocess } +// { dg-options "-std=gnu99 -fdiagnostics-show-option -Werror=cpp" { target c } } +// { dg-options "-fdiagnostics-show-option -Werror=cpp" { target c++ } } +/* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ +#warning "Printed" // { dg-error "\"Printed\" .-Werror=cpp." } diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-directive-3.c b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-directive-3.c new file mode 100644 index 000000000..0c50a318d --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-directive-3.c @@ -0,0 +1,4 @@ +// { dg-do preprocess } +// { dg-options "-std=gnu99 -fdiagnostics-show-option -Werror -Wno-error=cpp" { target c } } +// { dg-options "-fdiagnostics-show-option -Werror -Wno-error=cpp" { target c++ } } +#warning "Printed" // { dg-warning "\"Printed\" .-Wcpp." } diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-directive-4.c b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-directive-4.c new file mode 100644 index 000000000..23069f8ad --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-directive-4.c @@ -0,0 +1,4 @@ +// { dg-do preprocess } +// { dg-options "-std=gnu99 -fdiagnostics-show-option -Wno-cpp" { target c } } +// { dg-options "-fdiagnostics-show-option -Wno-cpp" { target c++ } } +#warning "Not printed" // { dg-bogus "." } diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-zero-in-literals-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-zero-in-literals-1.c Binary files differnew file mode 100644 index 000000000..ff2ed962a --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-zero-in-literals-1.c diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-zero-location-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-zero-location-2.c new file mode 100644 index 000000000..e919bca69 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-zero-location-2.c @@ -0,0 +1,10 @@ +/* + { dg-options "-D _GNU_SOURCE -fdiagnostics-show-caret" } + { dg-do compile } + */ + +#line 4636 "configure" +#include <xxxxxxxxxxxx.h> +int main() { return 0; } + +/* { dg-message "" "#include" {target *-*-* } 0 } diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-zero-location.c b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-zero-location.c new file mode 100644 index 000000000..ca2e102bb --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-zero-location.c @@ -0,0 +1,8 @@ +/* + { dg-options "-D _GNU_SOURCE -fdiagnostics-show-caret" } + { dg-do compile } + */ + +#define _GNU_SOURCE /* { dg-warning "redefined" } */ + +/* { dg-message "" "#define _GNU_SOURCE" {target *-*-* } 0 } |