Re: [patch 2/7] enable unit-at-a-time optimisations for gcc4

Andi Kleen
2006-01-07T02:18:00Z

On Saturday 07 January 2006 01:20, Matt Mackall wrote:
> On Sat, Jan 07, 2006 at 01:05:16AM +0100, Andi Kleen wrote:
> > And gcc is really picky about type compatibility between source files
> > with program-at-a-time. If any types of the same symbols are
> > incompatible even in minor ways you get an ICE. That's technically
> > illegal, but tends to happen often in practice (e.g. when people
> > use extern) It might end up being quite a lot of work to clean this up.
>
> If it gave a useful error message rather than an ICE, that'd be a
> feature.

Well you can use a lint program to catch these things. Pretty much
all lints do whole program analysis for types. Perhaps it would
be a good idea to adopt one for the kernel. The best one is unfortunately
not free.

Or just never put an extern into any .c file and set some linker
options that make sure that double definitions without extern
error out (not sure that's possible, but it might be)

-Andi