aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2011-03-18 23:26:16 +0000
committerJoseph Myers <jsm28@gcc.gnu.org>2011-03-18 23:26:16 +0000
commit8bf872f9e802229ec2def801b4b1d53ffc149c35 (patch)
tree4c5bb74e8984d1dc6006840491fe25e44dbdb0e8 /gcc/c-decl.c
parentff8e21599213bbea6ccacecf2522ad19836c8fd1 (diff)
downloadgcc-8bf872f9e802229ec2def801b4b1d53ffc149c35.zip
gcc-8bf872f9e802229ec2def801b4b1d53ffc149c35.tar.gz
gcc-8bf872f9e802229ec2def801b4b1d53ffc149c35.tar.bz2
c-decl.c (diagnose_mismatched_decls): Give an error for redefining a typedef with variably modified type.
* c-decl.c (diagnose_mismatched_decls): Give an error for redefining a typedef with variably modified type. testsuite: * gcc.dg/c1x-typedef-1.c: Expect errors for redefinitions of variably modified typedefs. * gcc.dg/c1x-typedef-2.c: Remove. From-SVN: r171172
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r--gcc/c-decl.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 8f9c444..4e82f28 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -1813,20 +1813,16 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
|| TREE_NO_WARNING (olddecl))
return true; /* Allow OLDDECL to continue in use. */
- if (pedantic && !flag_isoc1x)
+ if (variably_modified_type_p (newtype, NULL))
{
- pedwarn (input_location, OPT_pedantic,
- "redefinition of typedef %q+D", newdecl);
+ error ("redefinition of typedef %q+D with variably modified type",
+ newdecl);
locate_old_decl (olddecl);
}
- else if (variably_modified_type_p (newtype, NULL))
+ else if (pedantic && !flag_isoc1x)
{
- /* Whether there is a constraint violation for the types not
- being the same cannot be determined at compile time; a
- warning that there may be one at runtime is considered
- appropriate (WG14 reflector message 11743, 8 May 2009). */
- warning (0, "redefinition of typedef %q+D may be a constraint "
- "violation at runtime", newdecl);
+ pedwarn (input_location, OPT_pedantic,
+ "redefinition of typedef %q+D", newdecl);
locate_old_decl (olddecl);
}