[RFC] Kernel patches for compilation with gcc 4.0
Craig Rodrigues
rodrigc at crodrigues.org
Wed Aug 3 20:01:49 GMT 2005
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.
--
Craig Rodrigues
rodrigc at crodrigues.org
More information about the freebsd-arch
mailing list