BUILD_BUG_ON(9) break compile if a condition is true.

SYNOPSIS

BUILD_BUG_ON(condition);

ARGUMENTS

condition

the condition which the compiler should know is false.

DESCRIPTION

If you have some code which relies on certain constants being equal, or other compile-time-evaluated condition, you should use BUILD_BUG_ON to detect if someone changes it.

The implementation uses gcc's reluctance to create a negative array, but gcc (as of 4.4) only emits that error for obvious cases (eg. not arguments to inline functions). So as a fallback we use the optimizer; if it can't prove the condition is false, it will cause a link error on the undefined "__build_bug_on_failed". This error message can be harder to track down though, hence the two different methods.

COPYRIGHT