[libcxx-commits] [libcxx] [libc++] Implement _LIBCPP_SUPPRESS_DEPRECATED macros in terms of _LIBCPP_DIAGNOSTIC macros (PR #143857)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Jul 9 02:39:19 PDT 2025
https://github.com/philnik777 updated https://github.com/llvm/llvm-project/pull/143857
>From 9cb19aeb599439365728e3e049f38017c9574213 Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Thu, 12 Jun 2025 10:43:20 +0200
Subject: [PATCH] [libc++] Implement _LIBCPP_SUPPRESS_DEPRECATED macros in
terms of _LIBCPP_DIAGNOSTIC macros
---
libcxx/include/__config | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/libcxx/include/__config b/libcxx/include/__config
index 58ca9bab937e4..f2199764713b8 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -416,6 +416,12 @@ typedef __char32_t char32_t;
# define _LIBCPP_GCC_DIAGNOSTIC_IGNORED(str)
# endif
+// Macros to enter and leave a state where deprecation warnings are suppressed.
+# define _LIBCPP_SUPPRESS_DEPRECATED_PUSH \
+ _LIBCPP_DIAGNOSTIC_PUSH _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated") \
+ _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations")
+# define _LIBCPP_SUPPRESS_DEPRECATED_POP _LIBCPP_DIAGNOSTIC_POP
+
# if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_FAST
# define _LIBCPP_HARDENING_SIG f
# elif _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_EXTENSIVE
@@ -717,17 +723,6 @@ typedef __char32_t char32_t;
# define _LIBCPP_DEPRECATED_WITH_CHAR8_T
# endif
-// Macros to enter and leave a state where deprecation warnings are suppressed.
-# if defined(_LIBCPP_COMPILER_CLANG_BASED) || defined(_LIBCPP_COMPILER_GCC)
-# define _LIBCPP_SUPPRESS_DEPRECATED_PUSH \
- _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wdeprecated\"") \
- _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
-# define _LIBCPP_SUPPRESS_DEPRECATED_POP _Pragma("GCC diagnostic pop")
-# else
-# define _LIBCPP_SUPPRESS_DEPRECATED_PUSH
-# define _LIBCPP_SUPPRESS_DEPRECATED_POP
-# endif
-
# if _LIBCPP_STD_VER <= 11
# define _LIBCPP_EXPLICIT_SINCE_CXX14
# else
More information about the libcxx-commits
mailing list