diff options
author | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-11-04 16:16:37 +0000 |
---|---|---|
committer | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-11-04 16:16:37 +0000 |
commit | 21d470572b22f45dc6c4ca65c2a007354ffe2b95 (patch) | |
tree | c83a0c83634b069528a2df396482a04da2a4f3bd | |
parent | f163dcb675e2760e337c0af043bfdd6366055958 (diff) | |
download | gcc-21d470572b22f45dc6c4ca65c2a007354ffe2b95.tar.gz |
* gcc.dg/asm-qual-1.c, gcc.dg/declspec-15.c, gcc.dg/declspec-16.c,
gcc.dg/declspec-17.c, gcc.dg/empty-source-1.c,
gcc.dg/empty-source-2.c, gcc.dg/empty-source-3.c,
gcc.dg/extra-semi-1.c, gcc.dg/extra-semi-2.c,
gcc.dg/extra-semi-3.c, gcc.dg/gnu-cond-expr-1.c,
gcc.dg/gnu-cond-expr-2.c, gcc.dg/gnu-cond-expr-3.c,
gcc.dg/init-empty-1.c, gcc.dg/init-empty-2.c,
gcc.dg/init-empty-3.c, gcc.dg/noncompile/old-style-parm-1.c,
gcc.dg/noncompile/old-style-parm-2.c, gcc.dg/stmt-expr-1.c,
gcc.dg/stmt-expr-2.c, gcc.dg/stmt-expr-3.c: New tests.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@90066 138bc75d-0d04-0410-961f-82ee72b054a4
22 files changed, 221 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fde57d73ec5..a499d04901a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,18 @@ 2004-11-04 Joseph S. Myers <joseph@codesourcery.com> + * gcc.dg/asm-qual-1.c, gcc.dg/declspec-15.c, gcc.dg/declspec-16.c, + gcc.dg/declspec-17.c, gcc.dg/empty-source-1.c, + gcc.dg/empty-source-2.c, gcc.dg/empty-source-3.c, + gcc.dg/extra-semi-1.c, gcc.dg/extra-semi-2.c, + gcc.dg/extra-semi-3.c, gcc.dg/gnu-cond-expr-1.c, + gcc.dg/gnu-cond-expr-2.c, gcc.dg/gnu-cond-expr-3.c, + gcc.dg/init-empty-1.c, gcc.dg/init-empty-2.c, + gcc.dg/init-empty-3.c, gcc.dg/noncompile/old-style-parm-1.c, + gcc.dg/noncompile/old-style-parm-2.c, gcc.dg/stmt-expr-1.c, + gcc.dg/stmt-expr-2.c, gcc.dg/stmt-expr-3.c: New tests. + +2004-11-04 Joseph S. Myers <joseph@codesourcery.com> + * gcc.dg/c90-restrict-1.c, gcc.dg/c99-arraydecl-2.c, gcc.dg/c99-func-2.c, gcc.dg/charset/asm2.c, gcc.dg/concat.c, gcc.dg/cpp/19990413-1.c, gcc.dg/cpp/paste4.c, diff --git a/gcc/testsuite/gcc.dg/asm-qual-1.c b/gcc/testsuite/gcc.dg/asm-qual-1.c new file mode 100644 index 00000000000..9c931d40753 --- /dev/null +++ b/gcc/testsuite/gcc.dg/asm-qual-1.c @@ -0,0 +1,12 @@ +/* Test that qualifiers other than volatile are ignored on asm. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ + +void +f (void) +{ + asm volatile (""); + asm const (""); /* { dg-warning "warning: const qualifier ignored on asm" } */ + asm restrict (""); /* { dg-warning "warning: restrict qualifier ignored on asm" } */ +} diff --git a/gcc/testsuite/gcc.dg/declspec-15.c b/gcc/testsuite/gcc.dg/declspec-15.c new file mode 100644 index 00000000000..e94ce38111d --- /dev/null +++ b/gcc/testsuite/gcc.dg/declspec-15.c @@ -0,0 +1,12 @@ +/* Test diagnostic for empty declarations in old-style parameter + declarations. Test with no special options. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu89" } */ + +void +f (a, b) + int; /* { dg-warning "warning: empty declaration" } */ + register; /* { dg-warning "warning: empty declaration" } */ +{ +} diff --git a/gcc/testsuite/gcc.dg/declspec-16.c b/gcc/testsuite/gcc.dg/declspec-16.c new file mode 100644 index 00000000000..a81f0c69040 --- /dev/null +++ b/gcc/testsuite/gcc.dg/declspec-16.c @@ -0,0 +1,12 @@ +/* Test diagnostic for empty declarations in old-style parameter + declarations. Test with -pedantic. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu89 -pedantic" } */ + +void +f (a, b) + int; /* { dg-warning "warning: empty declaration" } */ + register; /* { dg-warning "warning: empty declaration" } */ +{ +} diff --git a/gcc/testsuite/gcc.dg/declspec-17.c b/gcc/testsuite/gcc.dg/declspec-17.c new file mode 100644 index 00000000000..5be737e00d3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/declspec-17.c @@ -0,0 +1,12 @@ +/* Test diagnostic for empty declarations in old-style parameter + declarations. Test with -pedantic-errors. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu89 -pedantic-errors" } */ + +void +f (a, b) + int; /* { dg-error "error: empty declaration" } */ + register; /* { dg-error "error: empty declaration" } */ +{ +} diff --git a/gcc/testsuite/gcc.dg/empty-source-1.c b/gcc/testsuite/gcc.dg/empty-source-1.c new file mode 100644 index 00000000000..239001c030a --- /dev/null +++ b/gcc/testsuite/gcc.dg/empty-source-1.c @@ -0,0 +1,5 @@ +/* Test diagnostic for an empty source file. Test with no special + options. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "" } */ diff --git a/gcc/testsuite/gcc.dg/empty-source-2.c b/gcc/testsuite/gcc.dg/empty-source-2.c new file mode 100644 index 00000000000..6f54f03d82f --- /dev/null +++ b/gcc/testsuite/gcc.dg/empty-source-2.c @@ -0,0 +1,6 @@ +/* Test diagnostic for an empty source file. Test with -pedantic. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "-pedantic" } */ + +/* { dg-warning "warning: ISO C forbids an empty source file" "empty" { target *-*-* } 1 } */ diff --git a/gcc/testsuite/gcc.dg/empty-source-3.c b/gcc/testsuite/gcc.dg/empty-source-3.c new file mode 100644 index 00000000000..c58924267ff --- /dev/null +++ b/gcc/testsuite/gcc.dg/empty-source-3.c @@ -0,0 +1,7 @@ +/* Test diagnostic for an empty source file. Test with + -pedantic-errors. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "-pedantic-errors" } */ + +/* { dg-error "error: ISO C forbids an empty source file" "empty" { target *-*-* } 1 } */ diff --git a/gcc/testsuite/gcc.dg/extra-semi-1.c b/gcc/testsuite/gcc.dg/extra-semi-1.c new file mode 100644 index 00000000000..74857cad12b --- /dev/null +++ b/gcc/testsuite/gcc.dg/extra-semi-1.c @@ -0,0 +1,7 @@ +/* Test diagnostic for extra semicolon outside a function. Test with + no special options. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +; diff --git a/gcc/testsuite/gcc.dg/extra-semi-2.c b/gcc/testsuite/gcc.dg/extra-semi-2.c new file mode 100644 index 00000000000..c4e1cc3b44e --- /dev/null +++ b/gcc/testsuite/gcc.dg/extra-semi-2.c @@ -0,0 +1,7 @@ +/* Test diagnostic for extra semicolon outside a function. Test with + -pedantic. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "-pedantic" } */ + +; /* { dg-warning "warning: ISO C does not allow extra ';' outside of a function" } */ diff --git a/gcc/testsuite/gcc.dg/extra-semi-3.c b/gcc/testsuite/gcc.dg/extra-semi-3.c new file mode 100644 index 00000000000..6b907672f2f --- /dev/null +++ b/gcc/testsuite/gcc.dg/extra-semi-3.c @@ -0,0 +1,7 @@ +/* Test diagnostic for extra semicolon outside a function. Test with + -pedantic-errors. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "-pedantic-errors" } */ + +; /* { dg-error "error: ISO C does not allow extra ';' outside of a function" } */ diff --git a/gcc/testsuite/gcc.dg/gnu-cond-expr-1.c b/gcc/testsuite/gcc.dg/gnu-cond-expr-1.c new file mode 100644 index 00000000000..0f0bb214228 --- /dev/null +++ b/gcc/testsuite/gcc.dg/gnu-cond-expr-1.c @@ -0,0 +1,13 @@ +/* Test diagnostic for GNU extension: omitting middle term of + conditional expression. Test with no special options. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ + +int a, b, c; + +void +f (void) +{ + c = (++a ? : b); +} diff --git a/gcc/testsuite/gcc.dg/gnu-cond-expr-2.c b/gcc/testsuite/gcc.dg/gnu-cond-expr-2.c new file mode 100644 index 00000000000..53234dc26ca --- /dev/null +++ b/gcc/testsuite/gcc.dg/gnu-cond-expr-2.c @@ -0,0 +1,13 @@ +/* Test diagnostic for GNU extension: omitting middle term of + conditional expression. Test with -pedantic. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99 -pedantic" } */ + +int a, b, c; + +void +f (void) +{ + c = (++a ? : b); /* { dg-warning "warning: ISO C forbids omitting the middle term of a \\?: expression" } */ +} diff --git a/gcc/testsuite/gcc.dg/gnu-cond-expr-3.c b/gcc/testsuite/gcc.dg/gnu-cond-expr-3.c new file mode 100644 index 00000000000..e15ed0259c7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/gnu-cond-expr-3.c @@ -0,0 +1,13 @@ +/* Test diagnostic for GNU extension: omitting middle term of + conditional expression. Test with -pedantic-errors. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99 -pedantic-errors" } */ + +int a, b, c; + +void +f (void) +{ + c = (++a ? : b); /* { dg-error "error: ISO C forbids omitting the middle term of a \\?: expression" } */ +} diff --git a/gcc/testsuite/gcc.dg/init-empty-1.c b/gcc/testsuite/gcc.dg/init-empty-1.c new file mode 100644 index 00000000000..39a5174ba84 --- /dev/null +++ b/gcc/testsuite/gcc.dg/init-empty-1.c @@ -0,0 +1,9 @@ +/* Test diagnostic for empty initializer braces. Test with no special + options. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ + +struct s { int a; } x = { }; + +struct s *p = &(struct s){ }; diff --git a/gcc/testsuite/gcc.dg/init-empty-2.c b/gcc/testsuite/gcc.dg/init-empty-2.c new file mode 100644 index 00000000000..a6e1a30206a --- /dev/null +++ b/gcc/testsuite/gcc.dg/init-empty-2.c @@ -0,0 +1,9 @@ +/* Test diagnostic for empty initializer braces. Test with + -pedantic. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99 -pedantic" } */ + +struct s { int a; } x = { }; /* { dg-warning "warning: ISO C forbids empty initializer braces" } */ + +struct s *p = &(struct s){ }; /* { dg-warning "warning: ISO C forbids empty initializer braces" } */ diff --git a/gcc/testsuite/gcc.dg/init-empty-3.c b/gcc/testsuite/gcc.dg/init-empty-3.c new file mode 100644 index 00000000000..792d1712f3f --- /dev/null +++ b/gcc/testsuite/gcc.dg/init-empty-3.c @@ -0,0 +1,9 @@ +/* Test diagnostic for empty initializer braces. Test with + -pedantic-errors. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99 -pedantic-errors" } */ + +struct s { int a; } x = { }; /* { dg-error "error: ISO C forbids empty initializer braces" } */ + +struct s *p = &(struct s){ }; /* { dg-error "error: ISO C forbids empty initializer braces" } */ diff --git a/gcc/testsuite/gcc.dg/noncompile/old-style-parm-1.c b/gcc/testsuite/gcc.dg/noncompile/old-style-parm-1.c new file mode 100644 index 00000000000..5f879c3f0ae --- /dev/null +++ b/gcc/testsuite/gcc.dg/noncompile/old-style-parm-1.c @@ -0,0 +1,11 @@ +/* Test that stray semicolon in old-style parameters is not + accepted. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +void +f(a) + int a;; /* { dg-error "parse error|syntax error|expected declaration specifiers" } */ +{ +} diff --git a/gcc/testsuite/gcc.dg/noncompile/old-style-parm-2.c b/gcc/testsuite/gcc.dg/noncompile/old-style-parm-2.c new file mode 100644 index 00000000000..1b156b770f7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/noncompile/old-style-parm-2.c @@ -0,0 +1,11 @@ +/* Test that parameter without declaration specifiers in old-style + parameters is not accepted. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +void +f(a) + a; /* { dg-error "parse error|syntax error|no type or storage class|expected declaration specifiers" } */ +{ +} diff --git a/gcc/testsuite/gcc.dg/stmt-expr-1.c b/gcc/testsuite/gcc.dg/stmt-expr-1.c new file mode 100644 index 00000000000..fdd62528d46 --- /dev/null +++ b/gcc/testsuite/gcc.dg/stmt-expr-1.c @@ -0,0 +1,11 @@ +/* Test diagnostic for GNU extension: statement expressions. Test + with no special options. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ + +int +f (void) +{ + return ({ 1; }); +} diff --git a/gcc/testsuite/gcc.dg/stmt-expr-2.c b/gcc/testsuite/gcc.dg/stmt-expr-2.c new file mode 100644 index 00000000000..37147fd7330 --- /dev/null +++ b/gcc/testsuite/gcc.dg/stmt-expr-2.c @@ -0,0 +1,11 @@ +/* Test diagnostic for GNU extension: statement expressions. Test + with -pedantic. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99 -pedantic" } */ + +int +f (void) +{ + return ({ 1; }); /* { dg-warning "warning: ISO C forbids braced-groups within expressions" } */ +} diff --git a/gcc/testsuite/gcc.dg/stmt-expr-3.c b/gcc/testsuite/gcc.dg/stmt-expr-3.c new file mode 100644 index 00000000000..904201e7004 --- /dev/null +++ b/gcc/testsuite/gcc.dg/stmt-expr-3.c @@ -0,0 +1,11 @@ +/* Test diagnostic for GNU extension: statement expressions. Test + with -pedantic-errors. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99 -pedantic-errors" } */ + +int +f (void) +{ + return ({ 1; }); /* { dg-error "error: ISO C forbids braced-groups within expressions" } */ +} |