Both gcc and clang can use compiler hints to catch null passed as an argument to a function. This macro allows ODP APIs to take advantage of this feature.
Signed-off-by: Mike Holmes <[email protected]> --- See also http://clang-analyzer.llvm.org/annotations.html#generic platform/linux-generic/include/api/odp_hints.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/platform/linux-generic/include/api/odp_hints.h b/platform/linux-generic/include/api/odp_hints.h index 7f04886..42b57f1 100644 --- a/platform/linux-generic/include/api/odp_hints.h +++ b/platform/linux-generic/include/api/odp_hints.h @@ -32,6 +32,12 @@ extern "C" { #define ODP_WEAK_SYMBOL __attribute__((__weak__)) /** + * Where an API should not be passed a NULL pointer, provide static analysers + * a hint to help catch transgressions. + */ +#define ODP_NONNULL(...) __attribute__((__nonnull__(__VA_ARGS__))) + +/** * Hot code section */ #define ODP_HOT_CODE __attribute__((__hot__)) -- 2.1.0 _______________________________________________ lng-odp mailing list [email protected] http://lists.linaro.org/mailman/listinfo/lng-odp
