[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20091222001357.GJ25372@basil.fritz.box>
Date: Tue, 22 Dec 2009 01:13:57 +0100
From: Andi Kleen <andi@...stfloor.org>
To: Rusty Russell <rusty@...tcorp.com.au>
Cc: Andi Kleen <andi@...stfloor.org>, torvalds@...ux-foundation.org,
linux-kernel@...r.kernel.org, jbeulich@...ell.com,
rguenther@...e.de, arnd@...db.de
Subject: Re: [PATCH] Fix BUILD_BUG_ON in fs/compat_ioctl.c to build with
gcc 4.5 snapshot
> No, it's solving the same problem, generically. There are numerous places
> where we want to use BUILD_BUG_ON() but we don't have a constant expression.
> Look for MAYBE_BUILD_BUG_ON().
Ok so you're saying that should be just a MAYBE_BUILD_BUG_ON()?
>
> Subject: BUILD_BUG_ON: make it handle more cases
>
> BUILD_BUG_ON used to use the optimizer to do code elimination or fail
> at link time; it was changed to first the size of a negative array (a
> nicer compile time error), then (in
> 8c87df457cb58fe75b9b893007917cf8095660a0) to a bitfield.
>
> bitfields: needs a literal constant at parse time, and can't be put under
> "if (__builtin_constant_p(x))" for example.
> negative array: can handle anything, but if the compiler can't tell it's
> a constant, silently has no effect.
> link time: breaks link if the compiler can't determine the value, but the
> linker output is not usually as informative as a compiler error.
>
> If we use the negative-array-size method *and* the link time trick,
> we get the ability to use BUILD_BUG_ON() under __builtin_constant_p()
> branches, and maximal ability for the compiler to detect errors at
> build time.
Ok maybe that works, but we need a fix for 2.6.33 too.
-Andi
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists