[RFC] Kernel patches for compilation with gcc 4.0
John Baldwin
jhb at FreeBSD.org
Fri Aug 5 17:06:50 GMT 2005
On Friday 05 August 2005 12:22 pm, Craig Rodrigues wrote:
> 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
Ok. I thought I had recalled something about that but wasn't sure.
> > 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....
Ok, given that, I'd rather remove -Wredundant_decls than break perfectly legal
code. It would be nice if there was a -Wredundant_decls_that_actually_works
> > 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
Looks like this is indicative of another error. There are two different
M_IPMADDR malloc buckets. The IPv6 one should probably be called M_IP6MADDR
instead.
netinet/in.c:static MALLOC_DEFINE(M_IPMADDR, "in_multi", "internet multicast
address");
netinet6/in6.c:MALLOC_DEFINE(M_IPMADDR, "in6_multi", "internet multicast
address");
--
John Baldwin <jhb at FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve" = http://www.FreeBSD.org
More information about the freebsd-arch
mailing list