[gjs/msvc.partial.fix] enum-utils.h: Fix CI complaints



commit 0ebf4de1b2ca01ebc32fdde827ea884f7fa6b53a
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Mon Mar 8 17:19:25 2021 +0800

    enum-utils.h: Fix CI complaints
    
    Apparently cppcheck did not like lines getting too long and macro-izing
    templates don't bode well with GCC...

 gjs/enum-utils.h | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/gjs/enum-utils.h b/gjs/enum-utils.h
index 679e8c16..f22033b2 100644
--- a/gjs/enum-utils.h
+++ b/gjs/enum-utils.h
@@ -7,11 +7,9 @@
 #include <type_traits>
 
 #if defined (_MSC_VER) && !defined (__clang__)
-#    define ENUM_WRAP_UNDERLYING_TYPE std::conditional_t<is_class<EnumType>(), 
std::underlying_type_t<EnumType>, void>
 #    define CAST_WRAPPED(x) static_cast<EnumType>(x)
 #    define CAST_WRAPPED_T(T,x) static_cast<T>(x)
 #else
-#    define ENUM_WRAP_UNDERLYING_TYPE std::conditional_t<is_class<EnumType>(), WrapperImpl<EnumType>(), void>
 #    define CAST_WRAPPED(x) (x)
 #    define CAST_WRAPPED_T(T,x) (x)
 #endif
@@ -40,8 +38,13 @@ struct WrapperImpl {
     }
 };
 
+#if defined (_MSC_VER) && !defined (__clang__)
+template <class EnumType>
+using Wrapper = std::conditional_t<is_class<EnumType>(), std::underlying_type_t<EnumType>, void>;
+#else
 template <class EnumType>
-using Wrapper = ENUM_WRAP_UNDERLYING_TYPE;
+using Wrapper = std::conditional_t<is_class<EnumType>(), WrapperImpl<EnumType>(), void>;
+#endif
 }  // namespace GjsEnum
 
 template <class EnumType, class Wrapped = GjsEnum::Wrapper<EnumType>>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]