Skip to content

Commit 450c22e

Browse files
committed
[libc++] Implement _LIBCPP_SUPPRESS_DEPRECATED macros in terms of _LIBCPP_DIAGNOSTIC macros
1 parent 4079ed3 commit 450c22e

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
@@ -724,17 +730,6 @@ typedef __char32_t char32_t;
724730
# define _LIBCPP_DEPRECATED_WITH_CHAR8_T
725731
# endif
726732

727-
// Macros to enter and leave a state where deprecation warnings are suppressed.
728-
# if defined(_LIBCPP_COMPILER_CLANG_BASED) || defined(_LIBCPP_COMPILER_GCC)
729-
# define _LIBCPP_SUPPRESS_DEPRECATED_PUSH \
730-
_Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wdeprecated\"") \
731-
_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
732-
# define _LIBCPP_SUPPRESS_DEPRECATED_POP _Pragma("GCC diagnostic pop")
733-
# else
734-
# define _LIBCPP_SUPPRESS_DEPRECATED_PUSH
735-
# define _LIBCPP_SUPPRESS_DEPRECATED_POP
736-
# endif
737-
738733
# if _LIBCPP_STD_VER <= 11
739734
# define _LIBCPP_EXPLICIT_SINCE_CXX14
740735
# else

0 commit comments

Comments
 (0)