[libcxx-commits] [PATCH] D60249: [pstl] Replace direct use of assert() with __PSTL_ASSERT
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Apr 5 13:23:06 PDT 2019
ldionne added inline comments.
================
Comment at: pstl/include/pstl/internal/pstl_config.h:17-28
+#if defined(PSTL_USE_ASSERT)
+# undef __PSTL_USE_ASSERT
+# define __PSTL_USE_ASSERT PSTL_USE_ASSERT
+# include <cassert>
+# define __PSTL_ASSERT(pred) (assert((pred)))
+// TODO make this smarter
+# define __PSTL_ASSERT_MSG(pred, msg) (assert((pred)))
----------------
I would do this:
```
#if !defined(_PSTL_ASSERT)
# include <cassert>
# define _PSTL_ASSERT(x) assert(x)
#endif
```
And I would just use `_PSTL_ASSERT(x)` elsewhere in the code. I don't see a reason to have a separate `_PSTL_USE_ASSERT` macro if we can define `_PSTL_ASSERT` directly. Also, whether `NDEBUG` is defined will control whether `_PSTL_ASSERT` does something by default, so the default is fine for unit tests. WDYT?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D60249/new/
https://reviews.llvm.org/D60249
More information about the libcxx-commits
mailing list