[clang] 0880b9d - [Clang][unittests] Silence trucation warning with MSVC 2022
Alexandre Ganea via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 5 17:34:05 PDT 2022
Author: Alexandre Ganea
Date: 2022-07-05T20:31:54-04:00
New Revision: 0880b9d52620ca3c46456095f6040a2e4de6c871
URL: https://github.com/llvm/llvm-project/commit/0880b9d52620ca3c46456095f6040a2e4de6c871
DIFF: https://github.com/llvm/llvm-project/commit/0880b9d52620ca3c46456095f6040a2e4de6c871.diff
LOG: [Clang][unittests] Silence trucation warning with MSVC 2022
Differential Revision: https://reviews.llvm.org/D129152
Added:
Modified:
clang/unittests/StaticAnalyzer/RangeSetTest.cpp
Removed:
################################################################################
diff --git a/clang/unittests/StaticAnalyzer/RangeSetTest.cpp b/clang/unittests/StaticAnalyzer/RangeSetTest.cpp
index 91a6351c8e3b3..892c1ac23f92f 100644
--- a/clang/unittests/StaticAnalyzer/RangeSetTest.cpp
+++ b/clang/unittests/StaticAnalyzer/RangeSetTest.cpp
@@ -88,6 +88,12 @@ template <typename T> struct TestValues {
template <typename Base>
static constexpr T X555TruncZeroOf = TruncZeroOf<X555, Base>; // 0x5555'5600
+// Silence 'warning C4309: 'initializing': truncation of constant value'
+// in RangeSetCastToPromotionConversionTest.
+#if defined(_MSC_VER) && !defined(__clang__)
+#pragma warning(push)
+#pragma warning(disable : 4309)
+#endif
// Numbers for ranges with the same bits in the lowest byte.
// 0xAAAA'AA2A
static constexpr T FromA = ClearLowBytes<XAAA, sizeof(T) - 1> + 42;
@@ -95,6 +101,10 @@ template <typename T> struct TestValues {
// 0x5555'552A
static constexpr T FromB = ClearLowBytes<X555, sizeof(T) - 1> + 42;
static constexpr T ToB = FromB + 2; // 0x5555'552C
+
+#if defined(_MSC_VER) && !defined(__clang__)
+#pragma warning(pop)
+#endif
};
template <typename T>
More information about the cfe-commits
mailing list