summaryrefslogtreecommitdiff
path: root/libstdc++-v3/include
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-24 09:35:19 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-24 09:35:19 +0000
commit463a39f5ca6152b3a5f722f6c390eb53cffc8ca4 (patch)
treeca7fdfbd6a54e70c271f298827f42551d7baa40a /libstdc++-v3/include
parentabbe4d48527cb8434209c1d1005a3aed61a07076 (diff)
downloadgcc-463a39f5ca6152b3a5f722f6c390eb53cffc8ca4.tar.gz
* include/tr1_impl/array (at): Do not use builtin_expect.
* include/ext/throw_allocator.h (allocate): Likewise. * include/ext/pool_allocator.h (allocate): Likweise. * include/ext/bitmap_allocator.h (allocate): Likewise. * include/ext/rc_string_base.h (_S_construct): Likewise. * include/ext/malloc_allocator.h (allocate): Likewise. * include/ext/mt_allocator.h (allocate): Likewise. * include/ext/sso_string_base.h (_M_construct): Likewise. * include/bits/basic_string.tcc (_S_construct): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@146681 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include')
-rw-r--r--libstdc++-v3/include/bits/basic_string.tcc3
-rw-r--r--libstdc++-v3/include/ext/bitmap_allocator.h2
-rw-r--r--libstdc++-v3/include/ext/malloc_allocator.h2
-rw-r--r--libstdc++-v3/include/ext/mt_allocator.h2
-rw-r--r--libstdc++-v3/include/ext/new_allocator.h2
-rw-r--r--libstdc++-v3/include/ext/pool_allocator.h4
-rw-r--r--libstdc++-v3/include/ext/rc_string_base.h2
-rw-r--r--libstdc++-v3/include/ext/sso_string_base.h2
-rw-r--r--libstdc++-v3/include/ext/throw_allocator.h2
-rw-r--r--libstdc++-v3/include/tr1_impl/array4
10 files changed, 12 insertions, 13 deletions
diff --git a/libstdc++-v3/include/bits/basic_string.tcc b/libstdc++-v3/include/bits/basic_string.tcc
index a5553c61a1b..ec771c66859 100644
--- a/libstdc++-v3/include/bits/basic_string.tcc
+++ b/libstdc++-v3/include/bits/basic_string.tcc
@@ -129,8 +129,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
return _S_empty_rep()._M_refdata();
#endif
// NB: Not required, but considered best practice.
- if (__builtin_expect(__gnu_cxx::__is_null_pointer(__beg)
- && __beg != __end, 0))
+ if (__gnu_cxx::__is_null_pointer(__beg) && __beg != __end)
__throw_logic_error(__N("basic_string::_S_construct NULL not valid"));
const size_type __dnew = static_cast<size_type>(std::distance(__beg,
diff --git a/libstdc++-v3/include/ext/bitmap_allocator.h b/libstdc++-v3/include/ext/bitmap_allocator.h
index e5bfa18ec5b..f6790d00043 100644
--- a/libstdc++-v3/include/ext/bitmap_allocator.h
+++ b/libstdc++-v3/include/ext/bitmap_allocator.h
@@ -1049,7 +1049,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
pointer
allocate(size_type __n)
{
- if (__builtin_expect(__n > this->max_size(), false))
+ if (__n > this->max_size())
std::__throw_bad_alloc();
if (__builtin_expect(__n == 1, true))
diff --git a/libstdc++-v3/include/ext/malloc_allocator.h b/libstdc++-v3/include/ext/malloc_allocator.h
index 4c4a72a171c..b432c63a61e 100644
--- a/libstdc++-v3/include/ext/malloc_allocator.h
+++ b/libstdc++-v3/include/ext/malloc_allocator.h
@@ -84,7 +84,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
pointer
allocate(size_type __n, const void* = 0)
{
- if (__builtin_expect(__n > this->max_size(), false))
+ if (__n > this->max_size())
std::__throw_bad_alloc();
pointer __ret = static_cast<_Tp*>(std::malloc(__n * sizeof(_Tp)));
diff --git a/libstdc++-v3/include/ext/mt_allocator.h b/libstdc++-v3/include/ext/mt_allocator.h
index fc31fe8a737..e44b98d4bf7 100644
--- a/libstdc++-v3/include/ext/mt_allocator.h
+++ b/libstdc++-v3/include/ext/mt_allocator.h
@@ -674,7 +674,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
__mt_alloc<_Tp, _Poolp>::
allocate(size_type __n, const void*)
{
- if (__builtin_expect(__n > this->max_size(), false))
+ if (__n > this->max_size())
std::__throw_bad_alloc();
__policy_type::_S_initialize_once();
diff --git a/libstdc++-v3/include/ext/new_allocator.h b/libstdc++-v3/include/ext/new_allocator.h
index 290c73a11c2..51666c3c7fd 100644
--- a/libstdc++-v3/include/ext/new_allocator.h
+++ b/libstdc++-v3/include/ext/new_allocator.h
@@ -83,7 +83,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
pointer
allocate(size_type __n, const void* = 0)
{
- if (__builtin_expect(__n > this->max_size(), false))
+ if (__n > this->max_size())
std::__throw_bad_alloc();
return static_cast<_Tp*>(::operator new(__n * sizeof(_Tp)));
diff --git a/libstdc++-v3/include/ext/pool_allocator.h b/libstdc++-v3/include/ext/pool_allocator.h
index d7077b1986b..b1e61841c0a 100644
--- a/libstdc++-v3/include/ext/pool_allocator.h
+++ b/libstdc++-v3/include/ext/pool_allocator.h
@@ -200,7 +200,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
pointer __ret = 0;
if (__builtin_expect(__n != 0, true))
{
- if (__builtin_expect(__n > this->max_size(), false))
+ if (__n > this->max_size())
std::__throw_bad_alloc();
// If there is a race through here, assume answer from getenv
@@ -230,7 +230,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
*__free_list = __result->_M_free_list_link;
__ret = reinterpret_cast<_Tp*>(__result);
}
- if (__builtin_expect(__ret == 0, 0))
+ if (__ret == 0)
std::__throw_bad_alloc();
}
}
diff --git a/libstdc++-v3/include/ext/rc_string_base.h b/libstdc++-v3/include/ext/rc_string_base.h
index dce5e06710c..6d8c430d575 100644
--- a/libstdc++-v3/include/ext/rc_string_base.h
+++ b/libstdc++-v3/include/ext/rc_string_base.h
@@ -546,7 +546,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
return _S_empty_rep._M_refcopy();
// NB: Not required, but considered best practice.
- if (__builtin_expect(__is_null_pointer(__beg) && __beg != __end, 0))
+ if (__is_null_pointer(__beg) && __beg != __end)
std::__throw_logic_error(__N("__rc_string_base::"
"_S_construct NULL not valid"));
diff --git a/libstdc++-v3/include/ext/sso_string_base.h b/libstdc++-v3/include/ext/sso_string_base.h
index 85a0d7c9b18..6d2af7c46dd 100644
--- a/libstdc++-v3/include/ext/sso_string_base.h
+++ b/libstdc++-v3/include/ext/sso_string_base.h
@@ -428,7 +428,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
std::forward_iterator_tag)
{
// NB: Not required, but considered best practice.
- if (__builtin_expect(__is_null_pointer(__beg) && __beg != __end, 0))
+ if (__is_null_pointer(__beg) && __beg != __end)
std::__throw_logic_error(__N("__sso_string_base::"
"_M_construct NULL not valid"));
diff --git a/libstdc++-v3/include/ext/throw_allocator.h b/libstdc++-v3/include/ext/throw_allocator.h
index c87408fd931..13030546943 100644
--- a/libstdc++-v3/include/ext/throw_allocator.h
+++ b/libstdc++-v3/include/ext/throw_allocator.h
@@ -220,7 +220,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
pointer
allocate(size_type __n, std::allocator<void>::const_pointer hint = 0)
{
- if (__builtin_expect(__n > this->max_size(), false))
+ if (__n > this->max_size())
std::__throw_bad_alloc();
throw_conditionally();
diff --git a/libstdc++-v3/include/tr1_impl/array b/libstdc++-v3/include/tr1_impl/array
index c0bd24076fa..7cd3db3d0f9 100644
--- a/libstdc++-v3/include/tr1_impl/array
+++ b/libstdc++-v3/include/tr1_impl/array
@@ -149,7 +149,7 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
reference
at(size_type __n)
{
- if (__builtin_expect(__n >= _Nm, false))
+ if (__n >= _Nm)
std::__throw_out_of_range(__N("array::at"));
return _M_instance[__n];
}
@@ -157,7 +157,7 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
const_reference
at(size_type __n) const
{
- if (__builtin_expect(__n >= _Nm, false))
+ if (__n >= _Nm)
std::__throw_out_of_range(__N("array::at"));
return _M_instance[__n];
}