include: zephyr: sys: util: add is_null_no_warn() utility function
Some macros may need to check their arguments against NULL to support multiple use-cases, but NULL checks can generate warnings for a given use of those macros (where that particular argument can never be NULL). This can happen if: a) all macros are expanded (e.g. when using CONFIG_COMPILER_SAVE_TEMPS=y) or b) tracking of macro expansions are turned off (-ftrack-macro-expansion=0) This warning can be circumvented by passing the argument to be check to an inlined function for doing the NULL check. The compiler is still able to optimize this out at a later stage. Move the private ___is_null() helper function introduced in d51f8741 to include/zephyr/sys/utils.h and rename it to is_null_no_warn() to facilitate reuse. Signed-off-by:Henrik Brix Andersen <hebad@vestas.com>
Loading
Please sign in to comment