[igt-dev] [PATCH i-g-t v3 01/21] lib: Introduce BUILD_BUG_ON_INVALID and igt_assume()

Chris Wilson chris at chris-wilson.co.uk
Mon Jan 21 11:41:20 UTC 2019


Quoting Petri Latvala (2019-01-21 11:33:38)
> BUILD_BUG_ON_INVALID() is a macro that, like the kernel counterpart,
> expands to an expression that generates no code. Useful for making
> sure an expression is valid code while producing no side effects.
> 
> igt_assume() is an assert-like macro that is used to give hints to
> static analysis of code. If static analysis is not used (as detected
> by STATIC_ANALYSIS_BUILD), igt_assume() expands to a
> BUILD_BUG_ON_INVALID, otherwise expands to an assert().
> 
> v2: Make sure the expression in igt_assume is still parsed without
>     static analysis. (Chris)
> 
> v3: Also introduce BUILD_BUG_ON_INVALID as standalone
> 
> Signed-off-by: Petri Latvala <petri.latvala at intel.com>
> Cc: Arkadiusz Hiler <arkadiusz.hiler at intel.com>
> Cc: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: MichaƂ Winiarski <michal.winiarski at intel.com>
Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
-Chris


More information about the igt-dev mailing list