Diff below converts the kernel to build with -std=gnu99. (For simplicity, I've only included amd64 for now, but I'll make the same change to all kernel Makefiles if this is ok.)
The only incompatibility (that I'm aware of) is that ISO C99's inline semantics differ slightly from GNU C89's historical (but non-standard) inline semantics, but I believe the diff below keeps us consistent with the semantics the kernel currently assumes. (More details below.) I've tested on amd64 and I get the exact same .o files with or without this change (except vers.o, but only because of timestamping). It's probably worth conducting the same test on one of our GCC 3 architectures. ok? Boring standards details: GNU89 and C99 define "static inline" to have the same semantics, but they differ for non-static definitions. In particular, C99 introduces the concept of "inline definitions" so that it can allow non-static inline functions to be defined in headers and used across multiple translation units without causing the function to be receive an external definition in each object file. GNU89 requires "static inline" for inline functions in header files, but then you can end up with multiple static definitions of the function if it's not inlined everywhere. That might seem scary for silently introducing incompatibilities, but "fortunately" GCC 3.3 and 4.2 don't support C99 inline semantics anyway (they always use GNU89 inline), and GCC 4.2 unconditionally emits a warning if it sees code that would be compiled differently under C99 semantics. For newer compilers that do support C99 inline, -fgnu89-inline forces the legacy GNU89 semantics while also silencing the GCC 4.2 warning. Index: Makefile.amd64 =================================================================== RCS file: /home/matthew/cvs-mirror/cvs/src/sys/arch/amd64/conf/Makefile.amd64,v retrieving revision 1.59 diff -u -p -r1.59 Makefile.amd64 --- Makefile.amd64 8 May 2014 17:59:28 -0000 1.59 +++ Makefile.amd64 8 Jul 2014 17:41:49 -0000 @@ -39,8 +39,13 @@ CMACHFLAGS+= -fno-stack-protector CMACHFLAGS+= -Wa,-n .endif +CSTD= -std=gnu99 +.if ${COMPILER_VERSION} != gcc3 +CSTD+= -fgnu89-inline +.endif + COPTS?= -O2 -CFLAGS= ${DEBUG} ${CWARNFLAGS} ${CMACHFLAGS} ${COPTS} ${PIPE} +CFLAGS= ${CSTD} ${DEBUG} ${CWARNFLAGS} ${CMACHFLAGS} ${COPTS} ${PIPE} AFLAGS= -D_LOCORE -x assembler-with-cpp ${CWARNFLAGS} ${CMACHFLAGS} LINKFLAGS= -Ttext 0xffffffff810001e0 -e start --warn-common -nopie