[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 May 2 11:20:48 PDT 2023
nicolerabjohn updated this revision to Diff 518812.
nicolerabjohn added a comment.
Updating testcase to use NASTY_MACROS
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.compile.pass.cpp
Index: libcxx/test/libcxx/nasty_macros.compile.pass.cpp
===================================================================
--- libcxx/test/libcxx/nasty_macros.compile.pass.cpp
+++ libcxx/test/libcxx/nasty_macros.compile.pass.cpp
@@ -142,6 +142,19 @@
#define min NASTY_MACRO
#define max NASTY_MACRO
+// Test to make sure curses has no conflicting macros with the standard library
+#ifndef refresh
+# define refresh NASTY_MACRO
+#endif
+
+#ifndef move
+# define move NASTY_MACRO
+#endif
+
+#ifndef erase
+# define erase NASTY_MACRO
+#endif
+
/*
BEGIN-SCRIPT
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
@@ -1141,8 +1141,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.518812.patch
Type: text/x-patch
Size: 2346 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230502/40f41724/attachment.bin>
More information about the libcxx-commits
mailing list