Recommit [libcxx] Never use <cassert> within libc++

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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@294107 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Fiselier
2017-02-04 23:22:28 +00:00
parent 236b752f2b
commit b89eba01e8
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;