[libcxx-commits] [libcxx] 5703905 - [libc++] Assume that push_macro and pop_macro are available
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Mon May 23 11:48:34 PDT 2022
Author: Nikolas Klauser
Date: 2022-05-23T20:47:44+02:00
New Revision: 570390580567ccc940c141e9ee4e16fd31ace176
URL: https://github.com/llvm/llvm-project/commit/570390580567ccc940c141e9ee4e16fd31ace176
DIFF: https://github.com/llvm/llvm-project/commit/570390580567ccc940c141e9ee4e16fd31ace176.diff
LOG: [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
Added:
Modified:
libcxx/CMakeLists.txt
libcxx/include/__config
libcxx/include/__undef_macros
Removed:
################################################################################
diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index 7dd32b13e3be..a182a76dda78 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -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 =============================================================
diff --git a/libcxx/include/__config b/libcxx/include/__config
index b6dd32c5c320..62b367167637 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -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)
diff --git a/libcxx/include/__undef_macros b/libcxx/include/__undef_macros
index 40b2b64d0a6f..3bacbbacb502 100644
--- a/libcxx/include/__undef_macros
+++ b/libcxx/include/__undef_macros
@@ -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
More information about the libcxx-commits
mailing list