summaryrefslogtreecommitdiffstats
path: root/include/linux/xfrm.h
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2011-01-24 14:45:10 -0600
committerRusty Russell <rusty@rustcorp.com.au>2011-01-24 14:45:10 +1030
commit7ef88ad561457c0346355dfd1f53e503ddfde719 (patch)
tree22f5e53aec61e0508f8d1aee130160fe24801144 /include/linux/xfrm.h
parent1bae4ce27c9c90344f23c65ea6966c50ffeae2f5 (diff)
downloadblackbird-obmc-linux-7ef88ad561457c0346355dfd1f53e503ddfde719.tar.gz
blackbird-obmc-linux-7ef88ad561457c0346355dfd1f53e503ddfde719.zip
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. This forced us to change some non-constant cases to MAYBE_BUILD_BUG_ON(); as Jan points out in that commit, it didn't work as intended anyway. 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. We also document it thoroughly. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Cc: Jan Beulich <JBeulich@novell.com> Acked-by: Hollis Blanchard <hollisb@us.ibm.com>
Diffstat (limited to 'include/linux/xfrm.h')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud