[RFC] Kernel patches for compilation with gcc 4.0

Craig Rodrigues rodrigc at crodrigues.org
Fri Aug 5 16:22:35 GMT 2005


On Fri, Aug 05, 2005 at 10:49:25AM -0400, John Baldwin wrote:
> You need to get the acpi_wakeup changes reviewed.  Not saving the gdt and idt 
> descriptors across suspend/resume would be very disastrous.

I sent a separate e-mail to njl@ and marks@ about the acpi_wakeup patch.
The patch was suggested to me by kan at .  He suggested that
I remove the static variables which clashed with the global variables
of the same name, and to remove asm calls which saved them in acpi_wakeup.c

> I think it is a mistake to make static structures like th0 non-static to 
> workaround -Wredundant-decls.  Get gcc to fix -Wredundant-decls instead if at 
> all possible.  kern_tc.c is an example of this type of change.  rtsock.c 
> probably is, too.

This behavior in GCC seems to have been there for a long time
(I can reproduce it with 2.95, 3.4, and 4.0).  I can ask the GCC people
about this.  The other alternative is to remove -Wredundant-decls
from the kernel Makefiles.  I asked why we use -Wredundant-decls, because
it seems to warn against legal C code:

http://lists.freebsd.org/pipermail/freebsd-current/2005-August/053708.html

I'm not enough of a C guru to know....

> Why did you move MALLOC_DECLARE out of in6_var.h?


Because I got this compiler error in in.c :

gcc40 -c -O -pipe  -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes  -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual  -std=c99 -g -nostdinc  -I. -I../../.. -I../../../contrib/dev/acpica -I../../../contrib/altq -I../../../contrib/ipfilter -I../../../contrib/pf -I../../../contrib/dev/ath -I../../../contrib/dev/ath/freebsd -I../../../contrib/ngatm -I../../../dev/twa -D_KERNEL -include opt_global.h -fno-common -finline-limit=8000 --param inline-unit-growth=100 --param large-function-growth=1000  -mpreferred-stack-boundary=2  -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -ffreestanding -Werror  ../../../netinet/in.c
../../../netinet/in.c:54: error: static declaration of 'M_IPMADDR' follows non-static declaration
../../../netinet6/in6_var.h:479: error: previous declaration of 'M_IPMADDR' was here
*** Error code 1


-- 
Craig Rodrigues        
rodrigc at crodrigues.org


More information about the freebsd-arch mailing list