From 2f1e8e7c4730bbc4bf15e85ecf4f954d1711db10 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Wed, 9 Sep 2015 18:12:47 +0100 Subject: Enable lightweight checks with _GLIBCXX_ASSERTIONS. * doc/xml/manual/using.xml (_GLIBCXX_ASSERTIONS): Document. * doc/html/manual/using_macros.html: Regenerate. * include/bits/c++config: Define _GLIBCXX_ASSERTIONS when _GLIBCXX_DEBUG is defined. Disable std::string extern templates when (_GLIBCXX_EXTERN_TEMPLATE, __glibcxx_assert): Depend on _GLIBCXX_ASSERTIONS instead of _GLIBCXX_DEBUG. * include/debug/debug.h [!_GLIBCXX_DEBUG]: Define __glibcxx_requires_non_empty_range and __glibcxx_requires_nonempty. * include/backward/auto_ptr.h (auto_ptr::operator*, auto_ptr::operator->): Replace _GLIBCXX_DEBUG_ASSERT with __glibcxx_assert. * include/bits/basic_string.h (basic_string::operator[], basic_string::front, basic_string::back, basic_string::pop_back): Likewise. * include/bits/random.h (uniform_int_distribution::param_type::param_type, uniform_real_distribution::param_type::param_type, normal_distribution::param_type::param_type, gamma_distribution::param_type::param_type, bernoulli_distribution::param_type::param_type, binomial_distribution::param_type::param_type, geometric_distribution::param_type::param_type, negative_binomial_distribution::param_type::param_type, poisson_distribution::param_type::param_type, exponential_distribution::param_type::param_type): Likewise. * include/bits/regex.h (match_results::operator[], match_results::prefix, match_results::suffix): Likewise. * include/bits/regex.tcc (format, regex_iterator::operator++): Likewise. * include/bits/regex_automaton.tcc (_StateSeq::_M_clone): Likewise. * include/bits/regex_compiler.tcc (_Compiler::_Compiler, _Compiler::_M_insert_character_class_matcher): Likewise. * include/bits/regex_executor.tcc (_Executor::_M_dfs): Likewise. * include/bits/regex_scanner.tcc (_Scanner::_M_advance, _Scanner::_M_scan_normal): Likewise. * include/bits/shared_ptr_base.h (__shared_ptr::_M_reset, __shared_ptr::operator*): Likewise. * include/bits/stl_iterator_base_funcs.h (__advance): Likewise. * include/bits/unique_ptr.h (unique_ptr::operator*, unique_ptr::operator[]): Likewise. * include/experimental/fs_path.h (path::path(string_type, _Type), path::iterator::operator++, path::iterator::operator--, path::iterator::operator*): Likewise. * include/experimental/string_view (basic_string_view::operator[], basic_string_view::front, basic_string_view::back, basic_string_view::remove_prefix): Likewise. * include/ext/random (beta_distribution::param_type::param_type, normal_mv_distribution::param_type::param_type, rice_distribution::param_type::param_type, pareto_distribution::param_type::param_type, k_distribution::param_type::param_type, arcsine_distribution::param_type::param_type, hoyt_distribution::param_type::param_type, triangular_distribution::param_type::param_type, von_mises_distribution::param_type::param_type, hypergeometric_distribution::param_type::param_type, logistic_distribution::param_type::param_type): Likewise. * include/ext/vstring.h (__versa_string::operator[]): Likewise. * include/std/complex (polar): Likewise. * include/std/mutex [!_GTHREAD_USE_MUTEX_TIMEDLOCK] (timed_mutex::~timed_mutex, timed_mutex::unlock, (recursive_timed_mutex::~timed_mutex, recursive_timed_mutex::unlock): Likewise. * include/std/shared_mutex [!PTHREAD_RWLOCK_INITIALIZER] (__shared_mutex_pthread::__shared_mutex_pthread, __shared_mutex_pthread::~__shared_mutex_pthread): Likewise. (__shared_mutex_pthread::lock, __shared_mutex_pthread::try_lock, __shared_mutex_pthread::unlock, __shared_mutex_pthread::lock_shared, __shared_mutex_pthread::try_lock_shared): Likewise. (__shared_mutex_cv::~__shared_mutex_cv, __shared_mutex_cv::unlock, __shared_mutex_cv::unlock_shared): Likewise. (shared_timed_mutex::try_lock_until, shared_timed_mutex::try_lock_shared_until): Likewise. * include/std/valarray (valarray::valarray(const _Tp*, size_t), valarray::operator=, valarray::sum, valarray::min, valarray::max, _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT, _DEFINE_BINARY_OPERATOR): Likewise. From-SVN: r227595 --- libstdc++-v3/include/std/valarray | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'libstdc++-v3/include/std/valarray') diff --git a/libstdc++-v3/include/std/valarray b/libstdc++-v3/include/std/valarray index 8275249..c3d0047 100644 --- a/libstdc++-v3/include/std/valarray +++ b/libstdc++-v3/include/std/valarray @@ -621,7 +621,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION valarray<_Tp>::valarray(const _Tp* __restrict__ __p, size_t __n) : _M_size(__n), _M_data(__valarray_get_storage<_Tp>(__n)) { - _GLIBCXX_DEBUG_ASSERT(__p != 0 || __n == 0); + __glibcxx_assert(__p != 0 || __n == 0); std::__valarray_copy_construct(__p, __p + __n, _M_data); } @@ -779,7 +779,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION inline valarray<_Tp>& valarray<_Tp>::operator=(const slice_array<_Tp>& __sa) { - _GLIBCXX_DEBUG_ASSERT(_M_size == __sa._M_sz); + __glibcxx_assert(_M_size == __sa._M_sz); std::__valarray_copy(__sa._M_array, __sa._M_sz, __sa._M_stride, _Array<_Tp>(_M_data)); return *this; @@ -789,7 +789,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION inline valarray<_Tp>& valarray<_Tp>::operator=(const gslice_array<_Tp>& __ga) { - _GLIBCXX_DEBUG_ASSERT(_M_size == __ga._M_index.size()); + __glibcxx_assert(_M_size == __ga._M_index.size()); std::__valarray_copy(__ga._M_array, _Array(__ga._M_index), _Array<_Tp>(_M_data), _M_size); return *this; @@ -799,7 +799,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION inline valarray<_Tp>& valarray<_Tp>::operator=(const mask_array<_Tp>& __ma) { - _GLIBCXX_DEBUG_ASSERT(_M_size == __ma._M_sz); + __glibcxx_assert(_M_size == __ma._M_sz); std::__valarray_copy(__ma._M_array, __ma._M_mask, _Array<_Tp>(_M_data), _M_size); return *this; @@ -809,7 +809,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION inline valarray<_Tp>& valarray<_Tp>::operator=(const indirect_array<_Tp>& __ia) { - _GLIBCXX_DEBUG_ASSERT(_M_size == __ia._M_sz); + __glibcxx_assert(_M_size == __ia._M_sz); std::__valarray_copy(__ia._M_array, __ia._M_index, _Array<_Tp>(_M_data), _M_size); return *this; @@ -925,7 +925,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION inline _Tp valarray<_Tp>::sum() const { - _GLIBCXX_DEBUG_ASSERT(_M_size > 0); + __glibcxx_assert(_M_size > 0); return std::__valarray_sum(_M_data, _M_data + _M_size); } @@ -1032,7 +1032,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION inline _Tp valarray<_Tp>::min() const { - _GLIBCXX_DEBUG_ASSERT(_M_size > 0); + __glibcxx_assert(_M_size > 0); return *std::min_element(_M_data, _M_data + _M_size); } @@ -1040,7 +1040,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION inline _Tp valarray<_Tp>::max() const { - _GLIBCXX_DEBUG_ASSERT(_M_size > 0); + __glibcxx_assert(_M_size > 0); return *std::max_element(_M_data, _M_data + _M_size); } @@ -1090,7 +1090,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION inline valarray<_Tp>& \ valarray<_Tp>::operator _Op##=(const valarray<_Tp> &__v) \ { \ - _GLIBCXX_DEBUG_ASSERT(_M_size == __v._M_size); \ + __glibcxx_assert(_M_size == __v._M_size); \ _Array_augmented_##_Name(_Array<_Tp>(_M_data), _M_size, \ _Array<_Tp>(__v._M_data)); \ return *this; \ @@ -1138,7 +1138,7 @@ _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(>>, __shift_right) typename __fun<_Name, _Tp>::result_type> \ operator _Op(const valarray<_Tp>& __v, const valarray<_Tp>& __w) \ { \ - _GLIBCXX_DEBUG_ASSERT(__v.size() == __w.size()); \ + __glibcxx_assert(__v.size() == __w.size()); \ typedef _BinClos<_Name, _ValArray, _ValArray, _Tp, _Tp> _Closure; \ typedef typename __fun<_Name, _Tp>::result_type _Rt; \ return _Expr<_Closure, _Rt>(_Closure(__v, __w)); \ -- cgit v1.1