This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Can't use -flto with -std=c99
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: Mac Mollison <mollison at cs dot unc dot edu>
- Cc: gcc-help <gcc-help at gcc dot gnu dot org>
- Date: Mon, 1 Jul 2013 23:46:24 +0100
- Subject: Re: Can't use -flto with -std=c99
- References: <20130701151543 dot 716b0b75 at t500>
On 1 July 2013 20:15, Mac Mollison wrote:
> Without the -std=c99 flags, make runs successfully and without warnings.
I don't think your program is valid C99 code (even ignoring the fact
your main() has the wrong return type).
If a C99 function is declared inline (and not extern) then it is an
inline definition, and will not be used for calls to that function
from other translation units, so you need to declare it as extern or
define it in every translation unit that calls it.
GNU C90 inline functions have different semantics to C99 inline functions:
"When an inline function is not static, then the compiler must assume
that there may be calls from other source files; since a global symbol
can be defined only once in any program, the function must not be
defined in the other source files, so the calls therein cannot be
integrated. Therefore, a non-static inline function is always compiled
on its own in the usual fashion. "
http://gcc.gnu.org/onlinedocs/gcc/Inline.html#Inline