summaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2011-03-18 23:26:16 +0000
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2011-03-18 23:26:16 +0000
commitff889d787c5af631e9787d33df9b5c0bc8375847 (patch)
tree4c5bb74e8984d1dc6006840491fe25e44dbdb0e8 /gcc/c-decl.c
parent9b280b352c3d5137cd09699d8cc6f64fa8cb4adb (diff)
downloadgcc-ff889d787c5af631e9787d33df9b5c0bc8375847.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@171172 138bc75d-0d04-0410-961f-82ee72b054a4
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 8f9c4440048..4e82f2844a8 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);
}