diff options
author | Andrew Pinski <pinskia@gcc.gnu.org> | 2005-01-04 17:41:36 -0800 |
---|---|---|
committer | Andrew Pinski <pinskia@gcc.gnu.org> | 2005-01-04 17:41:36 -0800 |
commit | f8f5c4b3aa71b9bcc430d514129294ccacf93626 (patch) | |
tree | d86e96d66b105812b84c3711957b1431c1222576 /gcc | |
parent | 8d0cf6032ba0a5e01330379a98067b1f7a50dd2f (diff) | |
download | gcc-f8f5c4b3aa71b9bcc430d514129294ccacf93626.zip gcc-f8f5c4b3aa71b9bcc430d514129294ccacf93626.tar.gz gcc-f8f5c4b3aa71b9bcc430d514129294ccacf93626.tar.bz2 |
re PR c/19152 (IMA and external inline don't get along)
2005-01-04 Andrew Pinski <pinskia@physics.uc.edu>
PR c/19152
* c-decl.c (diagnose_mismatched_decls): Accept "extern inline" declared
after the full declaration if the are in two different TUs.
From-SVN: r92918
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/c-decl.c | 53 |
2 files changed, 49 insertions, 12 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0c21f44..2d8e69a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,4 +1,10 @@ -2005-01-04 Richard Henderson <rth@redhat.com> +2005-01-04 Andrew Pinski <pinskia@physics.uc.edu> + + PR c/19152 + * c-decl.c (diagnose_mismatched_decls): Accept "extern inline" declared + after the full declaration if the are in two different TUs. + +2005-01-04 Richard Henderson <rth@redhat.com> PR tree-opt/19158 * tree-sra.c (generate_one_element_init): Just diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 047ef59..6673927 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -1116,6 +1116,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl, tree newtype, oldtype; bool pedwarned = false; bool warned = false; + bool retval = true; /* If we have error_mark_node for either decl or type, just discard the previous decl - we're in an error cascade already. */ @@ -1266,17 +1267,47 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl, if (DECL_INITIAL (newdecl)) { - if (DECL_INITIAL (olddecl) - && !(DECL_DECLARED_INLINE_P (olddecl) - && DECL_EXTERNAL (olddecl) - && !(DECL_DECLARED_INLINE_P (newdecl) - && DECL_EXTERNAL (newdecl) - && same_translation_unit_p (olddecl, newdecl)))) + if (DECL_INITIAL (olddecl)) { - error ("%Jredefinition of %qD", newdecl, newdecl); - locate_old_decl (olddecl, error); - return false; - } + /* If both decls have extern inline and are in the same TU, + reject the new decl. */ + if (DECL_DECLARED_INLINE_P (olddecl) + && DECL_EXTERNAL (olddecl) + && DECL_DECLARED_INLINE_P (newdecl) + && DECL_EXTERNAL (newdecl) + && same_translation_unit_p (newdecl, olddecl)) + { + error ("%Jredefinition of %qD", newdecl, newdecl); + locate_old_decl (olddecl, error); + return false; + } + /* If both decls have not extern inline, reject the new decl. */ + if (!DECL_DECLARED_INLINE_P (olddecl) + && !DECL_EXTERNAL (olddecl) + && !DECL_DECLARED_INLINE_P (newdecl) + && !DECL_EXTERNAL (newdecl)) + { + error ("%Jredefinition of %qD", newdecl, newdecl); + locate_old_decl (olddecl, error); + return false; + } + /* If the new decl is declared as extern inline, error if they are + in the same TU, otherwise retain the old decl. */ + if (!DECL_DECLARED_INLINE_P (olddecl) + && !DECL_EXTERNAL (olddecl) + && DECL_DECLARED_INLINE_P (newdecl) + && DECL_EXTERNAL (newdecl)) + { + if (same_translation_unit_p (newdecl, olddecl)) + { + error ("%Jredefinition of %qD", newdecl, newdecl); + locate_old_decl (olddecl, error); + return false; + } + else + retval = false; + } + } } /* If we have a prototype after an old-style function definition, the argument types must be checked specially. */ @@ -1518,7 +1549,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl, if (warned || pedwarned) locate_old_decl (olddecl, pedwarned ? pedwarn : warning); - return true; + return retval; } /* Subroutine of duplicate_decls. NEWDECL has been found to be |