/ linux Public
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <email@example.com> Cc: Linus Torvalds <firstname.lastname@example.org> Cc: Geert Uytterhoeven <email@example.com> Cc: "H. Peter Anvin" <firstname.lastname@example.org> Cc: Cong Wang <email@example.com> Cc: Hugh Dickins <firstname.lastname@example.org> Signed-off-by: Andrew Morton <email@example.com> Signed-off-by: Linus Torvalds <firstname.lastname@example.org>
- Loading branch information
Showing 1 changed file with 7 additions and 0 deletions.