Skip to content

Commit 46b4bd2

Browse files
authored
[libc++] Implement _LIBCPP_SUPPRESS_DEPRECATED macros in terms of _LIBCPP_DIAGNOSTIC macros (#143857)
This makes the code a bit more consistent, since we use the `_LIBCPP_DIAGNOSTIC` macros everywhere else.
1 parent 3483ac5 commit 46b4bd2

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

libcxx/include/__config

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,12 @@ typedef __char32_t char32_t;
416416
# define _LIBCPP_GCC_DIAGNOSTIC_IGNORED(str)
417417
# endif
418418

419+
// Macros to enter and leave a state where deprecation warnings are suppressed.
420+
# define _LIBCPP_SUPPRESS_DEPRECATED_PUSH \
421+
_LIBCPP_DIAGNOSTIC_PUSH _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated") \
422+
_LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations")
423+
# define _LIBCPP_SUPPRESS_DEPRECATED_POP _LIBCPP_DIAGNOSTIC_POP
424+
419425
# if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_FAST
420426
# define _LIBCPP_HARDENING_SIG f
421427
# elif _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_EXTENSIVE
@@ -713,17 +719,6 @@ typedef __char32_t char32_t;
713719
# define _LIBCPP_DEPRECATED_WITH_CHAR8_T
714720
# endif
715721

716-
// Macros to enter and leave a state where deprecation warnings are suppressed.
717-
# if defined(_LIBCPP_COMPILER_CLANG_BASED) || defined(_LIBCPP_COMPILER_GCC)
718-
# define _LIBCPP_SUPPRESS_DEPRECATED_PUSH \
719-
_Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wdeprecated\"") \
720-
_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
721-
# define _LIBCPP_SUPPRESS_DEPRECATED_POP _Pragma("GCC diagnostic pop")
722-
# else
723-
# define _LIBCPP_SUPPRESS_DEPRECATED_PUSH
724-
# define _LIBCPP_SUPPRESS_DEPRECATED_POP
725-
# endif
726-
727722
# if _LIBCPP_STD_VER <= 11
728723
# define _LIBCPP_EXPLICIT_SINCE_CXX14
729724
# else

0 commit comments

Comments
 (0)