summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2015-06-15 17:01:04 +0000
committermiod <miod@openbsd.org>2015-06-15 17:01:04 +0000
commitfdf48840afcb0edb6aa524eb2ece0ee9a2c72776 (patch)
treef473ef93bad5771b90052905a8fcd13405490582
parentBring back r1.78 and r1.79, now that ajactouto@'s regression has (diff)
downloadwireguard-openbsd-fdf48840afcb0edb6aa524eb2ece0ee9a2c72776.tar.xz
wireguard-openbsd-fdf48840afcb0edb6aa524eb2ece0ee9a2c72776.zip
Don't error out when an existing typedef is redefined with the same definition;
this is allowed in C11 and 3rd-party software is relying upon this to be accepted by the compiler. Nevertheless warn about this if -pedantic. ok ajacoutot@ deraadt@ millert@
-rw-r--r--gnu/gcc/gcc/c-decl.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/gnu/gcc/gcc/c-decl.c b/gnu/gcc/gcc/c-decl.c
index 9762d187753..042a2e1291c 100644
--- a/gnu/gcc/gcc/c-decl.c
+++ b/gnu/gcc/gcc/c-decl.c
@@ -1285,9 +1285,17 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
if (DECL_IN_SYSTEM_HEADER (newdecl) || DECL_IN_SYSTEM_HEADER (olddecl))
return true; /* Allow OLDDECL to continue in use. */
- error ("redefinition of typedef %q+D", newdecl);
- locate_old_decl (olddecl, error);
- return false;
+ if (pedantic)
+ {
+ pedwarn ("redefinition of typedef %q+D", newdecl);
+ if (flag_pedantic_errors)
+ {
+ locate_old_decl (olddecl, error);
+ return false;
+ }
+ }
+
+ return true;
}
/* Function declarations can either be 'static' or 'extern' (no