aboutsummaryrefslogtreecommitdiff
path: root/contrib/libstdc++/include
diff options
context:
space:
mode:
authorPedro F. Giffuni <pfg@FreeBSD.org>2013-11-21 16:44:36 +0000
committerPedro F. Giffuni <pfg@FreeBSD.org>2013-11-21 16:44:36 +0000
commit096464d39c1567ec12e0c29d7445f8b772bcebf1 (patch)
treebebd639c57488848d623918fe8deaf6bdbee0ddf /contrib/libstdc++/include
parent2bd5e058b774c204ec24f362180b9da438d08c31 (diff)
Notes
Diffstat (limited to 'contrib/libstdc++/include')
-rw-r--r--contrib/libstdc++/include/bits/basic_string.h12
-rw-r--r--contrib/libstdc++/include/bits/basic_string.tcc10
-rw-r--r--contrib/libstdc++/include/bits/stl_algobase.h2
-rw-r--r--contrib/libstdc++/include/bits/stl_tree.h2
-rw-r--r--contrib/libstdc++/include/bits/stl_vector.h9
-rw-r--r--contrib/libstdc++/include/ext/mt_allocator.h12
-rw-r--r--contrib/libstdc++/include/ext/throw_allocator.h4
7 files changed, 33 insertions, 18 deletions
diff --git a/contrib/libstdc++/include/bits/basic_string.h b/contrib/libstdc++/include/bits/basic_string.h
index dba1f566db508..90d2e2d5f421b 100644
--- a/contrib/libstdc++/include/bits/basic_string.h
+++ b/contrib/libstdc++/include/bits/basic_string.h
@@ -390,6 +390,16 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_S_copy_chars(_CharT* __p, const _CharT* __k1, const _CharT* __k2)
{ _M_copy(__p, __k1, __k2 - __k1); }
+ static int
+ _S_compare(size_type __x, size_type __y)
+ {
+ if (__x > __y)
+ return 1;
+ if (__x < __y)
+ return -1;
+ return 0;
+ }
+
void
_M_mutate(size_type __pos, size_type __len1, size_type __len2);
@@ -1934,7 +1944,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
int __r = traits_type::compare(_M_data(), __str.data(), __len);
if (!__r)
- __r = __size - __osize;
+ __r = _S_compare(__size, __osize);
return __r;
}
diff --git a/contrib/libstdc++/include/bits/basic_string.tcc b/contrib/libstdc++/include/bits/basic_string.tcc
index c2798efac11f7..78428c1eff69c 100644
--- a/contrib/libstdc++/include/bits/basic_string.tcc
+++ b/contrib/libstdc++/include/bits/basic_string.tcc
@@ -903,7 +903,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
const size_type __len = std::min(__n, __osize);
int __r = traits_type::compare(_M_data() + __pos, __str.data(), __len);
if (!__r)
- __r = __n - __osize;
+ __r = _S_compare(__n, __osize);
return __r;
}
@@ -921,7 +921,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
int __r = traits_type::compare(_M_data() + __pos1,
__str.data() + __pos2, __len);
if (!__r)
- __r = __n1 - __n2;
+ __r = _S_compare(__n1, __n2);
return __r;
}
@@ -936,7 +936,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
const size_type __len = std::min(__size, __osize);
int __r = traits_type::compare(_M_data(), __s, __len);
if (!__r)
- __r = __size - __osize;
+ __r = _S_compare(__size, __osize);
return __r;
}
@@ -952,7 +952,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
const size_type __len = std::min(__n1, __osize);
int __r = traits_type::compare(_M_data() + __pos, __s, __len);
if (!__r)
- __r = __n1 - __osize;
+ __r = _S_compare(__n1, __osize);
return __r;
}
@@ -968,7 +968,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
const size_type __len = std::min(__n1, __n2);
int __r = traits_type::compare(_M_data() + __pos, __s, __len);
if (!__r)
- __r = __n1 - __n2;
+ __r = _S_compare(__n1, __n2);
return __r;
}
diff --git a/contrib/libstdc++/include/bits/stl_algobase.h b/contrib/libstdc++/include/bits/stl_algobase.h
index 6f19febfe1e1d..2d89d0317c8ea 100644
--- a/contrib/libstdc++/include/bits/stl_algobase.h
+++ b/contrib/libstdc++/include/bits/stl_algobase.h
@@ -373,7 +373,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
* @param first An input iterator.
* @param last An input iterator.
* @param result An output iterator.
- * @return result + (first - last)
+ * @return result + (last - first)
*
* This inline function will boil down to a call to @c memmove whenever
* possible. Failing that, if random access iterators are passed, then the
diff --git a/contrib/libstdc++/include/bits/stl_tree.h b/contrib/libstdc++/include/bits/stl_tree.h
index 80cf7c4b08fb0..9e7a9ac31be2a 100644
--- a/contrib/libstdc++/include/bits/stl_tree.h
+++ b/contrib/libstdc++/include/bits/stl_tree.h
@@ -64,6 +64,8 @@
#ifndef _TREE_H
#define _TREE_H 1
+#pragma GCC system_header
+
#include <bits/stl_algobase.h>
#include <bits/allocator.h>
#include <bits/stl_construct.h>
diff --git a/contrib/libstdc++/include/bits/stl_vector.h b/contrib/libstdc++/include/bits/stl_vector.h
index 1b794dc28ee19..60e352cad74b8 100644
--- a/contrib/libstdc++/include/bits/stl_vector.h
+++ b/contrib/libstdc++/include/bits/stl_vector.h
@@ -119,9 +119,12 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD)
_Vector_base(size_t __n, const allocator_type& __a)
: _M_impl(__a)
{
- this->_M_impl._M_start = this->_M_allocate(__n);
- this->_M_impl._M_finish = this->_M_impl._M_start;
- this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __n;
+ if (__n)
+ {
+ this->_M_impl._M_start = this->_M_allocate(__n);
+ this->_M_impl._M_finish = this->_M_impl._M_start;
+ this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __n;
+ }
}
~_Vector_base()
diff --git a/contrib/libstdc++/include/ext/mt_allocator.h b/contrib/libstdc++/include/ext/mt_allocator.h
index bc2d61f6eecd8..bfd9197e0dd99 100644
--- a/contrib/libstdc++/include/ext/mt_allocator.h
+++ b/contrib/libstdc++/include/ext/mt_allocator.h
@@ -342,12 +342,12 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
{ return _M_bin[__which]; }
void
- _M_adjust_freelist(const _Bin_record& __bin, _Block_record* __block,
+ _M_adjust_freelist(const _Bin_record& __bin, _Block_record* __block_record,
size_t __thread_id)
{
if (__gthread_active_p())
{
- __block->_M_thread_id = __thread_id;
+ __block_record->_M_thread_id = __thread_id;
--__bin._M_free[__thread_id];
++__bin._M_used[__thread_id];
}
@@ -697,11 +697,11 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
{
// Already reserved.
typedef typename __pool_type::_Block_record _Block_record;
- _Block_record* __block = __bin._M_first[__thread_id];
- __bin._M_first[__thread_id] = __block->_M_next;
+ _Block_record* __block_record = __bin._M_first[__thread_id];
+ __bin._M_first[__thread_id] = __block_record->_M_next;
- __pool._M_adjust_freelist(__bin, __block, __thread_id);
- __c = reinterpret_cast<char*>(__block) + __pool._M_get_align();
+ __pool._M_adjust_freelist(__bin, __block_record, __thread_id);
+ __c = reinterpret_cast<char*>(__block_record) + __pool._M_get_align();
}
else
{
diff --git a/contrib/libstdc++/include/ext/throw_allocator.h b/contrib/libstdc++/include/ext/throw_allocator.h
index 5886afc79899e..8862153ed7ebc 100644
--- a/contrib/libstdc++/include/ext/throw_allocator.h
+++ b/contrib/libstdc++/include/ext/throw_allocator.h
@@ -423,11 +423,11 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
s += buf;
s += tab;
s += "label: ";
- sprintf(buf, "%u", ref.second.first);
+ sprintf(buf, "%lu", ref.second.first);
s += buf;
s += tab;
s += "size: ";
- sprintf(buf, "%u", ref.second.second);
+ sprintf(buf, "%lu", ref.second.second);
s += buf;
s += '\n';
}