From a50d5b13be6adbc1a1058d52f49fe5503ab30ff9 Mon Sep 17 00:00:00 2001 From: Tony Wasserka Date: Thu, 13 May 2021 12:04:11 +0200 Subject: [PATCH] util: tune signatures of generated enum operators This allows use of these operators in a constexpr context and silences a clang -Wunused-function warning. Reviewed-by: Jesse Natalie Part-of: --- src/util/enum_operators.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/util/enum_operators.h b/src/util/enum_operators.h index 3a2bb53c060..8d7d37a4e1b 100644 --- a/src/util/enum_operators.h +++ b/src/util/enum_operators.h @@ -23,12 +23,13 @@ #ifdef __cplusplus +#include "macros.h" #include // some enum helpers #define MESA_DEFINE_CPP_ENUM_BINARY_OPERATOR(Enum, op) \ extern "C++" { \ -static inline \ +UNUSED static constexpr \ Enum operator op (Enum a, Enum b) \ { \ using IntType = std::underlying_type_t; \ @@ -37,7 +38,7 @@ Enum operator op (Enum a, Enum b) \ return static_cast(ua op ub); \ } \ \ -static inline \ +UNUSED static constexpr \ Enum& operator op##= (Enum &a, Enum b) \ { \ using IntType = std::underlying_type_t; \ @@ -51,7 +52,7 @@ Enum& operator op##= (Enum &a, Enum b) \ #define MESA_DEFINE_CPP_ENUM_UNARY_OPERATOR(Enum, op) \ extern "C++" { \ -static inline \ +UNUSED static constexpr \ Enum operator op (Enum a) \ { \ using IntType = std::underlying_type_t; \