[PATCH] D129152: [Clang][unittests] Silence trucation warning with MSVC

Alexandre Ganea via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 5 17:34:11 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG0880b9d52620: [Clang][unittests] Silence trucation warning with MSVC 2022 (authored by aganea).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129152/new/

https://reviews.llvm.org/D129152

Files:
  clang/unittests/StaticAnalyzer/RangeSetTest.cpp


Index: clang/unittests/StaticAnalyzer/RangeSetTest.cpp
===================================================================
--- clang/unittests/StaticAnalyzer/RangeSetTest.cpp
+++ clang/unittests/StaticAnalyzer/RangeSetTest.cpp
@@ -88,6 +88,12 @@
   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 @@
   // 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>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129152.442418.patch
Type: text/x-patch
Size: 1011 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220706/c63a0e7d/attachment.bin>


More information about the cfe-commits mailing list