I tried building world with base gcc, and one of the parts that fails is
stand/, with several different types of errors.
The first type of error is:
cc1: warnings being treated as errors /usr/src/stand/i386/gptboot/gptboot.c: In function 'main': /usr/src/stand/i386/gptboot/gptboot.c:258: warning: declaration of 'autoboot' shadows a global declaration /usr/src/stand/common/bootstrap.h:64: warning: shadowed declaration is here
This is because the autoboot() function is now declared in
bootstrap.h, and several boot loaders use autoboot also as a local
variable. To minimize churn, I propose to make the autoboot()
function static for stand/common/boot.c, since there are no external
callers. Alternatively, it can be renamed to autoboot_actual(), or
something like that.
The second error is:
cc1: warnings being treated as errors /usr/src/stand/userboot/userboot/main.c: In function 'extract_currdev': /usr/src/stand/userboot/userboot/main.c:170: warning: dereferencing type-punned pointer will break strict-aliasing rules
gcc is right here, it *is* dereferencing it, so let's just insert a
plain memcpy instead.
The third type of error is:
/usr/bin/gcc -O2 -pipe -I/usr/src/stand/i386/btx/lib -nostdinc -I/usr/obj/usr/src/amd64.amd64/stand/libsa32 -I/usr/src/stand/libsa -D_STANDALONE -I/usr/src/sys -Ddouble=jagged-little-pill -Dfloat=floaty-mcfloatface -DLOADER_GELI_SUPPORT -I/usr/src/stand/geli -DLOADER_DISK_SUPPORT -m32 -mcpu=i386 -ffreestanding -mno-mmx -mno-sse -msoft-float -march=i386 -I. -DBOOTPROG=\"gptboot\" -O1 -DGPT -DUFS1_AND_UFS2 -DSIOPRT=0x3f8 -DSIOFMT=0x3 -DSIOSPD=9600 -I/usr/src/stand/common -I/usr/src/stand/i386/common -I/usr/src/stand/i386/boot2 -Wall -Waggregate-return -Wbad-function-cast -Wno-cast-align -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings -Winline -Wno-pointer-sign -g -std=gnu99 -Wsystem-headers -Werror -Wno-pointer-sign -mpreferred-stack-boundary=2 --param max-inline-insns-single=100 -c /usr/src/stand/i386/gptboot/gptboot.c -o gptboot.o `-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead. cc1: warnings being treated as errors /usr/src/sys/geom/eli/g_eli.h: In function 'geli_taste': /usr/src/sys/geom/eli/g_eli.h:339: warning: inlining failed in call to 'eli_metadata_decode_v0': --param max-inline-insns-single limit reached /usr/src/sys/geom/eli/g_eli.h:400: warning: called from here /usr/src/sys/geom/eli/g_eli.h:365: warning: inlining failed in call to 'eli_metadata_decode_v1v2v3v4v5v6v7': --param max-inline-insns-single limit reached /usr/src/sys/geom/eli/g_eli.h:409: warning: called from here /usr/src/sys/geom/eli/g_eli.h:339: warning: inlining failed in call to 'eli_metadata_decode_v0': --param max-inline-insns-single limit reached /usr/src/sys/geom/eli/g_eli.h:400: warning: called from here /usr/src/sys/geom/eli/g_eli.h:365: warning: inlining failed in call to 'eli_metadata_decode_v1v2v3v4v5v6v7': --param max-inline-insns-single limit reached /usr/src/sys/geom/eli/g_eli.h:409: warning: called from here *** Error code 1 Stop. make[2]: stopped in /usr/src/stand/i386/gptboot *** Error code 1
This is gcc warning us that it failed to inline, but I fail to see the
value of this warning. Do we really care, and is it absolutely critical
that this function is inlined? If so, it is better to mark the function
as __forceinline, if old gcc supports that. But I'd like to propose
getting rid of -Winline instead, there is no useful information in
these warnings.
The fourth type of error is:
cc1: warnings being treated as errors /usr/src/stand/libsa/cd9660read.c: In function 'cd9660_lookup': /usr/src/stand/libsa/cd9660read.c:176: warning: 'len' may be used uninitialized in this function /usr/src/stand/libsa/cd9660read.c:176: note: 'len' was declared here
Here base gcc's compile-time analysis is too dumb to realize that len
can never be used, but let's initialize it to zero just in case.