From 6215978f948173184b9f8868eaefde109674e451 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Fri, 23 May 2025 12:37:42 +0200 Subject: [PATCH] (!2005) sdk: add _X_ATTRIBUTE_NONNULL_ARGS() macro Adding a macro for specifying nonnull attributes, for easier future transition to new C23 attributes or supporting strange compilers that don't understand this attribute. The purpose of using those attributes is aiding compiler warnings and potential optimizations. Signed-off-by: Enrico Weigelt, metux IT consult --- include/os.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/os.h b/include/os.h index 929769fb3..9a193ae66 100644 --- a/include/os.h +++ b/include/os.h @@ -58,6 +58,15 @@ SOFTWARE. #include +/* + * @brief macro for specifying non-null arguments + * + * part of public SDK / driver API + */ +#ifndef _X_ATTRIBUTE_NONNULL_ARG +#define _X_ATTRIBUTE_NONNULL_ARG(...) __attribute__((nonnull(__VA_ARGS__))) +#endif + #define SCREEN_SAVER_ON 0 #define SCREEN_SAVER_OFF 1 #define SCREEN_SAVER_FORCER 2