[Toybox] [PATCH] Shut up GCC 3.4 on musl
ibid.ag at gmail.com
ibid.ag at gmail.com
Sat Jan 25 22:18:18 PST 2014
On Sat, Jan 25, 2014 at 08:20:58PM -0600, Rob Landley wrote:
> On 01/25/2014 07:52 PM, Isaac Dunham wrote:
> >Two changes to shut up GCC:
> >* __GLIBC__ was checked unconditionally;
> >this made for a very messy build on musl.
>
> According to my C99 draft section 6.10.1.3:
>
> After all replacements due to macro expansion and the defined unary
> operator have been performed, all remaining identifiers are replaced
> with the pp-number 0, and then each preprocessing token is converted
> into a token.
>
> That seems like a broken compiler? Still, portability.h is the place
> to workaround that kind of breakage. But I'd prefer to isolate it to
> its own stanza that blames the right thing so when we no longer care
> about gcc 3.4 know to remove it instead of having Magic Thing.
>
I don't know if it's standards-conformant or not, but GCC 4.4 does the
same when I use musl-gcc. I haven't checked a more recent GCC.
Sample (CC=/opt/musl/bin/musl-gcc scripts/single.sh cat):
scripts/make.sh
Make generated/config.h from .singleconfig.
Extract configuration information from toys/*.c files...
Generate headers from toys/*/*.c...
generated/newtoys.h generated/flags.h generated/globals.h generated/help.h
Library probe...
Compile toybox...
In file included from toys.h:8,
from main.c:6:
lib/portability.h:148:52: warning: "__GLIBC__" is not defined
In file included from ./toys.h:8,
from lib/args.c:6:
./lib/portability.h:148:52: warning: "__GLIBC__" is not defined
In file included from ./toys.h:8,
from lib/bunzip.c:12:
./lib/portability.h:148:52: warning: "__GLIBC__" is not defined
In file included from ./toys.h:8,
from lib/dirtree.c:6:
./lib/portability.h:148:52: warning: "__GLIBC__" is not defined
In file included from ./toys.h:8,
from lib/getmountlist.c:6:
./lib/portability.h:148:52: warning: "__GLIBC__" is not defined
In file included from ./toys.h:8,
from lib/help.c:3:
./lib/portability.h:148:52: warning: "__GLIBC__" is not defined
In file included from ./toys.h:8,
from lib/lib.c:6:
./lib/portability.h:148:52: warning: "__GLIBC__" is not defined
In file included from ./toys.h:8,
from lib/llist.c:6:
./lib/portability.h:148:52: warning: "__GLIBC__" is not defined
In file included from ./toys.h:8,
from lib/net.c:1:
./lib/portability.h:148:52: warning: "__GLIBC__" is not defined
In file included from ./toys.h:8,
from lib/password.c:6:
./lib/portability.h:148:52: warning: "__GLIBC__" is not defined
In file included from ./toys.h:8,
from lib/pending.c:6:
./lib/portability.h:148:52: warning: "__GLIBC__" is not defined
In file included from ./toys.h:8,
from lib/portability.c:7:
./lib/portability.h:148:52: warning: "__GLIBC__" is not defined
In file included from ./toys.h:8,
from lib/xregcomp.c:9:
./lib/portability.h:148:52: warning: "__GLIBC__" is not defined
In file included from ./toys.h:8,
from lib/xwrap.c:10:
./lib/portability.h:148:52: warning: "__GLIBC__" is not defined
In file included from ./toys.h:8,
from toys/posix/cat.c:20:
./lib/portability.h:148:52: warning: "__GLIBC__" is not defined
(IIRC, uclibc defined __GLIBC__ for "compatability" reasons...)
> I'll do some variant of:
>
> #ifdef gcc 3.4
> #ifndef _GLIBC_
> #define _GLIBC_ 0
> #endif
> #endif
>
>
> >* int fd in chvt is always initialized; GCC 3.4 does not recognize this.
>
> That's also a broken compiler, but I'm already doing the "int x =
> x;" trick in several places to shut gcc's brain damage up, so that's
> not new evil...
Appears to be GCC 3.x but not 4.x (at least for x !< 1).
> Rob
Thanks,
Isaac Dunham
1390717098.0
More information about the Toybox
mailing list