[PATCH] serial/atmel_serial: Fix another fallout of the change to BUILD_BUG_ON

Rusty Russell rusty at rustcorp.com.au
Mon Oct 19 10:32:29 EDT 2009


On Mon, 19 Oct 2009 06:49:40 pm Jan Beulich wrote:
> >>> Rusty Russell <rusty at rustcorp.com.au> 19.10.09 08:08 >>>
> >How's this?  It's not quite valid C, but it "works":
> 
> But that's not what you proposed initially, i.e. generating a link time
> error if a compile time error can't be generated (and only if even a link
> time error isn't possible, a run time one should be forced).

Yeah, this was cleverer.  A compile time is nicer than link time.  And this
is *actually* what I want: a compile fail if the compiler knows enough, runtime
otherwise.

> And btw., why do you think this isn't valid C?

From my glance at ISO C, non-positive sized variable length arrays are
invalid.  gcc here seems to give the expected results (eg. sizeof gives
a negative result).

Cheers,
Rusty.



More information about the linux-arm-kernel mailing list