Standard libraries may (libstdc++ in particular) forbid direct use of
assert()/<cassert> in library code.
Details
- Reviewers
rodgert ldionne - Group Reviewers
Restricted Project - Commits
- rG2e15f4ac572b: [pstl] Replace direct use of assert() with _PSTL_ASSERT
Diff Detail
- Repository
- rG LLVM Github Monorepo
- Build Status
Buildable 30043 Build 30042: arc lint + arc unit
Event Timeline
pstl/include/pstl/internal/pstl_config.h | ||
---|---|---|
17–28 | 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? |
pstl/include/pstl/internal/pstl_config.h | ||
---|---|---|
17–28 | That works for me. I will be injecting the definitions for PSTL_ASSERT() and PSTL_ASSERT_MSG() from libstdc++'s configuration anyway. This is really just to try and provide a sane default the standalone impl. I'll update the diff. |
I’ll make sure both sides agree on the name. I still need to go through the
tests on the libstdc++ side but that can wait until after stage1 closes.
I would do this:
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?