Forum: ARM programming with GCC/GNU tools 4.2.2: C99 inline functions are not supported; using GNU89

Author: Thomas Schulte (1stern)
Posted on:

Rate this post
0 useful
not useful

I am using now the WinArm Version with gcc 4.2.2.

I am getting the message
"C99 inline functions are not supported; using GNU89"

This did not appear with WinArm gcc 4.1.2 (Vista).

Any idea what I have to do??

Thanks indeed.

Author: Clifford Slocombe (clifford)
Posted on:

Rate this post
0 useful
not useful
inline functions are defined by the ISO C99 and C++ standards, but not
ISO C89 or C90. GNU89 is the default mode for GCC and means (quoting
from the manual): "ISO C90 plus GNU extensions (including some C99
features)". Now those C99 features include the 'inline' keyword, so it
should work, however the extensions are switched off is -ansi is used.

When the -ansi switch is used the _inline_ keyword works as an
extension (the ISO standard allows compiler extensions indicated by the
double-underscore prefix).

It is always a good idea to actually post your build log - then we can
see the exact message you see and how you invoked the compiler - usually
quicker than educated (or sometimes wild) guesses. For example it is not
clear whether this is an warning or error message. I am using 4.1.1 so
am not in a position to verify your observation, but that would not be
possible in any case without knowing what compiler options you used.

Of course you could always just read the manual! ;-)

I suggest that you use -std=c99 and remove any -ansi switch.


Author: Clifford Slocombe (clifford)
Posted on:

Rate this post
0 useful
not useful
The advice I posted above is probably inaccurate. I looked into this
further. Inline functions in GCC 4.2 (and all previous versions) do not
match C99 semantics. I guess in this version they decided to make this
explicit with a warning. C99 compliance is planned for 4.3. Again from
the manual:

In other words it always only ever applied GNU89 semantics but now it is
warning you about it.

I assume that using _inline_ will not generate a warning since as a
GNU extension keyword it makes no promises about C99 compliance. Of
course it may not then port to non-GNU compilers, but a simple macro
could fix that.

The issue is that inline code can only be in-lined by GCC 4.2 and
earlier if it is defined in the same compilation unit in which it is
called. To share inline code between compilation units requires a
two-way cooperation between the linker and the compiler. The only
solution for inter-module inlining is to place the inline code in a

Note that in-lining only occurs when optimisation is used, and even then
the optimiser may choose to ignore the request, and even inline
functions you did not request to inline. You have to use
__attribute__((always_inline)); to force in-lining regardless.

I would suggest that you not try to second-guess the optimiser and just
let it do its job by removing inline requests. Then the problem also
goes away. ;-)


Author: Clifford Slocombe (clifford)
Posted on:

Rate this post
0 useful
not useful
Heh! :-/ I should take my own advice and read the manual!

The option -fgnu89-inline explicitly disables the warning. In 4.3 it
will also force GNU89 inline semantics, until then you get no choice in
any case.

Sorry if I have added to your confusion.



Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]

Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.