aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2009-04-19 19:25:07 +0100
committerJoseph Myers <jsm28@gcc.gnu.org>2009-04-19 19:25:07 +0100
commitda377db901807dd394238b9e01715ce1313af3ef (patch)
treec0ec87d29c84a7b657046e08c6456078a5ce5c3f /gcc
parent3baf459d85855934a326ef7e6a4dc4de3f3c8056 (diff)
downloadgcc-da377db901807dd394238b9e01715ce1313af3ef.zip
gcc-da377db901807dd394238b9e01715ce1313af3ef.tar.gz
gcc-da377db901807dd394238b9e01715ce1313af3ef.tar.bz2
re PR c/38243 (Restrict constraint violation not an error with -pedantic-errors)
PR c/38243 * c-decl.c (shadow_tag_warned): Diagnose use of restrict when declaring a tag. testsuite: * gcc.dg/c99-restrict-3.c: New test. From-SVN: r146356
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/c-decl.c6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/c99-restrict-3.c7
4 files changed, 24 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2566ff7..48f1f6c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2009-04-19 Joseph Myers <joseph@codesourcery.com>
+
+ PR c/38243
+ * c-decl.c (shadow_tag_warned): Diagnose use of restrict when
+ declaring a tag.
+
2009-04-19 Diego Novillo <dnovillo@google.com>
* toplev.c (compile_file): Move call to coverage_finish ...
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 6226203..796f1ea 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -2883,6 +2883,12 @@ shadow_tag_warned (const struct c_declspecs *declspecs, int warned)
found_tag = true;
+ if (declspecs->restrict_p)
+ {
+ error ("invalid use of %<restrict%>");
+ warned = 1;
+ }
+
if (name == 0)
{
if (warned != 1 && code != ENUMERAL_TYPE)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index bb2fab6..fd41b32 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2009-04-19 Joseph Myers <joseph@codesourcery.com>
+ PR c/38243
+ * gcc.dg/c99-restrict-3.c: New test.
+
+2009-04-19 Joseph Myers <joseph@codesourcery.com>
+
PR preprocessor/20078
* gcc.dg/cpp/paste16.c, gcc.dg/cpp/redef4.c: New tests.
diff --git a/gcc/testsuite/gcc.dg/c99-restrict-3.c b/gcc/testsuite/gcc.dg/c99-restrict-3.c
new file mode 100644
index 0000000..e5200a5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c99-restrict-3.c
@@ -0,0 +1,7 @@
+/* restrict qualifiers on non-pointers must be diagnosed even when
+ only a tag is being declared. PR 38243. */
+/* { dg-do compile } */
+/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
+
+restrict struct s; /* { dg-error "restrict" } */
+restrict union u; /* { dg-error "restrict" } */