This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [gcc-in-cxx] Fix top-level configury
Eric Botcazou <ebotcazou@adacore.com> writes:
>> 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.
>
> This was added precisely because of that, i.e. because non-GCC compilers tend
> not to eliminate inline functions when not optimizing. So, if you plan to
> support other C++ compilers then G++, that's a step backwards.
I don't think so. The C++ inline semantics are like the C99
semantics: a function which is inline, but neither static nor extern,
must not be included in the output file. You must be talking about
C90 compilers which implement inline as a hint, and keep the function
if it is not inlined everywhere--e.g., the C++ or C99 extern inline
semantics. Passing -fkeep-inline-functions to g++ changes the inline
semantics to keep inline functions even when C++ rules say they must
be discarded. This is rarely correct, and it legitimately breaks when
using <gmp.h> which expects the normal C++ inline semantics. So I
think my patch is correct when building with C++.
Ian