Commit da377db9 by Joseph Myers Committed by Joseph Myers

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
parent 3baf459d
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> 2009-04-19 Diego Novillo <dnovillo@google.com>
* toplev.c (compile_file): Move call to coverage_finish ... * toplev.c (compile_file): Move call to coverage_finish ...
......
...@@ -2883,6 +2883,12 @@ shadow_tag_warned (const struct c_declspecs *declspecs, int warned) ...@@ -2883,6 +2883,12 @@ shadow_tag_warned (const struct c_declspecs *declspecs, int warned)
found_tag = true; found_tag = true;
if (declspecs->restrict_p)
{
error ("invalid use of %<restrict%>");
warned = 1;
}
if (name == 0) if (name == 0)
{ {
if (warned != 1 && code != ENUMERAL_TYPE) if (warned != 1 && code != ENUMERAL_TYPE)
......
2009-04-19 Joseph Myers <joseph@codesourcery.com> 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 PR preprocessor/20078
* gcc.dg/cpp/paste16.c, gcc.dg/cpp/redef4.c: New tests. * gcc.dg/cpp/paste16.c, gcc.dg/cpp/redef4.c: New tests.
......
/* 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" } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment