[libcxx-commits] [PATCH] D125633: [pstl][libc++] Add macro guards to PSTL and enable them for libc++

Nikolas Klauser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun May 15 09:02:44 PDT 2022


philnik created this revision.
philnik added reviewers: ldionne, Mordante, var-const.
Herald added a project: All.
philnik requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

Currently some of the libc++ tests fail because the header isn't guarded against min/max macros.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D125633

Files:
  libcxx/include/__config
  pstl/include/pstl/internal/algorithm_impl.h


Index: pstl/include/pstl/internal/algorithm_impl.h
===================================================================
--- pstl/include/pstl/internal/algorithm_impl.h
+++ pstl/include/pstl/internal/algorithm_impl.h
@@ -24,6 +24,11 @@
 #include "pstl_config.h"
 #include "unseq_backend_simd.h"
 
+#ifdef _PSTL_PUSH_MACROS
+_PSTL_PUSH_MACROS
+#include _PSTL_UNDEF_MACROS
+#endif
+
 _PSTL_HIDE_FROM_ABI_PUSH
 
 namespace __pstl
@@ -3816,4 +3821,8 @@
 
 _PSTL_HIDE_FROM_ABI_POP
 
+#ifdef _PSTL_PUSH_MACROS
+_PSTL_POP_MACROS
+#endif
+
 #endif /* _PSTL_ALGORITHM_IMPL_H */
Index: libcxx/include/__config
===================================================================
--- libcxx/include/__config
+++ libcxx/include/__config
@@ -1263,6 +1263,9 @@
        _Pragma("pop_macro(\"min\")")   \
        _Pragma("pop_macro(\"max\")")
 #  endif
+#  define _PSTL_PUSH_MACROS _LIBCPP_PUSH_MACROS
+#  define _PSTL_UNDEF_MACROS <__undef_macros>
+#  define _PSTL_POP_MACROS _LIBCPP_POP_MACROS
 #endif // defined(_LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO)
 
 #ifndef _LIBCPP_NO_AUTO_LINK


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125633.429541.patch
Type: text/x-patch
Size: 1066 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220515/34e08b2b/attachment.bin>


More information about the libcxx-commits mailing list