c90-enum-comma-1.c, [...]: New tests.
authorJoseph Myers <jsm28@cam.ac.uk>
Mon, 17 Jul 2000 08:25:51 +0000 (02:25 -0600)
committerJeff Law <law@gcc.gnu.org>
Mon, 17 Jul 2000 08:25:51 +0000 (02:25 -0600)
        * 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

15 files changed:
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/c90-enum-comma-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c90-idem-qual-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c90-impl-decl-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c90-impl-int-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c90-longlong-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c90-restrict-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c90-return-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c99-enum-comma-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c99-idem-qual-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c99-impl-decl-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c99-impl-int-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c99-longlong-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c99-restrict-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c99-return-1.c [new file with mode: 0644]

index c93ef02955c873c6be24832d51be02171e30ab7b..aa0b211fb226e59f9df75b16c34afb31d03f406c 100644 (file)
@@ -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 (file)
index 0000000..2029c92
--- /dev/null
@@ -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 (file)
index 0000000..ee05a82
--- /dev/null
@@ -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 (file)
index 0000000..4e4431e
--- /dev/null
@@ -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 (file)
index 0000000..cd995c2
--- /dev/null
@@ -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 (file)
index 0000000..e91e39e
--- /dev/null
@@ -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 (file)
index 0000000..17af58b
--- /dev/null
@@ -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 (file)
index 0000000..59e9a92
--- /dev/null
@@ -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 (file)
index 0000000..1b676a2
--- /dev/null
@@ -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 (file)
index 0000000..c541d07
--- /dev/null
@@ -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 (file)
index 0000000..5843e64
--- /dev/null
@@ -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 (file)
index 0000000..2e5cad5
--- /dev/null
@@ -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 (file)
index 0000000..92d5e0e
--- /dev/null
@@ -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 (file)
index 0000000..30ddd96
--- /dev/null
@@ -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 (file)
index 0000000..017cf89
--- /dev/null
@@ -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 } */
+}