On Jul 12, 2007, Jason Merrill <jason@redhat.com> wrote:
Alexandre Oliva wrote:
+ if (!old_decl_gnu_inline)
+ DECL_INTERFACE_KNOWN (newdecl) |= DECL_INTERFACE_KNOWN (olddecl);
DECL_NOT_REALLY_EXTERN (newdecl) |= DECL_NOT_REALLY_EXTERN (olddecl);
DECL_COMDAT (newdecl) |= DECL_COMDAT (olddecl);
It seems to me that if we don't copy DECL_INTERFACE_KNOWN from a
previous gnu_inline declaration, we shouldn't copy the other linkage
flags either.
Both will work, we know the state of those flags when we get at that
point anyway, and they're work the way they are. I could take that
out if you think it's important.
+ if (DECL_INITIAL (nt) && DECL_INITIAL (ot)
+ && (!DECL_DECLARED_INLINE_P (ot)
+ || !lookup_attribute ("gnu_inline",
+ DECL_ATTRIBUTES (ot))
+ || TREE_USED (ot)
+ || (DECL_DECLARED_INLINE_P (nt)
+ && lookup_attribute ("gnu_inline",
+ DECL_ATTRIBUTES (nt)))))
Checking TREE_USED in redeclaration_error_message seems incompatible
with the change in duplicate_decls to force out debug info for a
function that might have been inlined. Do we want to allow people to
redefine gnu_inline functions that have previously been called, or
not? I think we do.
We would, but since C++ is always unit-at-a-time, this never happens,
so I didn't worry too much about ensuring it would work. I tried to
keep it relatively similar to C where it made some sense, but that's
no guarantee that it would work without unit-at-a-time.