[libc++] Assume that push_macro and pop_macro are available

All compilers that libc++ supports support `push_macro` and `pop_macro`. So let's remove it.

Reviewed By: ldionne, #libc

Spies: libcxx-commits, mgorny

Differential Revision: https://reviews.llvm.org/D126073
This commit is contained in:
Nikolas Klauser 2022-05-20 17:11:58 +02:00
parent b177a90ce7
commit 5703905805
3 changed files with 4 additions and 51 deletions

View File

@ -634,9 +634,6 @@ function(cxx_add_warning_flags target)
if (LIBCXX_ENABLE_PEDANTIC)
target_add_compile_flags_if_supported(${target} PRIVATE -pedantic)
endif()
if (LIBCXX_DISABLE_MACRO_CONFLICT_WARNINGS)
target_compile_definitions(${target} PRIVATE -D_LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS)
endif()
endfunction()
# Exception flags =============================================================

View File

@ -1235,35 +1235,8 @@ extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container(
#define _LIBCPP_HAS_NO_CXX20_COROUTINES
#endif
#if defined(_LIBCPP_COMPILER_IBM)
#define _LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO
#endif
#if defined(_LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO)
# define _LIBCPP_PUSH_MACROS
# define _LIBCPP_POP_MACROS
#else
// Don't warn about macro conflicts when we can restore them at the
// end of the header.
# ifndef _LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS
# define _LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS
# endif
# if defined(_LIBCPP_COMPILER_MSVC)
# define _LIBCPP_PUSH_MACROS \
__pragma(push_macro("min")) \
__pragma(push_macro("max"))
# define _LIBCPP_POP_MACROS \
__pragma(pop_macro("min")) \
__pragma(pop_macro("max"))
# else
# define _LIBCPP_PUSH_MACROS \
_Pragma("push_macro(\"min\")") \
_Pragma("push_macro(\"max\")")
# define _LIBCPP_POP_MACROS \
_Pragma("pop_macro(\"min\")") \
_Pragma("pop_macro(\"max\")")
# endif
#endif // defined(_LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO)
# define _LIBCPP_PUSH_MACROS _Pragma("push_macro(\"min\")") _Pragma("push_macro(\"max\")")
# define _LIBCPP_POP_MACROS _Pragma("pop_macro(\"min\")") _Pragma("pop_macro(\"max\")")
#ifndef _LIBCPP_NO_AUTO_LINK
# if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY)

View File

@ -7,27 +7,10 @@
//
//===----------------------------------------------------------------------===//
#ifdef min
#if !defined(_LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS)
#if defined(_LIBCPP_WARNING)
_LIBCPP_WARNING("macro min is incompatible with C++. Try #define NOMINMAX "
"before any Windows header. #undefing min")
#else
#warning: macro min is incompatible with C++. #undefing min
#endif
#endif
#undef min
# undef min
#endif
#ifdef max
#if !defined(_LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS)
#if defined(_LIBCPP_WARNING)
_LIBCPP_WARNING("macro max is incompatible with C++. Try #define NOMINMAX "
"before any Windows header. #undefing max")
#else
#warning: macro max is incompatible with C++. #undefing max
#endif
#endif
#undef max
# undef max
#endif