toolchain: Add nonnull attribute
Add a new macro for __attribute__((nonnull))). This attribute
allows functions to declare which parameters shouldn't be null.
This helps to catch errors like:
void test(void *a, void *b, void *c) __attribute_nonnull(1, 3);
/zephyrproject/zephyr/samples/hello_world/src/main.c:28:9: warning:
argument 3 null where non-null expected [-Wnonnull]
28 | test(a, NULL, NULL);
| ^~~~
Signed-off-by:
Flavio Ceolin <flavio.ceolin@intel.com>
Loading
Please sign in to comment