Houston, we have warnings.
Rob Landley
rob at landley.net
Thu Dec 15 07:44:19 UTC 2005
On Tuesday 13 December 2005 12:45, Yann E. MORIN wrote:
> Hello all!
> Rob,
>
> On Tuesday 13 December 2005 050, Rob Landley wrote:
> > /home/landley/busybox/busybox/modutils/modprobe.c: In function
> > `build_dep': /home/landley/busybox/busybox/modutils/modprobe.c:502:
> > warning: implicit declaration of function `parse_command_string'
> > /home/landley/busybox/busybox/modutils/modprobe.c:502: warning:
> > assignment makes pointer from integer without a cast
>
> When MODPROBE_MULTIPLE_OPTIONS is not selected, then `parse_command_string'
> does not get declared, and the call to this function is conditionned by a
> if(ENABLE) statement. This if() is optimised away by the compiler, and thus
> at link time the symbol is no longer un-resolved (as it does no longer
> exist).
>
> It is not the proper way to solve the problem: we must enclose this call
> with #ifdef ENABLE rather than a mere if(ENABLE).
>
> Patch attached.
Hmmm, that should almost never actually be _required_. The only reason we do
the #if around the static declarations in the first place is that GCC is too
_blitheringly_ stupid to realize that if a function is static, and never
called from anywhere in this file, then you don't actually have to link a
copy of that function's code in the final executable. (Really. You don't.
It can't be called, ever, from anywhere.)
The warnings generally come from mixing if(GUARD) and #if GUARD. Consistently
use one or the other and you don't have to do anything special. Not that
this is always an option quite yet. (Hopefully, gcc 4.1 or so will get a
clue and we can consistently use if(GUARD) and yank more #ifdefs.) In the
meantime, we can just feed something in the #else case to get it to shut up.
I just checked the fix I prefer in (svn 12892) so you can see what I'm talking
about.
You know, when you bzip patches I have to save them to the hard drive and
extract them before I can look at them. Bit of a pain. (I realize this is a
kmail limitation, but still...)
And now, bedtime.
> Regards,
> Yann E. MORIN.
Rob
--
Steve Ballmer: Innovation! Inigo Montoya: You keep using that word.
I do not think it means what you think it means.
More information about the busybox
mailing list