diff options
author | Joseph Myers <jsm28@cam.ac.uk> | 2000-07-17 02:25:51 -0600 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 2000-07-17 02:25:51 -0600 |
commit | 919e080719cc40e7bed8a7d9cfce1261be756d96 (patch) | |
tree | e827b4dc57ae5e195740f501b640468fe1dac1ad | |
parent | f42ef510b353657cce680c12a42cdb861ed5d081 (diff) | |
download | gcc-919e080719cc40e7bed8a7d9cfce1261be756d96.zip gcc-919e080719cc40e7bed8a7d9cfce1261be756d96.tar.gz gcc-919e080719cc40e7bed8a7d9cfce1261be756d96.tar.bz2 |
c90-enum-comma-1.c, [...]: New tests.
* gcc.dg/c90-enum-comma-1.c, gcc.dg/c90-idem-qual-1.c,
gcc.dg/c90-impl-decl-1.c, gcc.dg/c90-impl-int-1.c,
gcc.dg/c90-longlong.c, gcc.dg/c90-restrict-1.c,
gcc.dg/c90-return-1.c, gcc.dg/c99-enum-comma-1.c,
gcc.dg/c99-idem-qual-1.c, gcc.dg/c99-impl-decl-1.c,
gcc.dg/c99-impl-int-1.c, gcc.dg/c99-longlong-1.c,
gcc.dg/c99-restrict-1.c, gcc.dg/c99-return-1.c: New tests.
From-SVN: r35073
-rw-r--r-- | gcc/testsuite/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/c90-enum-comma-1.c | 7 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/c90-idem-qual-1.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/c90-impl-decl-1.c | 22 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/c90-impl-int-1.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/c90-longlong-1.c | 7 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/c90-restrict-1.c | 7 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/c90-return-1.c | 17 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/c99-enum-comma-1.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/c99-idem-qual-1.c | 7 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/c99-impl-decl-1.c | 21 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/c99-impl-int-1.c | 9 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/c99-longlong-1.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/c99-restrict-1.c | 19 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/c99-return-1.c | 18 |
15 files changed, 172 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c93ef02..aa0b211 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,13 @@ +2000-07-17 Joseph S. Myers <jsm28@cam.ac.uk> + + * gcc.dg/c90-enum-comma-1.c, gcc.dg/c90-idem-qual-1.c, + gcc.dg/c90-impl-decl-1.c, gcc.dg/c90-impl-int-1.c, + gcc.dg/c90-longlong.c, gcc.dg/c90-restrict-1.c, + gcc.dg/c90-return-1.c, gcc.dg/c99-enum-comma-1.c, + gcc.dg/c99-idem-qual-1.c, gcc.dg/c99-impl-decl-1.c, + gcc.dg/c99-impl-int-1.c, gcc.dg/c99-longlong-1.c, + gcc.dg/c99-restrict-1.c, gcc.dg/c99-return-1.c: New tests. + Mon Jul 17 00:41:57 2000 Greg McGary <greg@mcgary.org> * gcc.c-torture/execute/20000717-1.c: New test. diff --git a/gcc/testsuite/gcc.dg/c90-enum-comma-1.c b/gcc/testsuite/gcc.dg/c90-enum-comma-1.c new file mode 100644 index 0000000..2029c92 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c90-enum-comma-1.c @@ -0,0 +1,7 @@ +/* Test for commas at end of enums: in C99 only. */ +/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ + +enum foo { bar, }; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "comma at end" "enum comma error" { target *-*-* } 6 } */ diff --git a/gcc/testsuite/gcc.dg/c90-idem-qual-1.c b/gcc/testsuite/gcc.dg/c90-idem-qual-1.c new file mode 100644 index 0000000..ee05a82 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c90-idem-qual-1.c @@ -0,0 +1,8 @@ +/* Test for idempotent type qualifiers: in C99 only. */ +/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ + +typedef const int cint; +const cint foo; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "duplicate" "duplicate type qualifier error" { target *-*-* } 7 } */ diff --git a/gcc/testsuite/gcc.dg/c90-impl-decl-1.c b/gcc/testsuite/gcc.dg/c90-impl-decl-1.c new file mode 100644 index 0000000..4e4431e --- /dev/null +++ b/gcc/testsuite/gcc.dg/c90-impl-decl-1.c @@ -0,0 +1,22 @@ +/* Test for implicit function declaration: in C90 only. */ +/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ + +void +foo (void) +{ + bar (); +} + +/* C90 subclause 7.1.7 says we can implicitly declare strcmp; C99 removes + implict declarations. +*/ +int +bar (const char *a, const char *b) +{ + /* This fails for GCC CVS 20000709, but is not marked XFAIL since + GCC 2.95.2 passes. + */ + return strcmp (a, b); /* { dg-bogus "implicit" "implicit declaration warning for strcmp" } */ +} diff --git a/gcc/testsuite/gcc.dg/c90-impl-int-1.c b/gcc/testsuite/gcc.dg/c90-impl-int-1.c new file mode 100644 index 0000000..cd995c2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c90-impl-int-1.c @@ -0,0 +1,8 @@ +/* Test for implicit int: in C90 only. */ +/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ + +extern foo; + +bar (void) { } diff --git a/gcc/testsuite/gcc.dg/c90-longlong-1.c b/gcc/testsuite/gcc.dg/c90-longlong-1.c new file mode 100644 index 0000000..e91e39e --- /dev/null +++ b/gcc/testsuite/gcc.dg/c90-longlong-1.c @@ -0,0 +1,7 @@ +/* Test for long long: in C99 only. */ +/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ + +long long foo; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "long long" "long long not in C90" { target *-*-* } 6 } */ diff --git a/gcc/testsuite/gcc.dg/c90-restrict-1.c b/gcc/testsuite/gcc.dg/c90-restrict-1.c new file mode 100644 index 0000000..17af58b --- /dev/null +++ b/gcc/testsuite/gcc.dg/c90-restrict-1.c @@ -0,0 +1,7 @@ +/* Test for restrict: in C99 only. */ +/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ + +char *restrict foo; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "parse error|no type" "restrict not in C90" { target *-*-* } 6 } */ diff --git a/gcc/testsuite/gcc.dg/c90-return-1.c b/gcc/testsuite/gcc.dg/c90-return-1.c new file mode 100644 index 0000000..59e9a92 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c90-return-1.c @@ -0,0 +1,17 @@ +/* Test for constraints on return statements. */ +/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ + +int +foo (void) +{ + return; +} + +void +bar (void) +{ + return 1; /* { dg-bogus "warning" "warning in place of error" } */ + /* { dg-error "with a value" "return constraint violation" { target *-*-* } 15 } */ +} diff --git a/gcc/testsuite/gcc.dg/c99-enum-comma-1.c b/gcc/testsuite/gcc.dg/c99-enum-comma-1.c new file mode 100644 index 0000000..1b676a2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c99-enum-comma-1.c @@ -0,0 +1,6 @@ +/* Test for commas at end of enums: in C99 only. */ +/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +enum foo { bar, }; diff --git a/gcc/testsuite/gcc.dg/c99-idem-qual-1.c b/gcc/testsuite/gcc.dg/c99-idem-qual-1.c new file mode 100644 index 0000000..c541d07 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c99-idem-qual-1.c @@ -0,0 +1,7 @@ +/* Test for idempotent type qualifiers: in C99 only. */ +/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +typedef const int cint; +const cint foo; /* { dg-bogus "duplicate" "duplicate type qualifier error" } */ diff --git a/gcc/testsuite/gcc.dg/c99-impl-decl-1.c b/gcc/testsuite/gcc.dg/c99-impl-decl-1.c new file mode 100644 index 0000000..5843e64 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c99-impl-decl-1.c @@ -0,0 +1,21 @@ +/* Test for implicit function declaration: in C90 only. */ +/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +void +foo (void) +{ + bar (); /* { dg-bogus "warning" "warning in place of error" } */ + /* { dg-error "implicit" "C99 implicit declaration error" { xfail *-*-* } 9 } */ +} + +/* C90 subclause 7.1.7 says we can implicitly declare strcmp; C99 removes + implict declarations. +*/ +int +bar (const char *a, const char *b) +{ + return strcmp (a, b); /* { dg-bogus "warning" "warning in place of error" } */ + /* { dg-error "implicit" "C99 implicit declaration error" { target *-*-* } 19 } */ +} diff --git a/gcc/testsuite/gcc.dg/c99-impl-int-1.c b/gcc/testsuite/gcc.dg/c99-impl-int-1.c new file mode 100644 index 0000000..2e5cad5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c99-impl-int-1.c @@ -0,0 +1,9 @@ +/* Test for implicit int: in C90 only. */ +/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +extern foo; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "type defaults" "C99 implicit int error" { target *-*-* } 6 } */ +bar (void) { } /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "type defaults" "C99 implicit int error" { target *-*-* } 8 } */ diff --git a/gcc/testsuite/gcc.dg/c99-longlong-1.c b/gcc/testsuite/gcc.dg/c99-longlong-1.c new file mode 100644 index 0000000..92d5e0e --- /dev/null +++ b/gcc/testsuite/gcc.dg/c99-longlong-1.c @@ -0,0 +1,6 @@ +/* Test for long long: in C99 only. */ +/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +long long foo; /* { dg-bogus "long long" "bogus long long error" } */ diff --git a/gcc/testsuite/gcc.dg/c99-restrict-1.c b/gcc/testsuite/gcc.dg/c99-restrict-1.c new file mode 100644 index 0000000..30ddd96 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c99-restrict-1.c @@ -0,0 +1,19 @@ +/* Test for restrict: in C99 only. */ +/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +char *restrict foo; + +/* The following are constraint violations and should be rejected. */ + +int restrict bar; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "restrict" "restrict constraint violation" { target *-*-* } 10 } */ + +typedef void (*fp) (void); + +fp restrict baz; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "restrict" "restrict constraint violation" { target *-*-* } 15 } */ + +void quux (int restrict a[3]); /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "restrict" "restrict constraint violation" { target *-*-* } 18 } */ diff --git a/gcc/testsuite/gcc.dg/c99-return-1.c b/gcc/testsuite/gcc.dg/c99-return-1.c new file mode 100644 index 0000000..017cf89 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c99-return-1.c @@ -0,0 +1,18 @@ +/* Test for constraints on return statements. */ +/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +int +foo (void) +{ + return; /* { dg-bogus "warning" "warning in place of error" } */ + /* { dg-error "with no value" "return constraint violation" { target *-*-* } 9 } */ +} + +void +bar (void) +{ + return 1; /* { dg-bogus "warning" "warning in place of error" } */ + /* { dg-error "with a value" "return constraint violation" { target *-*-* } 16 } */ +} |