PATCH: Mark an inline function one-only if it is accessible from outside

Joseph S. Myers joseph@codesourcery.com
Sat Jan 31 00:03:00 GMT 2009


On Fri, 30 Jan 2009, H.J. Lu wrote:

> On Fri, Jan 30, 2009 at 2:43 PM, Ian Lance Taylor <iant@google.com> wrote:
> > "H.J. Lu" <hjl.tools@gmail.com> writes:
> >
> >> On Fri, Jan 30, 2009 at 7:44 AM, Ian Lance Taylor <iant@google.com> wrote:
> >>> I committed this patch to the gcc-in-cxx branch.  This fixes the
> >>> top-level configury to not think the c++ is missing because it was
> >>> explicitly enabled.  It also comments out some code which added
> >>> -fkeep-inlin-functions to stage 1.  When building with C++ this breaks
> >>> the inline functions which are provided by <gmp.h>, as they wind up
> >>> getting included in many .o files leading to duplicate definition
> >>> errors at link time.
> >>>
> >>
> >> I also noticed that keeping inline function led to link time error.
> >> Can't we mark the kept inline function linktonce?
> >
> > I have no objection to that.  It would make -fkeep-inline-functions
> > more useful for g++.
> >
> 
> Here is a patch.

Changing C here seems like it would defeat the idea of 
-fkeep-inline-functions detecting uses that are not portable for C through 
link errors.  To make -fkeep-inline-functions more useful for g++ you 
should be changing C++ in some way, not C.

I don't think we should make any changes to the existing gnu89 inline 
semantics, or move C99 away from the C linkage mode.

-- 
Joseph S. Myers
joseph@codesourcery.com



More information about the Gcc-patches mailing list