Files
kernel-tenderloin-3.0/include/linux
Rusty Russell 7ef88ad561 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
8c87df457c) 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>
2011-01-24 14:45:10 +10:30
..
2011-01-12 14:37:42 +09:00
2011-01-20 18:30:17 -08:00
2011-01-20 18:30:17 -08:00
2010-11-23 20:14:46 +00:00
2011-01-10 08:51:44 -08:00
2011-01-15 20:07:45 -05:00
2011-01-13 08:03:12 -08:00
2010-12-13 16:11:13 -08:00
2010-11-29 08:35:12 +11:00
2010-12-16 17:53:38 +01:00
2011-01-10 08:51:44 -08:00
2011-01-12 20:16:43 -05:00
2011-01-17 03:26:26 -05:00
2010-12-08 10:30:34 -08:00
2011-01-10 08:51:44 -08:00
2011-01-07 17:50:27 +11:00
2011-01-07 17:50:23 +11:00
2010-12-07 20:16:56 +01:00
2011-01-10 07:38:53 -08:00
2010-11-15 22:40:38 +01:00
2011-01-10 22:11:23 +01:00
2010-11-16 10:58:30 -08:00
2010-11-24 11:16:42 -08:00
2011-01-21 11:55:31 +01:00
2010-12-09 20:17:07 -08:00
2011-01-13 17:32:31 -08:00
2011-01-13 17:32:47 -08:00
2010-12-22 10:27:53 +01:00
2011-01-14 13:12:45 +00:00
2010-12-06 11:03:46 -08:00
2011-01-13 17:32:41 -08:00
2011-01-13 17:32:46 -08:00
2011-01-13 17:32:43 -08:00
2011-01-16 13:47:07 -05:00
2011-01-13 21:44:34 -08:00
2011-01-10 15:40:52 -05:00
2011-01-13 17:32:43 -08:00
2011-01-16 13:47:07 -05:00
2010-12-16 11:36:43 +01:00
2010-12-24 15:04:41 +01:00
2010-12-10 15:06:43 +01:00
2011-01-13 08:03:21 -08:00
2011-01-14 02:36:43 +00:00
2010-11-15 13:24:06 -05:00
2011-01-13 08:03:18 -08:00
2011-01-13 17:32:42 -08:00
2010-12-13 22:48:21 +01:00
2011-01-13 17:32:43 -08:00
2011-01-10 09:46:24 +11:00
2011-01-07 17:50:27 +11:00
2011-01-13 08:03:19 -08:00
2011-01-13 17:32:42 -08:00
2011-01-12 05:14:15 -05:00
2011-01-13 08:03:20 -08:00
2010-11-29 08:55:25 +11:00
2010-11-29 08:55:22 +11:00
2011-01-07 20:57:22 -05:00
2010-12-20 09:37:33 +01:00
2010-12-16 10:05:06 -08:00
2010-11-15 13:25:02 -05:00
2011-01-13 08:03:24 -08:00