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