mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-22 03:30:29 +08:00
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
This commit is contained in:
parent
8d0cf6032b
commit
f8f5c4b3aa
@ -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
|
||||
|
53
gcc/c-decl.c
53
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user