forked from OSchip/llvm-project
Revert "[libcxx] Never use <cassert> within libc++"
This reverts commit r292883. Unfortunately <string_view> uses _LIBCPP_ASSERT in a way which is not compatible with the C++11 dylib build. I'll investigate more tomorrow. llvm-svn: 292923
This commit is contained in:
parent
819da50d12
commit
f9e7bf3a43
|
@ -60,7 +60,7 @@ endif()
|
|||
include(CMakeDependentOption)
|
||||
|
||||
# Basic options ---------------------------------------------------------------
|
||||
option(LIBCXX_ENABLE_ASSERTIONS "Enable assertions independent of build mode." OFF)
|
||||
option(LIBCXX_ENABLE_ASSERTIONS "Enable assertions independent of build mode." ON)
|
||||
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,7 +501,6 @@ 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.
|
||||
|
|
|
@ -824,9 +824,7 @@ template <unsigned> struct __static_assert_check {};
|
|||
# else
|
||||
# error Supported values for _LIBCPP_DEBUG are 0 and 1
|
||||
# endif
|
||||
# if !defined(_LIBCPP_BUILDING_LIBRARY)
|
||||
# define _LIBCPP_EXTERN_TEMPLATE(...)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_EXTERN_TEMPLATE
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
# include <pthread.h>
|
||||
# include <sched.h>
|
||||
#elif defined(_LIBCPP_HAS_THREAD_API_WIN32)
|
||||
#include <assert.h>
|
||||
#include <Windows.h>
|
||||
#include <process.h>
|
||||
#include <fibersapi.h>
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "condition_variable"
|
||||
#include "thread"
|
||||
#include "system_error"
|
||||
#include "cassert"
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
|
|
@ -6,9 +6,11 @@
|
|||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
#undef NDEBUG
|
||||
#include "experimental/filesystem"
|
||||
#include "string_view"
|
||||
#include "utility"
|
||||
#include "cassert"
|
||||
|
||||
namespace { namespace parser
|
||||
{
|
||||
|
@ -111,6 +113,7 @@ public:
|
|||
void decrement() noexcept {
|
||||
const PosPtr REnd = &Path.front() - 1;
|
||||
const PosPtr RStart = getCurrentTokenStartPos() - 1;
|
||||
assert(RStart != REnd);
|
||||
|
||||
switch (State) {
|
||||
case PS_AtEnd: {
|
||||
|
@ -319,6 +322,7 @@ 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;
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "mutex"
|
||||
#include "limits"
|
||||
#include "system_error"
|
||||
#include "cassert"
|
||||
#include "include/atomic_support.h"
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
@ -44,7 +45,7 @@ mutex::unlock() _NOEXCEPT
|
|||
{
|
||||
int ec = __libcpp_mutex_unlock(&__m_);
|
||||
(void)ec;
|
||||
_LIBCPP_ASSERT(ec == 0, "call to mutex::unlock failed");
|
||||
assert(ec == 0);
|
||||
}
|
||||
|
||||
// recursive_mutex
|
||||
|
@ -60,7 +61,7 @@ recursive_mutex::~recursive_mutex()
|
|||
{
|
||||
int e = __libcpp_recursive_mutex_destroy(&__m_);
|
||||
(void)e;
|
||||
_LIBCPP_ASSERT(e == 0, "call to ~recursive_mutex() failed");
|
||||
assert(e == 0);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -76,7 +77,7 @@ recursive_mutex::unlock() _NOEXCEPT
|
|||
{
|
||||
int e = __libcpp_recursive_mutex_unlock(&__m_);
|
||||
(void)e;
|
||||
_LIBCPP_ASSERT(e == 0, "call to recursive_mutex::unlock() failed");
|
||||
assert(e == 0);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -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 {
|
||||
_LIBCPP_ASSERT(new_errno == ERANGE, "unexpected error from ::strerr_r");
|
||||
assert(new_errno == ERANGE);
|
||||
// FIXME maybe? 'strerror_buff_size' is likely to exceed the
|
||||
// maximum error size so ERANGE shouldn't be returned.
|
||||
std::abort();
|
||||
|
|
Loading…
Reference in New Issue