[Bug 3097] BB making easily-fixed non-portable assumptions

Joakim Tjernlund joakim.tjernlund at transmode.se
Mon Feb 7 19:10:48 UTC 2011


>
> On Mon, Feb 07, 2011 at 02:01:13PM +0000, bugzilla at busybox.net wrote:
> > https://bugs.busybox.net/show_bug.cgi?id=3097
> >
> > Denys Vlasenko <vda.linux at googlemail.com> changed:
> >
> >            What    |Removed                     |Added
> > ----------------------------------------------------------------------------
> >              Status|NEW                         |RESOLVED
> >          Resolution|                            |FIXED
> >
> > --- Comment #7 from Denys Vlasenko <vda.linux at googlemail.com>  ---
> > I incorporated sys/sysmacros.h and fdprintf fixes. Thanks!
>
> Thanks!
>
> Note that the defined(_POSIX_VERSION) you added is redundant:
>
> +#if (defined(_POSIX_VERSION) && _POSIX_VERSION >= 200809L) || defined(__GLIBC__)
>
> Undefined preprocessor symbols evaluate to 0 in #if directives, so if
> it's undefined, _POSIX_VERSION >= 200809L is evaluated as 0 >= 200809L
> and thus is false.

Relying on undef -> 0 is dangerous. Much better build with -Wundef
and fixup the errors.

 Jocke



More information about the busybox mailing list