[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
This commit is contained in:
Eric Fiselier
2017-01-24 04:57:33 +00:00
parent cdb5d25004
commit 2c90d1f776
7 changed files with 9 additions and 13 deletions

View File

@@ -6,11 +6,9 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#undef NDEBUG
#include "experimental/filesystem"
#include "string_view"
#include "utility"
#include "cassert"
namespace { namespace parser
{
@@ -113,7 +111,6 @@ public:
void decrement() noexcept {
const PosPtr REnd = &Path.front() - 1;
const PosPtr RStart = getCurrentTokenStartPos() - 1;
assert(RStart != REnd);
switch (State) {
case PS_AtEnd: {
@@ -322,7 +319,6 @@ string_view_t path::__root_path_raw() const
auto NextCh = PP.peek();
if (NextCh && *NextCh == '/') {
++PP;
assert(PP.State == PathParser::PS_InRootDir);
return createView(__pn_.data(), &PP.RawEntry.back());
}
return PP.RawEntry;