[libcxx-commits] [PATCH] D147356: Fixing conflicting macro definitions between curses.h and the standard library.

Nicole Rabjohn via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jun 20 10:03:51 PDT 2023


nicolerabjohn updated this revision to Diff 532975.
nicolerabjohn added a comment.

Rebase


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147356/new/

https://reviews.llvm.org/D147356

Files:
  libcxx/include/__config
  libcxx/include/__undef_macros
  libcxx/include/__utility/move.h
  libcxx/test/libcxx/nasty_macros.gen.py


Index: libcxx/test/libcxx/nasty_macros.gen.py
===================================================================
--- libcxx/test/libcxx/nasty_macros.gen.py
+++ libcxx/test/libcxx/nasty_macros.gen.py
@@ -149,5 +149,10 @@
 #define min NASTY_MACRO
 #define max NASTY_MACRO
 
+// Test to make sure curses has no conflicting macros with the standard library
+#define move NASTY_MACRO
+#define erase NASTY_MACRO
+#define refresh NASTY_MACRO
+
 #include <{header}>
 """)
Index: libcxx/include/__utility/move.h
===================================================================
--- libcxx/include/__utility/move.h
+++ libcxx/include/__utility/move.h
@@ -20,6 +20,9 @@
 #  pragma GCC system_header
 #endif
 
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 template <class _Tp>
@@ -41,4 +44,6 @@
 
 _LIBCPP_END_NAMESPACE_STD
 
+_LIBCPP_POP_MACROS
+
 #endif // _LIBCPP___UTILITY_MOVE_H
Index: libcxx/include/__undef_macros
===================================================================
--- libcxx/include/__undef_macros
+++ libcxx/include/__undef_macros
@@ -14,3 +14,15 @@
 #ifdef max
 #  undef max
 #endif
+
+#ifdef refresh
+#  undef refresh
+#endif
+
+#ifdef move
+#  undef move
+#endif
+
+#ifdef erase
+#  undef erase
+#endif
Index: libcxx/include/__config
===================================================================
--- libcxx/include/__config
+++ libcxx/include/__config
@@ -1134,8 +1134,8 @@
 #    define _LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS
 #  endif // _LIBCPP_ENABLE_CXX20_REMOVED_FEATURES
 
-#  define _LIBCPP_PUSH_MACROS _Pragma("push_macro(\"min\")") _Pragma("push_macro(\"max\")")
-#  define _LIBCPP_POP_MACROS _Pragma("pop_macro(\"min\")") _Pragma("pop_macro(\"max\")")
+#  define _LIBCPP_PUSH_MACROS _Pragma("push_macro(\"min\")") _Pragma("push_macro(\"max\")") _Pragma("push_macro(\"refresh()\")") _Pragma("push_macro(\"move(int, int)\")") _Pragma("push_macro(\"erase()\")")
+#  define _LIBCPP_POP_MACROS _Pragma("pop_macro(\"min\")") _Pragma("pop_macro(\"max\")") _Pragma("pop_macro(\"refresh()\")") _Pragma("pop_macro(\"move(int, int)\")") _Pragma("pop_macro(\"erase()\")")
 
 #  ifndef _LIBCPP_NO_AUTO_LINK
 #    if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147356.532975.patch
Type: text/x-patch
Size: 2246 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230620/7eabfb85/attachment.bin>


More information about the libcxx-commits mailing list