This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Can't use -flto with -std=c99


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]