Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Aug 2005 16:01:43 -0400
From:      Craig Rodrigues <rodrigc@crodrigues.org>
To:        freebsd-arch@freebsd.org
Subject:   [RFC] Kernel patches for compilation with gcc 4.0
Message-ID:  <20050803200143.GA70735@crodrigues.org>

next in thread | raw e-mail | index | archive | help
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@crodrigues.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050803200143.GA70735>