mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-02-05 01:01:34 +08:00
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
This commit is contained in:
parent
f42ef510b3
commit
919e080719
@ -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.
|
||||
|
7
gcc/testsuite/gcc.dg/c90-enum-comma-1.c
Normal file
7
gcc/testsuite/gcc.dg/c90-enum-comma-1.c
Normal file
@ -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 } */
|
8
gcc/testsuite/gcc.dg/c90-idem-qual-1.c
Normal file
8
gcc/testsuite/gcc.dg/c90-idem-qual-1.c
Normal file
@ -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 } */
|
22
gcc/testsuite/gcc.dg/c90-impl-decl-1.c
Normal file
22
gcc/testsuite/gcc.dg/c90-impl-decl-1.c
Normal file
@ -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" } */
|
||||
}
|
8
gcc/testsuite/gcc.dg/c90-impl-int-1.c
Normal file
8
gcc/testsuite/gcc.dg/c90-impl-int-1.c
Normal file
@ -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) { }
|
7
gcc/testsuite/gcc.dg/c90-longlong-1.c
Normal file
7
gcc/testsuite/gcc.dg/c90-longlong-1.c
Normal file
@ -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 } */
|
7
gcc/testsuite/gcc.dg/c90-restrict-1.c
Normal file
7
gcc/testsuite/gcc.dg/c90-restrict-1.c
Normal file
@ -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 } */
|
17
gcc/testsuite/gcc.dg/c90-return-1.c
Normal file
17
gcc/testsuite/gcc.dg/c90-return-1.c
Normal file
@ -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 } */
|
||||
}
|
6
gcc/testsuite/gcc.dg/c99-enum-comma-1.c
Normal file
6
gcc/testsuite/gcc.dg/c99-enum-comma-1.c
Normal file
@ -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, };
|
7
gcc/testsuite/gcc.dg/c99-idem-qual-1.c
Normal file
7
gcc/testsuite/gcc.dg/c99-idem-qual-1.c
Normal file
@ -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" } */
|
21
gcc/testsuite/gcc.dg/c99-impl-decl-1.c
Normal file
21
gcc/testsuite/gcc.dg/c99-impl-decl-1.c
Normal file
@ -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 } */
|
||||
}
|
9
gcc/testsuite/gcc.dg/c99-impl-int-1.c
Normal file
9
gcc/testsuite/gcc.dg/c99-impl-int-1.c
Normal file
@ -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 } */
|
6
gcc/testsuite/gcc.dg/c99-longlong-1.c
Normal file
6
gcc/testsuite/gcc.dg/c99-longlong-1.c
Normal file
@ -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" } */
|
19
gcc/testsuite/gcc.dg/c99-restrict-1.c
Normal file
19
gcc/testsuite/gcc.dg/c99-restrict-1.c
Normal file
@ -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 } */
|
18
gcc/testsuite/gcc.dg/c99-return-1.c
Normal file
18
gcc/testsuite/gcc.dg/c99-return-1.c
Normal file
@ -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 } */
|
||||
}
|
Loading…
Reference in New Issue
Block a user