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 | d5fd7d7ea152be8e0c6bed31be690cb020e9d96b (patch) | |
tree | 5704a5675eb760f8d63661974c3b114d2fc28c7e /libcxx/src/system_error.cpp | |
parent | 5a6826ebc488e9b21edd5e4f4d25bc209e809614 (diff) | |
download | bcm5719-llvm-d5fd7d7ea152be8e0c6bed31be690cb020e9d96b.tar.gz bcm5719-llvm-d5fd7d7ea152be8e0c6bed31be690cb020e9d96b.zip |
[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
llvm-svn: 292883
Diffstat (limited to 'libcxx/src/system_error.cpp')
-rw-r--r-- | libcxx/src/system_error.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libcxx/src/system_error.cpp b/libcxx/src/system_error.cpp index 94114992c13..cbbbb5dcd15 100644 --- a/libcxx/src/system_error.cpp +++ b/libcxx/src/system_error.cpp @@ -17,9 +17,9 @@ #include "cstring" #include "cstdio" #include "cstdlib" -#include "cassert" #include "string" #include "string.h" +#include "__debug" #if defined(__ANDROID__) #include <android/api-level.h> @@ -96,7 +96,7 @@ string do_strerror_r(int ev) { std::snprintf(buffer, strerror_buff_size, "Unknown error %d", ev); return string(buffer); } else { - assert(new_errno == ERANGE); + _LIBCPP_ASSERT(new_errno == ERANGE, "unexpected error from ::strerr_r"); // FIXME maybe? 'strerror_buff_size' is likely to exceed the // maximum error size so ERANGE shouldn't be returned. std::abort(); |