bcraig created this revision. When using LIBCXX_ABI_UNSTABLE=YES, clang-cl gave the following warning:
P:\llvm_master\src\llvm\projects\libcxx\include\string(683,51): warning: enumerator value is not representable in the underlying type 'int' [-Wmicrosoft-enum-value] Fixed by providing a sufficiently large representation, so long as C++11 strong enums are available. https://reviews.llvm.org/D35174 Files: include/__config include/string Index: include/string =================================================================== --- include/string +++ include/string @@ -680,7 +680,7 @@ enum {__long_mask = 0x1ul}; #else // _LIBCPP_BIG_ENDIAN enum {__short_mask = 0x80}; - enum {__long_mask = ~(size_type(~0) >> 1)}; + enum _LIBCPP_UNDERLYING_ENUM_TYPE(size_type) {__long_mask = ~(size_type(~0) >> 1)}; #endif // _LIBCPP_BIG_ENDIAN enum {__min_cap = (sizeof(__long) - 1)/sizeof(value_type) > 2 ? @@ -707,7 +707,7 @@ #if _LIBCPP_BIG_ENDIAN enum {__short_mask = 0x80}; - enum {__long_mask = ~(size_type(~0) >> 1)}; + enum _LIBCPP_UNDERLYING_ENUM_TYPE(size_type) {__long_mask = ~(size_type(~0) >> 1)}; #else // _LIBCPP_BIG_ENDIAN enum {__short_mask = 0x01}; enum {__long_mask = 0x1ul}; Index: include/__config =================================================================== --- include/__config +++ include/__config @@ -849,9 +849,11 @@ _LIBCPP_ALWAYS_INLINE explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \ _LIBCPP_ALWAYS_INLINE operator int() const {return __v_;} \ }; +#define _LIBCPP_UNDERLYING_ENUM_TYPE(t) #else // _LIBCPP_HAS_NO_STRONG_ENUMS #define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_ENUM_VIS x #define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) +#define _LIBCPP_UNDERLYING_ENUM_TYPE(t) : t #endif // _LIBCPP_HAS_NO_STRONG_ENUMS #ifdef _LIBCPP_DEBUG
Index: include/string =================================================================== --- include/string +++ include/string @@ -680,7 +680,7 @@ enum {__long_mask = 0x1ul}; #else // _LIBCPP_BIG_ENDIAN enum {__short_mask = 0x80}; - enum {__long_mask = ~(size_type(~0) >> 1)}; + enum _LIBCPP_UNDERLYING_ENUM_TYPE(size_type) {__long_mask = ~(size_type(~0) >> 1)}; #endif // _LIBCPP_BIG_ENDIAN enum {__min_cap = (sizeof(__long) - 1)/sizeof(value_type) > 2 ? @@ -707,7 +707,7 @@ #if _LIBCPP_BIG_ENDIAN enum {__short_mask = 0x80}; - enum {__long_mask = ~(size_type(~0) >> 1)}; + enum _LIBCPP_UNDERLYING_ENUM_TYPE(size_type) {__long_mask = ~(size_type(~0) >> 1)}; #else // _LIBCPP_BIG_ENDIAN enum {__short_mask = 0x01}; enum {__long_mask = 0x1ul}; Index: include/__config =================================================================== --- include/__config +++ include/__config @@ -849,9 +849,11 @@ _LIBCPP_ALWAYS_INLINE explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \ _LIBCPP_ALWAYS_INLINE operator int() const {return __v_;} \ }; +#define _LIBCPP_UNDERLYING_ENUM_TYPE(t) #else // _LIBCPP_HAS_NO_STRONG_ENUMS #define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_ENUM_VIS x #define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) +#define _LIBCPP_UNDERLYING_ENUM_TYPE(t) : t #endif // _LIBCPP_HAS_NO_STRONG_ENUMS #ifdef _LIBCPP_DEBUG
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits