From: Konstantin Khlebnikov Date: Tue, 29 May 2012 22:06:27 +0000 (-0700) Subject: bug: introduce BUILD_BUG_ON_INVALID() macro X-Git-Tag: v3.5-rc1~49^2~154 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=baf05aa9271bdbc07d3160035a231abc5fbd429a;p=pandora-kernel.git bug: introduce BUILD_BUG_ON_INVALID() macro Sometimes we want to check some expressions correctness at compile time. "(void)(e);" or "if (e);" can be dangerous if the expression has side-effects, and gcc sometimes generates a lot of code, even if the expression has no effect. This patch introduces macro BUILD_BUG_ON_INVALID() for such checks, it forces a compilation error if expression is invalid without any extra code. [Cast to "long" required because sizeof does not work for bit-fields.] Signed-off-by: Konstantin Khlebnikov Cc: Linus Torvalds Cc: Geert Uytterhoeven Cc: "H. Peter Anvin" Cc: Cong Wang Cc: Hugh Dickins Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Reading git-diff-tree failed