diff options
author | Eric Fiselier <eric@efcs.ca> | 2017-01-24 04:57:33 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2017-01-24 04:57:33 +0000 |
commit | 2c90d1f776b8f7975ac679a1c0cb862345214b99 (patch) | |
tree | 162c399ba405b247262d3de19f3743e52978e5e5 /CMakeLists.txt | |
parent | cdb5d2500482a37b0764c2bac53caebd8a314aa8 (diff) |
[libcxx] Never use <cassert> within libc++
Summary:
It is my opinion that libc++ should never use `<cassert>`, including in the `dylib`. This patch remove all uses of `assert` from within libc++ and replaces most of them with `_LIBCPP_ASSERT` instead.
Additionally this patch turn `LIBCXX_ENABLE_ASSERTIONS` off by default, because the standard library should not be aborting user programs unless explicitly asked to.
Reviewers: mclow.lists, compnerd, smeenai
Reviewed By: mclow.lists
Subscribers: mgorny, cfe-commits
Differential Revision: https://reviews.llvm.org/D29063
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@292883 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 59d762976..4d65d2d22 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,7 +60,7 @@ endif() include(CMakeDependentOption) # Basic options --------------------------------------------------------------- -option(LIBCXX_ENABLE_ASSERTIONS "Enable assertions independent of build mode." ON) +option(LIBCXX_ENABLE_ASSERTIONS "Enable assertions independent of build mode." OFF) option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON) option(LIBCXX_ENABLE_STATIC "Build libc++ as a static library." ON) option(LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY "Build libc++experimental.a" ON) @@ -501,6 +501,7 @@ endif() # Assertion flags ============================================================= define_if(LIBCXX_ENABLE_ASSERTIONS -UNDEBUG) define_if_not(LIBCXX_ENABLE_ASSERTIONS -DNDEBUG) +define_if(LIBCXX_ENABLE_ASSERTIONS -D_LIBCPP_DEBUG=0) define_if(LIBCXX_DEBUG_BUILD -D_DEBUG) if (LIBCXX_ENABLE_ASSERTIONS AND NOT LIBCXX_DEBUG_BUILD) # MSVC doesn't like _DEBUG on release builds. See PR 4379. |