[libcxx-commits] [libcxx] [libc++] guard gcc diagnostic push in `bitset` (PR #94713)

via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jun 6 18:31:10 PDT 2024


https://github.com/c8ef created https://github.com/llvm/llvm-project/pull/94713

context: https://github.com/llvm/llvm-project/pull/92663/files#r1623238031

I'm not sure if it needs fixing. Please let me know if I'm doing something wrong.

>From 4234d496b963e01685f8e8f6e69abb1f154614e4 Mon Sep 17 00:00:00 2001
From: c8ef <c8ef at outlook.com>
Date: Fri, 7 Jun 2024 09:28:14 +0800
Subject: [PATCH] guard gcc diagnostic

---
 libcxx/include/bitset | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libcxx/include/bitset b/libcxx/include/bitset
index 6bd7bfe585f38..5f78660a465ea 100644
--- a/libcxx/include/bitset
+++ b/libcxx/include/bitset
@@ -375,11 +375,15 @@ template <size_t _N_words, size_t _Size>
 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long
 __bitset<_N_words, _Size>::to_ullong(true_type, true_type) const {
   unsigned long long __r = __first_[0];
+#if defined(_LIBCPP_COMPILER_GCC)
   _LIBCPP_DIAGNOSTIC_PUSH
   _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wshift-count-overflow")
+#endif
   for (size_t __i = 1; __i < sizeof(unsigned long long) / sizeof(__storage_type); ++__i)
     __r |= static_cast<unsigned long long>(__first_[__i]) << (sizeof(__storage_type) * CHAR_BIT);
+#if defined(_LIBCPP_COMPILER_GCC)
   _LIBCPP_DIAGNOSTIC_POP
+#endif
   return __r;
 }
 



More information about the libcxx-commits mailing list