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

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed May 18 12:49:38 PDT 2022


ldionne requested changes to this revision.
ldionne added inline comments.
This revision now requires changes to proceed.


================
Comment at: pstl/include/pstl/internal/algorithm_impl.h:19
 
 #include "execution_impl.h"
 #include "memory_impl.h"
----------------
Instead, we need to make the PSTL freestanding (in the sense that it should work whether it is used with libc++ or with another stdlib, not in the usual freestanding sense). So I'd do something like this inside `pstl_config.h`:

```
#if defined(_PSTL_COMPILER_MSVC)
#   define _PSTL_PUSH_MACROS        \
        __pragma(push_macro("min")) \
        __pragma(push_macro("max"))
#   define _PSTL_POP_MACROS         \
        __pragma(pop_macro("min"))  \
        __pragma(pop_macro("max"))
#else
#   define _PSTL_PUSH_MACROS            \
        _Pragma("push_macro(\"min\")")  \
        _Pragma("push_macro(\"max\")")
#   define _PSTL_POP_MACROS             \
        _Pragma("pop_macro(\"min\")")   \
        _Pragma("pop_macro(\"max\")")
#endif
#define _PSTL_UNDEF_MACROS <__pstl_undef_macros>
```



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125633



More information about the libcxx-commits mailing list