This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: Mark an inline function one-only if it is accessible from outside
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: Ian Lance Taylor <iant at google dot com>, gcc-patches at gcc dot gnu dot org
- Date: Fri, 30 Jan 2009 23:55:35 +0000 (UTC)
- Subject: Re: PATCH: Mark an inline function one-only if it is accessible from outside
- References: <6dc9ffc80901301540o6d8cbf64k8ad64df616ccbd61@mail.gmail.com>
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