From 528087e30840452d38bd3efcc949f646006bda8d Mon Sep 17 00:00:00 2001 From: David Vo Date: Fri, 31 Dec 2021 16:20:05 +1100 Subject: [PATCH] [hal] Use enums with fixed underlying type in clang C (#3297) This will allow static analysis tools that use clang to always determine the correct intended parameter types for HAL functions. --- hal/src/main/native/include/hal/Types.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hal/src/main/native/include/hal/Types.h b/hal/src/main/native/include/hal/Types.h index 6b954470a1..ac7c7481aa 100644 --- a/hal/src/main/native/include/hal/Types.h +++ b/hal/src/main/native/include/hal/Types.h @@ -74,6 +74,11 @@ typedef int32_t HAL_Bool; #ifdef __cplusplus #define HAL_ENUM(name) enum name : int32_t +#elif defined(__clang__) +#define HAL_ENUM(name) \ + enum name : int32_t; \ + typedef enum name name; \ + enum name : int32_t #else #define HAL_ENUM(name) \ typedef int32_t name; \