Erik Christiansen wrote:
On Wed, Oct 28, 2009 at 02:08:05PM +0100, Joerg Desch wrote:
I've played with "inline" and with "__attribute__((gnu_inline,
always_inline))" to avoid this overhead, but it doesn't work as expected.
#if defined(__GNUC__)
# define ALLWAYS_INLINE inline __attribute__((gnu_inline, always_inline))
#endif
ALLWAYS_INLINE int foo (void)
{
// ...
}
I've tried it with -Os and foo() is still called.
Was this from a mail from Joerg Desch that did not make it to the
mailing list? It is hard for others to comment - perhaps you or Joerg
could re-post the problem code.
Ah, yes, optimisation needs to be used for inline to work. If the above
fails on a small test case, "avr-gcc -v" and the command-line don't show
a lurking "-fno-inline", and "-Wall -Wextra" doesn't provide any clues
either, I'd pretty soon be tempted to report it as a bug, unless a magic
method is revealed on the list. You've probably tried other
optimisations? (Just in case the size optimisation is absolute in its
approach.)
I believe you need the -Winline to get a warning about functions
declared "inline" that could not be inlined.
And an __attribute_((always_inline)) function will be inlined,
regardless of the optimisation levels.
As you can see it receives in the list. But with 1/2 hour delay.
Oh goody, it works again! :-)
Erik
_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list