diff options
author | Konstantin Khlebnikov <khlebnikov@openvz.org> | 2012-05-29 15:06:27 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-29 16:22:20 -0700 |
commit | baf05aa9271bdbc07d3160035a231abc5fbd429a (patch) | |
tree | 201c4f1df332fa2baef4ddfeda6806faf9e2dbc8 /include/linux/mmdebug.h | |
parent | 5febcbe99d4766cc383909c447e002e63d8b4592 (diff) | |
download | lwn-baf05aa9271bdbc07d3160035a231abc5fbd429a.tar.gz lwn-baf05aa9271bdbc07d3160035a231abc5fbd429a.zip |
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 <khlebnikov@openvz.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Cong Wang <xiyou.wangcong@gmail.com>
Cc: Hugh Dickins <hughd@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/mmdebug.h')
0 files changed, 0 insertions, 0 deletions