[RFC] Kernel patches for compilation with gcc 4.0

John Baldwin jhb at FreeBSD.org
Fri Aug 5 14:49:14 GMT 2005


On Wednesday 03 August 2005 04:01 pm, Craig Rodrigues wrote:
> Hi,
>
> I installed gcc version 4.0.2 20050721 (prerelease) [FreeBSD]
> from ports and tried to compile the kernel using a LINT config file on
> i386.
>
> I had to apply these patches:
> http://people.freebsd.org/~rodrigc/fbsd.makefiles.diff.txt
>
> to the kernel makefile rules because "-I-" is removed from gcc 4.0,
> and "-fformat-extensions" is a FreeBSD extension to GCC which is not
> in the ports version of the compiler.
>
> I had to apply these patches to the source code to eliminate errors:
>
> http://people.freebsd.org/~rodrigc/fbsd.kernel.gcc40.diffs.txt
>
> Mostly I fixed cases like this:
>
> extern struct foo bar;
> static struct foo bar = {     };
>
> In ISO C, it is illegal to define a struct with external linkage,
> and then internal linkage.  GCC 3.x allows it, but GCC 4.x flags it as an
> error.
>
> Also, if you do:
> static struct foo bar;
> static struct foo bar = {    };
>
> then the -Wredundant-decls flag in the kernel makefile will issue
> a warning.
>
> Can someone provide feedback on the kernel patches?
> Thanks.

It would be really nice to not have to add a bunch of (caddr_t) casts.

You need to get the acpi_wakeup changes reviewed.  Not saving the gdt and idt 
descriptors across suspend/resume would be very disastrous.

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.

Why did you move MALLOC_DECLARE out of in6_var.h?

-- 
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