C99 inlines

David Schultz das at FreeBSD.ORG
Sat Mar 7 02:27:32 PST 2009


I'd like the gcc in our tree to use the C99 semantics instead of GNU
semantics for inline functions in C99 and GNU99 mode. The following
patch implements this behavior.  It is based on a snapshot of the gcc
4.3 branch from March 2007, prior to the GPLv3 switch.

    http://www.freebsd.org/~das/c99inline.diff

I ran the inline function regression tests from the latest gcc
snapshot and fixed two bugs. All the tests pass now, except that
programs that bogusly try to instantiate an extern definition of an
inline function inside another function cause an ICE.

The object files produced by buildworld on amd64 in gnu89 mode are
identical with and without this patch (excepting things like OpenSSL
that include the compilation time in the binary), so it should be safe
for the base system. (One small bugfix in lib/msun and one change in
reiserfs are required to make universe without errors.)

Ports may be affected if they are compiled with -std=c99 or -std=gnu99
and they're not actually prepared to handle it. The patch also enables
some additional error checking (e.g., gcc now complains about inline
functions that are declared but never defined), so that could lead to
a few build errors. I expect that any port that fails as a result of
this patch would fail under gcc 4.3.0 anyway. I'll try to coordinate
with portmgr if it looks like there are major issues.

What do people think about this?


More information about the freebsd-arch mailing list