Skip to content
Commit 9e59a2f3 authored by Henrik Brix Andersen's avatar Henrik Brix Andersen Committed by Carles Cufí
Browse files

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: default avatarHenrik Brix Andersen <hebad@vestas.com>
parent ef909b9a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment