Can't use -flto with -std=c99

Jonathan Wakely
Mon Jul 1 22:46:00 GMT 2013

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. "

More information about the Gcc-help mailing list