Re: gcc-3.4.1 and -Winline

From: John Cherry
Date: Fri Jun 25 2004 - 09:57:09 EST


"J.A. Magallon" wrote:
>
> This are the warnings I get with gcc-3.4.1 CVS, when building
2.6.7-mm2.
> Just for if some is really serious, ie, something that does not work
if
> compiled out-of-line (but I suppose I had noticed ;) ).
> Or if it origins a huge performace penalty.
[...]
>
> CC arch/i386/kernel/timers/timer_tsc.o
> arch/i386/kernel/timers/timer_tsc.c: In function `mark_offset_tsc':
> arch/i386/kernel/timers/timer_tsc.c:30: warning: inlining failed in
call to \
> 'cpufreq_delayed_get': function body not available \
> arch/i386/kernel/timers/timer_tsc.c:248: warning: called from here
[... more warnings deleted for brevity ...]

Well, gcc 3.2.2 with -Winline does not complain, but interestingly
enough sparse does (at least in the above case and some others):

CHECK arch/i386/kernel/timers/timer_tsc.c
arch/i386/kernel/timers/timer_tsc.c:30:39: warning: marked inline, but without a definition

Basically this is a case of having:
#1: static inline void foo(void); /* forward decl without body */
...
#2: void bar(void) { foo(); } /* function using the inline */
...
#3: static inline void foo(void) { return; } /* actual inline def. */
in the above order.

I have not looked at resulting .o file with gcc 3.2.2, but would not be too
surprised if it also silently just ignores the "inline" in lines #1 and #3 above.

There are obviously two trivial fixes above, either just remove the inline (making
foo a normal static function) or reorder #2 and #3.

John


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/