From a1361ef205258875edb527aa8eb48f8924a822b5 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Thu, 10 Jul 2008 01:41:06 +0000 Subject: [PATCH] no-asm-1.c: New test. * 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 | 10 ++++++++++ gcc/testsuite/g++.dg/ext/no-asm-1.C | 10 ++++++++++ gcc/testsuite/g++.dg/ext/no-asm-2.C | 10 ++++++++++ gcc/testsuite/g++.dg/ext/no-gnu-keywords-1.C | 9 +++++++++ gcc/testsuite/gcc.dg/no-asm-1.c | 10 ++++++++++ gcc/testsuite/gcc.dg/no-asm-2.c | 9 +++++++++ gcc/testsuite/gcc.dg/no-asm-3.c | 10 ++++++++++ gcc/testsuite/gcc.dg/no-asm-4.c | 11 +++++++++++ 8 files changed, 79 insertions(+) create mode 100644 gcc/testsuite/g++.dg/ext/no-asm-1.C create mode 100644 gcc/testsuite/g++.dg/ext/no-asm-2.C create mode 100644 gcc/testsuite/g++.dg/ext/no-gnu-keywords-1.C create mode 100644 gcc/testsuite/gcc.dg/no-asm-1.c create mode 100644 gcc/testsuite/gcc.dg/no-asm-2.c create mode 100644 gcc/testsuite/gcc.dg/no-asm-3.c create mode 100644 gcc/testsuite/gcc.dg/no-asm-4.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1ddae4ea8ce..7518595c775 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,13 @@ +2008-07-09 Ian Lance Taylor + + * 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 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 index 00000000000..6c4c2043959 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/no-asm-1.C @@ -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 index 00000000000..fa614d8e24e --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/no-asm-2.C @@ -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 index 00000000000..8dbbd5f3482 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/no-gnu-keywords-1.C @@ -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 index 00000000000..fdcf05459a4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/no-asm-1.c @@ -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 index 00000000000..3cd41141de1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/no-asm-2.c @@ -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 index 00000000000..9c806e43533 --- /dev/null +++ b/gcc/testsuite/gcc.dg/no-asm-3.c @@ -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 index 00000000000..c4c1687800c --- /dev/null +++ b/gcc/testsuite/gcc.dg/no-asm-4.c @@ -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." } */ -- 2.30.2