no-asm-1.c: New test.
authorIan Lance Taylor <iant@google.com>
Thu, 10 Jul 2008 01:41:06 +0000 (01:41 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Thu, 10 Jul 2008 01:41:06 +0000 (01:41 +0000)
* gcc.dg/no-asm-1.c: New test.
* gcc.dg/no-asm-2.c: New test.
* gcc.dg/no-asm-3.c: New test.
* gcc.dg/no-asm-4.c: New test.
* g++.dg/ext/no-asm-1.C: New test.
* g++.dg/ext/no-asm-2.C: New test.
* g++.dg/ext/no-gnu-keywords-1.C: New test.

From-SVN: r137684

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/no-asm-1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/ext/no-asm-2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/ext/no-gnu-keywords-1.C [new file with mode: 0644]
gcc/testsuite/gcc.dg/no-asm-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/no-asm-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/no-asm-3.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/no-asm-4.c [new file with mode: 0644]

index 1ddae4ea8ce0c51ffe2bac9a163386581327e4f2..7518595c77578f3b21b51ef308704956d6f0770c 100644 (file)
@@ -1,3 +1,13 @@
+2008-07-09  Ian Lance Taylor  <iant@google.com>
+
+       * gcc.dg/no-asm-1.c: New test.
+       * gcc.dg/no-asm-2.c: New test.
+       * gcc.dg/no-asm-3.c: New test.
+       * gcc.dg/no-asm-4.c: New test.
+       * g++.dg/ext/no-asm-1.C: New test.
+       * g++.dg/ext/no-asm-2.C: New test.
+       * g++.dg/ext/no-gnu-keywords-1.C: New test.
+
 2008-07-09  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/36760
diff --git a/gcc/testsuite/g++.dg/ext/no-asm-1.C b/gcc/testsuite/g++.dg/ext/no-asm-1.C
new file mode 100644 (file)
index 0000000..6c4c204
--- /dev/null
@@ -0,0 +1,10 @@
+// { dg-do compile }
+// { dg-options "" }
+
+// Verify that asm and the GNU extension typeof are recognized as
+// keywords.
+
+int asm;       // { dg-error "before .asm." }
+int typeof;    // { dg-error "expected" }
+// { dg-error "multiple types" "" { target *-*-* } 8 }
+// { dg-error "declaration" "" { target *-*-* } 8 }
diff --git a/gcc/testsuite/g++.dg/ext/no-asm-2.C b/gcc/testsuite/g++.dg/ext/no-asm-2.C
new file mode 100644 (file)
index 0000000..fa614d8
--- /dev/null
@@ -0,0 +1,10 @@
+// { dg-do compile }
+// { dg-options "-fno-asm" }
+
+// Verify that the keyword asm and the GNU extension typeof are not
+// recognized as keywords when using -fno-asm.  Having -fno-asm affect
+// a standard C++ keyword seems strange, but that is existing
+// behaviour.  If that behaviour changes, this test should change.
+
+int asm;       // { dg-bogus "before .asm." }
+int typeof;    // { dg-bogus "before .typeof." }
diff --git a/gcc/testsuite/g++.dg/ext/no-gnu-keywords-1.C b/gcc/testsuite/g++.dg/ext/no-gnu-keywords-1.C
new file mode 100644 (file)
index 0000000..8dbbd5f
--- /dev/null
@@ -0,0 +1,9 @@
+// { dg-do compile }
+// { dg-options "-fno-gnu-keywords" }
+
+// Verify that the keyword asm is recognized and that the GNU
+// extension typeof is not recognized as a keyword when using
+// -fno-gnu-keywords.
+
+int asm;       // { dg-error "before .asm." }
+int typeof;    // { dg-bogus "before .typeof." }
diff --git a/gcc/testsuite/gcc.dg/no-asm-1.c b/gcc/testsuite/gcc.dg/no-asm-1.c
new file mode 100644 (file)
index 0000000..fdcf054
--- /dev/null
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu89" } */
+
+/* Verify that these GNU extensions are recognized as keywords in
+   GNU89 mode.  */
+
+int asm;       /* { dg-error "before .asm." } */
+int inline;    /* { dg-warning "empty declaration" } */
+/* { dg-error "empty declaration" "" { target *-*-* } 8 } */
+int typeof;    /* { dg-error "before .typeof." } */
diff --git a/gcc/testsuite/gcc.dg/no-asm-2.c b/gcc/testsuite/gcc.dg/no-asm-2.c
new file mode 100644 (file)
index 0000000..3cd4114
--- /dev/null
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu89 -fno-asm" } */
+
+/* Verify that these GNU extensions are not recognized as keywords
+   when using -fno-asm in GNU89 mode.  */
+
+int asm;       /* { dg-bogus "before .asm." } */
+int inline;    /* { dg-bogus "empty declaration" } */
+int typeof;    /* { dg-bogus "before .typeof." } */
diff --git a/gcc/testsuite/gcc.dg/no-asm-3.c b/gcc/testsuite/gcc.dg/no-asm-3.c
new file mode 100644 (file)
index 0000000..9c806e4
--- /dev/null
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99" } */
+
+/* Verify that these GNU extensions are recognized as keywords in
+   GNU99 mode.  */
+
+int asm;       /* { dg-error "before .asm." } */
+int inline;    /* { dg-warning "empty declaration" } */
+/* { dg-error "empty declaration" "" { target *-*-* } 8 } */
+int typeof;    /* { dg-error "before .typeof." } */
diff --git a/gcc/testsuite/gcc.dg/no-asm-4.c b/gcc/testsuite/gcc.dg/no-asm-4.c
new file mode 100644 (file)
index 0000000..c4c1687
--- /dev/null
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99 -fno-asm" } */
+
+/* Verify that the GNU extensions asm and typeof are not recognized as
+   keywords when using -fno-asm in GNU89 mode, but that inline (which
+   is a keyword in C99 but not C89) is recognized.  */
+
+int asm;       /* { dg-bogus "before .asm." } */
+int inline;    /* { dg-warning "empty declaration" } */
+/* { dg-error "empty declaration" "" { target *-*-* } 9 } */
+int typeof;    /* { dg-bogus "before .typeof." } */