summaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/bits
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/include/bits')
-rw-r--r--libstdc++-v3/include/bits/algorithmfwd.h3
-rw-r--r--libstdc++-v3/include/bits/basic_ios.h4
-rw-r--r--libstdc++-v3/include/bits/basic_string.h11
-rw-r--r--libstdc++-v3/include/bits/c++config78
-rw-r--r--libstdc++-v3/include/bits/deque.tcc2
-rw-r--r--libstdc++-v3/include/bits/forward_list.h2
-rw-r--r--libstdc++-v3/include/bits/forward_list.tcc2
-rw-r--r--libstdc++-v3/include/bits/fstream.tcc110
-rw-r--r--libstdc++-v3/include/bits/hashtable_policy.h6
-rw-r--r--libstdc++-v3/include/bits/ios_base.h4
-rw-r--r--libstdc++-v3/include/bits/istream.tcc50
-rw-r--r--libstdc++-v3/include/bits/list.tcc2
-rw-r--r--libstdc++-v3/include/bits/locale_facets.h4
-rw-r--r--libstdc++-v3/include/bits/locale_facets_nonio.h2
-rw-r--r--libstdc++-v3/include/bits/move.h9
-rw-r--r--libstdc++-v3/include/bits/quoted_string.h8
-rw-r--r--libstdc++-v3/include/bits/random.h9
-rw-r--r--libstdc++-v3/include/bits/random.tcc7
-rw-r--r--libstdc++-v3/include/bits/regex.h142
-rw-r--r--libstdc++-v3/include/bits/regex.tcc9
-rw-r--r--libstdc++-v3/include/bits/regex_automaton.h7
-rw-r--r--libstdc++-v3/include/bits/regex_automaton.tcc6
-rw-r--r--libstdc++-v3/include/bits/regex_compiler.h5
-rw-r--r--libstdc++-v3/include/bits/regex_compiler.tcc6
-rw-r--r--libstdc++-v3/include/bits/regex_constants.h9
-rw-r--r--libstdc++-v3/include/bits/regex_error.h7
-rw-r--r--libstdc++-v3/include/bits/regex_executor.h6
-rw-r--r--libstdc++-v3/include/bits/regex_executor.tcc6
-rw-r--r--libstdc++-v3/include/bits/regex_scanner.h6
-rw-r--r--libstdc++-v3/include/bits/regex_scanner.tcc6
-rw-r--r--libstdc++-v3/include/bits/specfun.h2
-rw-r--r--libstdc++-v3/include/bits/sstream.tcc21
-rw-r--r--libstdc++-v3/include/bits/stl_algo.h8
-rw-r--r--libstdc++-v3/include/bits/stl_algobase.h3
-rw-r--r--libstdc++-v3/include/bits/stl_bvector.h4
-rw-r--r--libstdc++-v3/include/bits/stl_deque.h2
-rw-r--r--libstdc++-v3/include/bits/stl_iterator.h13
-rw-r--r--libstdc++-v3/include/bits/stl_iterator_base_funcs.h4
-rw-r--r--libstdc++-v3/include/bits/stl_list.h163
-rw-r--r--libstdc++-v3/include/bits/stl_map.h4
-rw-r--r--libstdc++-v3/include/bits/stl_multimap.h4
-rw-r--r--libstdc++-v3/include/bits/stl_multiset.h4
-rw-r--r--libstdc++-v3/include/bits/stl_relops.h7
-rw-r--r--libstdc++-v3/include/bits/stl_set.h4
-rw-r--r--libstdc++-v3/include/bits/stl_vector.h149
-rw-r--r--libstdc++-v3/include/bits/uniform_int_dist.h5
-rw-r--r--libstdc++-v3/include/bits/unordered_map.h4
-rw-r--r--libstdc++-v3/include/bits/unordered_set.h4
-rw-r--r--libstdc++-v3/include/bits/uses_allocator.h5
-rw-r--r--libstdc++-v3/include/bits/vector.tcc66
50 files changed, 586 insertions, 418 deletions
diff --git a/libstdc++-v3/include/bits/algorithmfwd.h b/libstdc++-v3/include/bits/algorithmfwd.h
index 3ff4ff71230..673b98e7867 100644
--- a/libstdc++-v3/include/bits/algorithmfwd.h
+++ b/libstdc++-v3/include/bits/algorithmfwd.h
@@ -615,8 +615,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_FIter
upper_bound(_FIter, _FIter, const _Tp&, _Compare);
-_GLIBCXX_END_NAMESPACE_VERSION
-
_GLIBCXX_BEGIN_NAMESPACE_ALGO
template<typename _FIter>
@@ -845,6 +843,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
unique_copy(_IIter, _IIter, _OIter, _BinaryPredicate);
_GLIBCXX_END_NAMESPACE_ALGO
+_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#ifdef _GLIBCXX_PARALLEL
diff --git a/libstdc++-v3/include/bits/basic_ios.h b/libstdc++-v3/include/bits/basic_ios.h
index 318e41b7c55..f0b8682b4fe 100644
--- a/libstdc++-v3/include/bits/basic_ios.h
+++ b/libstdc++-v3/include/bits/basic_ios.h
@@ -157,8 +157,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
setstate(iostate __state)
{ this->clear(this->rdstate() | __state); }
- // Flip the internal state on for the proper state bits, then re
- // throws the propagated exception if bit also set in
+ // Flip the internal state on for the proper state bits, then
+ // rethrows the propagated exception if bit also set in
// exceptions().
void
_M_setstate(iostate __state)
diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h
index 519d686063e..a343d7b1628 100644
--- a/libstdc++-v3/include/bits/basic_string.h
+++ b/libstdc++-v3/include/bits/basic_string.h
@@ -2918,7 +2918,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
int
compare(size_type __pos, size_type __n1, const _CharT* __s,
size_type __n2) const;
- };
+
+ // Allow basic_stringbuf::__xfer_bufptrs to call _M_length:
+ template<typename, typename, typename> friend class basic_stringbuf;
+ };
_GLIBCXX_END_NAMESPACE_CXX11
#else // !_GLIBCXX_USE_CXX11_ABI
// Reference-counted COW string implentation
@@ -6467,8 +6470,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ };
#endif
-_GLIBCXX_END_NAMESPACE_VERSION
-
#if __cplusplus > 201103L
#define __cpp_lib_string_udls 201304
@@ -6477,8 +6478,6 @@ _GLIBCXX_END_NAMESPACE_VERSION
{
inline namespace string_literals
{
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
-
_GLIBCXX_DEFAULT_ABI_TAG
inline basic_string<char>
operator""s(const char* __str, size_t __len)
@@ -6503,12 +6502,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ return basic_string<char32_t>{__str, __len}; }
#endif
-_GLIBCXX_END_NAMESPACE_VERSION
} // inline namespace string_literals
} // inline namespace literals
#endif // __cplusplus > 201103L
+_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // C++11
diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config
index 3e3905010f7..d5d1d24ee1a 100644
--- a/libstdc++-v3/include/bits/c++config
+++ b/libstdc++-v3/include/bits/c++config
@@ -267,88 +267,58 @@ namespace __gnu_cxx
# define _GLIBCXX_DEFAULT_ABI_TAG
#endif
-
// Defined if inline namespaces are used for versioning.
#define _GLIBCXX_INLINE_VERSION
// Inline namespace for symbol versioning.
#if _GLIBCXX_INLINE_VERSION
+# define _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace __8 {
+# define _GLIBCXX_END_NAMESPACE_VERSION }
namespace std
{
- inline namespace __8 { }
-
- namespace rel_ops { inline namespace __8 { } }
-
- namespace tr1
- {
- inline namespace __8 { }
- namespace placeholders { inline namespace __8 { } }
- namespace regex_constants { inline namespace __8 { } }
- namespace __detail { inline namespace __8 { } }
- }
-
- namespace tr2
- { inline namespace __8 { } }
-
- namespace decimal { inline namespace __8 { } }
-
-#if __cplusplus >= 201103L
- namespace chrono { inline namespace __8 { } }
- namespace placeholders { inline namespace __8 { } }
- namespace regex_constants { inline namespace __8 { } }
- namespace this_thread { inline namespace __8 { } }
-
+inline _GLIBCXX_BEGIN_NAMESPACE_VERSION
#if __cplusplus >= 201402L
inline namespace literals {
- inline namespace chrono_literals { inline namespace __8 { } }
- inline namespace complex_literals { inline namespace __8 { } }
- inline namespace string_literals { inline namespace __8 { } }
+ inline namespace chrono_literals { }
+ inline namespace complex_literals { }
+ inline namespace string_literals { }
#if __cplusplus > 201402L
- inline namespace string_view_literals { inline namespace __8 { } }
+ inline namespace string_view_literals { }
#endif // C++17
}
#endif // C++14
-#endif // C++11
-
- namespace __detail {
- inline namespace __8 { }
-#if __cplusplus > 201402L
- namespace __variant { inline namespace __8 { } }
-#endif
- }
+_GLIBCXX_END_NAMESPACE_VERSION
}
namespace __gnu_cxx
{
- inline namespace __8 { }
- namespace __detail { inline namespace __8 { } }
+inline _GLIBCXX_BEGIN_NAMESPACE_VERSION
+_GLIBCXX_END_NAMESPACE_VERSION
}
-# define _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace __8 {
-# define _GLIBCXX_END_NAMESPACE_VERSION }
+
#else
# define _GLIBCXX_BEGIN_NAMESPACE_VERSION
# define _GLIBCXX_END_NAMESPACE_VERSION
#endif
-
// Inline namespaces for special modes: debug, parallel, profile.
#if defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PARALLEL) \
|| defined(_GLIBCXX_PROFILE)
namespace std
{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
// Non-inline namespace for components replaced by alternates in active mode.
namespace __cxx1998
{
-# if _GLIBCXX_INLINE_VERSION
- inline namespace __8 { }
-# endif
-
# if _GLIBCXX_USE_CXX11_ABI
inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { }
# endif
}
+_GLIBCXX_END_NAMESPACE_VERSION
+
// Inline namespace for debug mode.
# ifdef _GLIBCXX_DEBUG
inline namespace __debug { }
@@ -396,25 +366,23 @@ namespace std
#if defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PROFILE)
# define _GLIBCXX_STD_C __cxx1998
# define _GLIBCXX_BEGIN_NAMESPACE_CONTAINER \
- namespace _GLIBCXX_STD_C { _GLIBCXX_BEGIN_NAMESPACE_VERSION
-# define _GLIBCXX_END_NAMESPACE_CONTAINER \
- _GLIBCXX_END_NAMESPACE_VERSION }
+ namespace _GLIBCXX_STD_C {
+# define _GLIBCXX_END_NAMESPACE_CONTAINER }
#else
# define _GLIBCXX_STD_C std
-# define _GLIBCXX_BEGIN_NAMESPACE_CONTAINER _GLIBCXX_BEGIN_NAMESPACE_VERSION
-# define _GLIBCXX_END_NAMESPACE_CONTAINER _GLIBCXX_END_NAMESPACE_VERSION
+# define _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
+# define _GLIBCXX_END_NAMESPACE_CONTAINER
#endif
#ifdef _GLIBCXX_PARALLEL
# define _GLIBCXX_STD_A __cxx1998
# define _GLIBCXX_BEGIN_NAMESPACE_ALGO \
- namespace _GLIBCXX_STD_A { _GLIBCXX_BEGIN_NAMESPACE_VERSION
-# define _GLIBCXX_END_NAMESPACE_ALGO \
- _GLIBCXX_END_NAMESPACE_VERSION }
+ namespace _GLIBCXX_STD_A {
+# define _GLIBCXX_END_NAMESPACE_ALGO }
#else
# define _GLIBCXX_STD_A std
-# define _GLIBCXX_BEGIN_NAMESPACE_ALGO _GLIBCXX_BEGIN_NAMESPACE_VERSION
-# define _GLIBCXX_END_NAMESPACE_ALGO _GLIBCXX_END_NAMESPACE_VERSION
+# define _GLIBCXX_BEGIN_NAMESPACE_ALGO
+# define _GLIBCXX_END_NAMESPACE_ALGO
#endif
// GLIBCXX_ABI Deprecated
diff --git a/libstdc++-v3/include/bits/deque.tcc b/libstdc++-v3/include/bits/deque.tcc
index 38a6e82aaef..d25ad690178 100644
--- a/libstdc++-v3/include/bits/deque.tcc
+++ b/libstdc++-v3/include/bits/deque.tcc
@@ -58,6 +58,7 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
#if __cplusplus >= 201103L
@@ -1107,6 +1108,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
#endif
_GLIBCXX_END_NAMESPACE_CONTAINER
+_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif
diff --git a/libstdc++-v3/include/bits/forward_list.h b/libstdc++-v3/include/bits/forward_list.h
index f319b7f0607..9d86fcc1568 100644
--- a/libstdc++-v3/include/bits/forward_list.h
+++ b/libstdc++-v3/include/bits/forward_list.h
@@ -43,6 +43,7 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
/**
@@ -1440,6 +1441,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
{ __lx.swap(__ly); }
_GLIBCXX_END_NAMESPACE_CONTAINER
+_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // _FORWARD_LIST_H
diff --git a/libstdc++-v3/include/bits/forward_list.tcc b/libstdc++-v3/include/bits/forward_list.tcc
index b823b09e1af..64bd9c4bf13 100644
--- a/libstdc++-v3/include/bits/forward_list.tcc
+++ b/libstdc++-v3/include/bits/forward_list.tcc
@@ -32,6 +32,7 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Tp, typename _Alloc>
@@ -493,6 +494,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
}
_GLIBCXX_END_NAMESPACE_CONTAINER
+_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif /* _FORWARD_LIST_TCC */
diff --git a/libstdc++-v3/include/bits/fstream.tcc b/libstdc++-v3/include/bits/fstream.tcc
index b1beff86ab5..12ea977b997 100644
--- a/libstdc++-v3/include/bits/fstream.tcc
+++ b/libstdc++-v3/include/bits/fstream.tcc
@@ -649,11 +649,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
else if (_M_writing)
{
- if (overflow() == traits_type::eof())
- return __ret;
- _M_set_buffer(-1);
- _M_writing = false;
- }
+ if (overflow() == traits_type::eof())
+ return __ret;
+ _M_set_buffer(-1);
+ _M_writing = false;
+ }
// Optimization in the always_noconv() case, to be generalized in the
// future: when __n > __buflen we read directly instead of using the
@@ -662,57 +662,55 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
const streamsize __buflen = _M_buf_size > 1 ? _M_buf_size - 1 : 1;
if (__n > __buflen && __check_facet(_M_codecvt).always_noconv()
- && __testin)
- {
- // First, copy the chars already present in the buffer.
- const streamsize __avail = this->egptr() - this->gptr();
- if (__avail != 0)
- {
- traits_type::copy(__s, this->gptr(), __avail);
- __s += __avail;
- this->setg(this->eback(), this->gptr() + __avail,
- this->egptr());
- __ret += __avail;
- __n -= __avail;
- }
-
- // Need to loop in case of short reads (relatively common
- // with pipes).
- streamsize __len;
- for (;;)
- {
- __len = _M_file.xsgetn(reinterpret_cast<char*>(__s),
- __n);
- if (__len == -1)
- __throw_ios_failure(__N("basic_filebuf::xsgetn "
- "error reading the file"));
- if (__len == 0)
- break;
-
- __n -= __len;
- __ret += __len;
- if (__n == 0)
- break;
+ && __testin)
+ {
+ // First, copy the chars already present in the buffer.
+ const streamsize __avail = this->egptr() - this->gptr();
+ if (__avail != 0)
+ {
+ traits_type::copy(__s, this->gptr(), __avail);
+ __s += __avail;
+ this->setg(this->eback(), this->gptr() + __avail, this->egptr());
+ __ret += __avail;
+ __n -= __avail;
+ }
- __s += __len;
- }
+ // Need to loop in case of short reads (relatively common
+ // with pipes).
+ streamsize __len;
+ for (;;)
+ {
+ __len = _M_file.xsgetn(reinterpret_cast<char*>(__s), __n);
+ if (__len == -1)
+ __throw_ios_failure(__N("basic_filebuf::xsgetn "
+ "error reading the file"));
+ if (__len == 0)
+ break;
- if (__n == 0)
- {
- _M_set_buffer(0);
- _M_reading = true;
- }
- else if (__len == 0)
- {
- // If end of file is reached, set 'uncommitted'
- // mode, thus allowing an immediate write without
- // an intervening seek.
- _M_set_buffer(-1);
- _M_reading = false;
- }
- }
+ __n -= __len;
+ __ret += __len;
+ if (__n == 0)
+ break;
+
+ __s += __len;
+ }
+
+ if (__n == 0)
+ {
+ // Set _M_reading. Buffer is already in initial 'read' mode.
+ _M_reading = true;
+ }
+ else if (__len == 0)
+ {
+ // If end of file is reached, set 'uncommitted'
+ // mode, thus allowing an immediate write without
+ // an intervening seek.
+ _M_set_buffer(-1);
+ _M_reading = false;
+ }
+ }
else
- __ret += __streambuf_type::xsgetn(__s, __n);
+ __ret += __streambuf_type::xsgetn(__s, __n);
return __ret;
}
@@ -729,7 +727,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
const bool __testout = (_M_mode & ios_base::out
|| _M_mode & ios_base::app);
if (__check_facet(_M_codecvt).always_noconv()
- && __testout && !_M_reading)
+ && __testout && !_M_reading)
{
// Measurement would reveal the best choice.
const streamsize __chunk = 1ul << 10;
@@ -839,8 +837,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
if (_M_writing)
__computed_off = this->pptr() - this->pbase();
- off_type __file_off = _M_file.seekoff(0, ios_base::cur);
- if (__file_off != off_type(-1))
+ off_type __file_off = _M_file.seekoff(0, ios_base::cur);
+ if (__file_off != off_type(-1))
{
__ret = __file_off + __computed_off;
__ret.state(__state);
diff --git a/libstdc++-v3/include/bits/hashtable_policy.h b/libstdc++-v3/include/bits/hashtable_policy.h
index 8af8c498de2..a3a31d1fb11 100644
--- a/libstdc++-v3/include/bits/hashtable_policy.h
+++ b/libstdc++-v3/include/bits/hashtable_policy.h
@@ -43,12 +43,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typename _RehashPolicy, typename _Traits>
class _Hashtable;
-_GLIBCXX_END_NAMESPACE_VERSION
-
namespace __detail
{
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
-
/**
* @defgroup hashtable-detail Base and Implementation Classes
* @ingroup unordered_associative_containers
@@ -2122,8 +2118,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
//@} hashtable-detail
-_GLIBCXX_END_NAMESPACE_VERSION
} // namespace __detail
+_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // _HASHTABLE_POLICY_H
diff --git a/libstdc++-v3/include/bits/ios_base.h b/libstdc++-v3/include/bits/ios_base.h
index e5a107db4bc..e68b4305517 100644
--- a/libstdc++-v3/include/bits/ios_base.h
+++ b/libstdc++-v3/include/bits/ios_base.h
@@ -469,13 +469,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/// Request a seek relative to the current end of the sequence.
static const seekdir end = _S_end;
- // Annex D.6
+#if __cplusplus <= 201402L
+ // Annex D.6 (removed in C++17)
typedef int io_state;
typedef int open_mode;
typedef int seek_dir;
typedef std::streampos streampos;
typedef std::streamoff streamoff;
+#endif
// Callbacks;
/**
diff --git a/libstdc++-v3/include/bits/istream.tcc b/libstdc++-v3/include/bits/istream.tcc
index b390f743bba..92df9d126ef 100644
--- a/libstdc++-v3/include/bits/istream.tcc
+++ b/libstdc++-v3/include/bits/istream.tcc
@@ -48,28 +48,36 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
ios_base::iostate __err = ios_base::goodbit;
if (__in.good())
- {
- if (__in.tie())
- __in.tie()->flush();
- if (!__noskip && bool(__in.flags() & ios_base::skipws))
- {
- const __int_type __eof = traits_type::eof();
- __streambuf_type* __sb = __in.rdbuf();
- __int_type __c = __sb->sgetc();
-
- const __ctype_type& __ct = __check_facet(__in._M_ctype);
- while (!traits_type::eq_int_type(__c, __eof)
- && __ct.is(ctype_base::space,
- traits_type::to_char_type(__c)))
- __c = __sb->snextc();
+ __try
+ {
+ if (__in.tie())
+ __in.tie()->flush();
+ if (!__noskip && bool(__in.flags() & ios_base::skipws))
+ {
+ const __int_type __eof = traits_type::eof();
+ __streambuf_type* __sb = __in.rdbuf();
+ __int_type __c = __sb->sgetc();
+
+ const __ctype_type& __ct = __check_facet(__in._M_ctype);
+ while (!traits_type::eq_int_type(__c, __eof)
+ && __ct.is(ctype_base::space,
+ traits_type::to_char_type(__c)))
+ __c = __sb->snextc();
- // _GLIBCXX_RESOLVE_LIB_DEFECTS
- // 195. Should basic_istream::sentry's constructor ever
- // set eofbit?
- if (traits_type::eq_int_type(__c, __eof))
- __err |= ios_base::eofbit;
- }
- }
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 195. Should basic_istream::sentry's constructor ever
+ // set eofbit?
+ if (traits_type::eq_int_type(__c, __eof))
+ __err |= ios_base::eofbit;
+ }
+ }
+ __catch(__cxxabiv1::__forced_unwind&)
+ {
+ __in._M_setstate(ios_base::badbit);
+ __throw_exception_again;
+ }
+ __catch(...)
+ { __in._M_setstate(ios_base::badbit); }
if (__in.good() && __err == ios_base::goodbit)
_M_ok = true;
diff --git a/libstdc++-v3/include/bits/list.tcc b/libstdc++-v3/include/bits/list.tcc
index fcb8353e09f..e21dab54263 100644
--- a/libstdc++-v3/include/bits/list.tcc
+++ b/libstdc++-v3/include/bits/list.tcc
@@ -58,6 +58,7 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Tp, typename _Alloc>
@@ -594,6 +595,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
}
_GLIBCXX_END_NAMESPACE_CONTAINER
+_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif /* _LIST_TCC */
diff --git a/libstdc++-v3/include/bits/locale_facets.h b/libstdc++-v3/include/bits/locale_facets.h
index 1ad0eb5ab66..9a74677b393 100644
--- a/libstdc++-v3/include/bits/locale_facets.h
+++ b/libstdc++-v3/include/bits/locale_facets.h
@@ -1487,7 +1487,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
protected:
virtual
- ~ctype_byname() { };
+ ~ctype_byname() { }
};
/// 22.2.1.4 Class ctype_byname specializations.
@@ -2486,7 +2486,7 @@ _GLIBCXX_BEGIN_NAMESPACE_LDBL
/// Destructor.
virtual
- ~num_put() { };
+ ~num_put() { }
//@{
/**
diff --git a/libstdc++-v3/include/bits/locale_facets_nonio.h b/libstdc++-v3/include/bits/locale_facets_nonio.h
index 0cd307fb5ed..0068cd3addd 100644
--- a/libstdc++-v3/include/bits/locale_facets_nonio.h
+++ b/libstdc++-v3/include/bits/locale_facets_nonio.h
@@ -898,7 +898,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
explicit
time_put_byname(const char*, size_t __refs = 0)
: time_put<_CharT, _OutIter>(__refs)
- { };
+ { }
#if __cplusplus >= 201103L
explicit
diff --git a/libstdc++-v3/include/bits/move.h b/libstdc++-v3/include/bits/move.h
index 5f47b0e7bae..373f9556524 100644
--- a/libstdc++-v3/include/bits/move.h
+++ b/libstdc++-v3/include/bits/move.h
@@ -47,10 +47,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__addressof(_Tp& __r) _GLIBCXX_NOEXCEPT
{ return __builtin_addressof(__r); }
+#if __cplusplus >= 201103L
+
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
-#if __cplusplus >= 201103L
#include <type_traits> // Brings in std::declval too.
namespace std _GLIBCXX_VISIBILITY(default)
@@ -153,8 +154,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
/// @} group utilities
-_GLIBCXX_END_NAMESPACE_VERSION
-} // namespace
#define _GLIBCXX_MOVE(__val) std::move(__val)
#define _GLIBCXX_FORWARD(_Tp, __val) std::forward<_Tp>(__val)
@@ -163,10 +162,6 @@ _GLIBCXX_END_NAMESPACE_VERSION
#define _GLIBCXX_FORWARD(_Tp, __val) (__val)
#endif
-namespace std _GLIBCXX_VISIBILITY(default)
-{
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
-
/**
* @addtogroup utilities
* @{
diff --git a/libstdc++-v3/include/bits/quoted_string.h b/libstdc++-v3/include/bits/quoted_string.h
index 10cfec21181..0e51c223433 100644
--- a/libstdc++-v3/include/bits/quoted_string.h
+++ b/libstdc++-v3/include/bits/quoted_string.h
@@ -39,9 +39,9 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
- namespace __detail {
- _GLIBCXX_BEGIN_NAMESPACE_VERSION
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+ namespace __detail {
/**
* @brief Struct for delimited strings.
*/
@@ -155,9 +155,9 @@ namespace std _GLIBCXX_VISIBILITY(default)
return __is;
}
-
- _GLIBCXX_END_NAMESPACE_VERSION
} // namespace __detail
+
+_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // C++11
diff --git a/libstdc++-v3/include/bits/random.h b/libstdc++-v3/include/bits/random.h
index bb761ec8fb0..2b022b2f469 100644
--- a/libstdc++-v3/include/bits/random.h
+++ b/libstdc++-v3/include/bits/random.h
@@ -58,15 +58,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_RealType
generate_canonical(_UniformRandomNumberGenerator& __g);
-_GLIBCXX_END_NAMESPACE_VERSION
-
/*
* Implementation-space details.
*/
namespace __detail
{
- _GLIBCXX_BEGIN_NAMESPACE_VERSION
-
template<typename _UIntType, size_t __w,
bool = __w < static_cast<size_t>
(std::numeric_limits<_UIntType>::digits)>
@@ -189,11 +185,8 @@ _GLIBCXX_END_NAMESPACE_VERSION
_Engine& _M_g;
};
- _GLIBCXX_END_NAMESPACE_VERSION
} // namespace __detail
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
-
/**
* @addtogroup random_generators Random Number Generators
* @ingroup random
@@ -520,7 +513,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
static constexpr result_type
min()
- { return 0; };
+ { return 0; }
/**
* @brief Gets the largest possible value in the output range.
diff --git a/libstdc++-v3/include/bits/random.tcc b/libstdc++-v3/include/bits/random.tcc
index 63d1c020285..95bcf0a163e 100644
--- a/libstdc++-v3/include/bits/random.tcc
+++ b/libstdc++-v3/include/bits/random.tcc
@@ -34,13 +34,13 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
/*
* (Further) implementation-space details.
*/
namespace __detail
{
- _GLIBCXX_BEGIN_NAMESPACE_VERSION
-
// General case for x = (ax + c) mod m -- use Schrage's algorithm
// to avoid integer overflow.
//
@@ -89,11 +89,8 @@ namespace std _GLIBCXX_VISIBILITY(default)
return __result;
}
- _GLIBCXX_END_NAMESPACE_VERSION
} // namespace __detail
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
-
template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
constexpr _UIntType
linear_congruential_engine<_UIntType, __a, __c, __m>::multiplier;
diff --git a/libstdc++-v3/include/bits/regex.h b/libstdc++-v3/include/bits/regex.h
index 0bb88cb6afb..32e7159eec9 100644
--- a/libstdc++-v3/include/bits/regex.h
+++ b/libstdc++-v3/include/bits/regex.h
@@ -39,12 +39,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
class match_results;
_GLIBCXX_END_NAMESPACE_CXX11
-_GLIBCXX_END_NAMESPACE_VERSION
namespace __detail
{
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
-
enum class _RegexExecutorPolicy : int
{ _S_auto, _S_alternate };
@@ -53,19 +50,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_RegexExecutorPolicy __policy,
bool __match_mode>
bool
- __regex_algo_impl(_BiIter __s,
- _BiIter __e,
+ __regex_algo_impl(_BiIter __s,
+ _BiIter __e,
match_results<_BiIter, _Alloc>& __m,
const basic_regex<_CharT, _TraitsT>& __re,
regex_constants::match_flag_type __flags);
template<typename, typename, typename, bool>
class _Executor;
-
-_GLIBCXX_END_NAMESPACE_VERSION
}
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_BEGIN_NAMESPACE_CXX11
/**
@@ -87,9 +81,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
struct regex_traits
{
public:
- typedef _Ch_type char_type;
- typedef std::basic_string<char_type> string_type;
- typedef std::locale locale_type;
+ typedef _Ch_type char_type;
+ typedef std::basic_string<char_type> string_type;
+ typedef std::locale locale_type;
private:
struct _RegexMask
{
@@ -397,8 +391,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
"regex traits class must have the same char_type");
// types:
- typedef _Ch_type value_type;
- typedef _Rx_traits traits_type;
+ typedef _Ch_type value_type;
+ typedef _Rx_traits traits_type;
typedef typename traits_type::string_type string_type;
typedef regex_constants::syntax_option_type flag_type;
typedef typename traits_type::locale_type locale_type;
@@ -771,20 +765,17 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
template<typename _Bp, typename _Ap, typename _Cp, typename _Rp,
__detail::_RegexExecutorPolicy, bool>
- friend bool __detail::
-#if _GLIBCXX_INLINE_VERSION
- __8:: // Required due to PR c++/59256
-#endif
- __regex_algo_impl(_Bp, _Bp, match_results<_Bp, _Ap>&,
- const basic_regex<_Cp, _Rp>&,
- regex_constants::match_flag_type);
+ friend bool
+ __detail::__regex_algo_impl(_Bp, _Bp, match_results<_Bp, _Ap>&,
+ const basic_regex<_Cp, _Rp>&,
+ regex_constants::match_flag_type);
template<typename, typename, typename, bool>
friend class __detail::_Executor;
- flag_type _M_flags;
- locale_type _M_loc;
- _AutomatonPtr _M_automaton;
+ flag_type _M_flags;
+ locale_type _M_loc;
+ _AutomatonPtr _M_automaton;
};
#if __cpp_deduction_guides >= 201606
@@ -837,8 +828,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
public:
typedef typename __iter_traits::value_type value_type;
typedef typename __iter_traits::difference_type difference_type;
- typedef _BiIter iterator;
- typedef std::basic_string<value_type> string_type;
+ typedef _BiIter iterator;
+ typedef std::basic_string<value_type> string_type;
bool matched;
@@ -923,14 +914,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
/** @brief Standard regex submatch over a C-style null-terminated string. */
- typedef sub_match<const char*> csub_match;
+ typedef sub_match<const char*> csub_match;
/** @brief Standard regex submatch over a standard string. */
typedef sub_match<string::const_iterator> ssub_match;
#ifdef _GLIBCXX_USE_WCHAR_T
/** @brief Regex submatch over a C-style null-terminated wide string. */
- typedef sub_match<const wchar_t*> wcsub_match;
+ typedef sub_match<const wchar_t*> wcsub_match;
/** @brief Regex submatch over a standard wide string. */
typedef sub_match<wstring::const_iterator> wssub_match;
@@ -1548,16 +1539,16 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
* @name 10.? Public Types
*/
//@{
- typedef sub_match<_Bi_iter> value_type;
- typedef const value_type& const_reference;
- typedef const_reference reference;
- typedef typename _Base_type::const_iterator const_iterator;
- typedef const_iterator iterator;
+ typedef sub_match<_Bi_iter> value_type;
+ typedef const value_type& const_reference;
+ typedef const_reference reference;
+ typedef typename _Base_type::const_iterator const_iterator;
+ typedef const_iterator iterator;
typedef typename __iter_traits::difference_type difference_type;
typedef typename allocator_traits<_Alloc>::size_type size_type;
- typedef _Alloc allocator_type;
+ typedef _Alloc allocator_type;
typedef typename __iter_traits::value_type char_type;
- typedef std::basic_string<char_type> string_type;
+ typedef std::basic_string<char_type> string_type;
//@}
public:
@@ -1872,13 +1863,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
template<typename _Bp, typename _Ap, typename _Cp, typename _Rp,
__detail::_RegexExecutorPolicy, bool>
- friend bool __detail::
-#if _GLIBCXX_INLINE_VERSION
- __8:: // Required due to PR c++/59256
-#endif
- __regex_algo_impl(_Bp, _Bp, match_results<_Bp, _Ap>&,
- const basic_regex<_Cp, _Rp>&,
- regex_constants::match_flag_type);
+ friend bool
+ __detail::__regex_algo_impl(_Bp, _Bp, match_results<_Bp, _Ap>&,
+ const basic_regex<_Cp, _Rp>&,
+ regex_constants::match_flag_type);
void
_M_resize(unsigned int __size)
@@ -1911,10 +1899,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
_Bi_iter _M_begin;
};
- typedef match_results<const char*> cmatch;
- typedef match_results<string::const_iterator> smatch;
+ typedef match_results<const char*> cmatch;
+ typedef match_results<string::const_iterator> smatch;
#ifdef _GLIBCXX_USE_WCHAR_T
- typedef match_results<const wchar_t*> wcmatch;
+ typedef match_results<const wchar_t*> wcmatch;
typedef match_results<wstring::const_iterator> wsmatch;
#endif
@@ -1994,11 +1982,11 @@ _GLIBCXX_END_NAMESPACE_CXX11
template<typename _Bi_iter, typename _Alloc,
typename _Ch_type, typename _Rx_traits>
inline bool
- regex_match(_Bi_iter __s,
- _Bi_iter __e,
- match_results<_Bi_iter, _Alloc>& __m,
+ regex_match(_Bi_iter __s,
+ _Bi_iter __e,
+ match_results<_Bi_iter, _Alloc>& __m,
const basic_regex<_Ch_type, _Rx_traits>& __re,
- regex_constants::match_flag_type __flags
+ regex_constants::match_flag_type __flags
= regex_constants::match_default)
{
return __detail::__regex_algo_impl<_Bi_iter, _Alloc, _Ch_type, _Rx_traits,
@@ -2452,11 +2440,11 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
{
public:
typedef basic_regex<_Ch_type, _Rx_traits> regex_type;
- typedef match_results<_Bi_iter> value_type;
- typedef std::ptrdiff_t difference_type;
- typedef const value_type* pointer;
- typedef const value_type& reference;
- typedef std::forward_iterator_tag iterator_category;
+ typedef match_results<_Bi_iter> value_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef const value_type* pointer;
+ typedef const value_type& reference;
+ typedef std::forward_iterator_tag iterator_category;
/**
* @brief Provides a singular iterator, useful for indicating
@@ -2543,18 +2531,18 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
}
private:
- _Bi_iter _M_begin;
- _Bi_iter _M_end;
- const regex_type* _M_pregex;
- regex_constants::match_flag_type _M_flags;
- match_results<_Bi_iter> _M_match;
+ _Bi_iter _M_begin;
+ _Bi_iter _M_end;
+ const regex_type* _M_pregex;
+ regex_constants::match_flag_type _M_flags;
+ match_results<_Bi_iter> _M_match;
};
- typedef regex_iterator<const char*> cregex_iterator;
- typedef regex_iterator<string::const_iterator> sregex_iterator;
+ typedef regex_iterator<const char*> cregex_iterator;
+ typedef regex_iterator<string::const_iterator> sregex_iterator;
#ifdef _GLIBCXX_USE_WCHAR_T
- typedef regex_iterator<const wchar_t*> wcregex_iterator;
- typedef regex_iterator<wstring::const_iterator> wsregex_iterator;
+ typedef regex_iterator<const wchar_t*> wcregex_iterator;
+ typedef regex_iterator<wstring::const_iterator> wsregex_iterator;
#endif
// [7.12.2] Class template regex_token_iterator
@@ -2571,12 +2559,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
class regex_token_iterator
{
public:
- typedef basic_regex<_Ch_type, _Rx_traits> regex_type;
- typedef sub_match<_Bi_iter> value_type;
- typedef std::ptrdiff_t difference_type;
- typedef const value_type* pointer;
- typedef const value_type& reference;
- typedef std::forward_iterator_tag iterator_category;
+ typedef basic_regex<_Ch_type, _Rx_traits> regex_type;
+ typedef sub_match<_Bi_iter> value_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef const value_type* pointer;
+ typedef const value_type& reference;
+ typedef std::forward_iterator_tag iterator_category;
public:
/**
@@ -2778,25 +2766,25 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
_M_result = nullptr;
}
- _Position _M_position;
- std::vector<int> _M_subs;
- value_type _M_suffix;
- std::size_t _M_n;
- const value_type* _M_result;
+ _Position _M_position;
+ std::vector<int> _M_subs;
+ value_type _M_suffix;
+ std::size_t _M_n;
+ const value_type* _M_result;
// Show whether _M_subs contains -1
- bool _M_has_m1;
+ bool _M_has_m1;
};
/** @brief Token iterator for C-style NULL-terminated strings. */
- typedef regex_token_iterator<const char*> cregex_token_iterator;
+ typedef regex_token_iterator<const char*> cregex_token_iterator;
/** @brief Token iterator for standard strings. */
- typedef regex_token_iterator<string::const_iterator> sregex_token_iterator;
+ typedef regex_token_iterator<string::const_iterator> sregex_token_iterator;
#ifdef _GLIBCXX_USE_WCHAR_T
/** @brief Token iterator for C-style NULL-terminated wide strings. */
- typedef regex_token_iterator<const wchar_t*> wcregex_token_iterator;
+ typedef regex_token_iterator<const wchar_t*> wcregex_token_iterator;
/** @brief Token iterator for standard wide-character strings. */
typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;
diff --git a/libstdc++-v3/include/bits/regex.tcc b/libstdc++-v3/include/bits/regex.tcc
index dc32a49dcd9..fc2d5846c46 100644
--- a/libstdc++-v3/include/bits/regex.tcc
+++ b/libstdc++-v3/include/bits/regex.tcc
@@ -30,10 +30,10 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
-namespace __detail
-{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
+namespace __detail
+{
// Result of merging regex_match and regex_search.
//
// __policy now can be _S_auto (auto dispatch) and _S_alternate (use
@@ -118,12 +118,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
return __ret;
}
-
-_GLIBCXX_END_NAMESPACE_VERSION
}
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
-
template<typename _Ch_type>
template<typename _Fwd_iter>
typename regex_traits<_Ch_type>::string_type
@@ -663,4 +659,3 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
-
diff --git a/libstdc++-v3/include/bits/regex_automaton.h b/libstdc++-v3/include/bits/regex_automaton.h
index a5fab6356cc..00d1bd295cd 100644
--- a/libstdc++-v3/include/bits/regex_automaton.h
+++ b/libstdc++-v3/include/bits/regex_automaton.h
@@ -35,10 +35,10 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
-namespace __detail
-{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
+namespace __detail
+{
/**
* @defgroup regex-detail Base and Implementation Classes
* @ingroup regex
@@ -393,8 +393,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
};
//@} regex-detail
-_GLIBCXX_END_NAMESPACE_VERSION
} // namespace __detail
+
+_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#include <bits/regex_automaton.tcc>
diff --git a/libstdc++-v3/include/bits/regex_automaton.tcc b/libstdc++-v3/include/bits/regex_automaton.tcc
index 727bde1f6c6..573b059a251 100644
--- a/libstdc++-v3/include/bits/regex_automaton.tcc
+++ b/libstdc++-v3/include/bits/regex_automaton.tcc
@@ -30,10 +30,10 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
-namespace __detail
-{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
+namespace __detail
+{
#ifdef _GLIBCXX_DEBUG
inline std::ostream&
_State_base::_M_print(std::ostream& ostr) const
@@ -233,7 +233,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
return _StateSeq(_M_nfa, __m[_M_start], __m[_M_end]);
}
+} // namespace __detail
_GLIBCXX_END_NAMESPACE_VERSION
-} // namespace __detail
} // namespace
diff --git a/libstdc++-v3/include/bits/regex_compiler.h b/libstdc++-v3/include/bits/regex_compiler.h
index 2c00939f6f9..5d46cd43bd3 100644
--- a/libstdc++-v3/include/bits/regex_compiler.h
+++ b/libstdc++-v3/include/bits/regex_compiler.h
@@ -37,12 +37,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
class regex_traits;
_GLIBCXX_END_NAMESPACE_CXX11
-_GLIBCXX_END_NAMESPACE_VERSION
namespace __detail
{
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
-
/**
* @addtogroup regex-detail
* @{
@@ -575,8 +572,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
};
//@} regex-detail
-_GLIBCXX_END_NAMESPACE_VERSION
} // namespace __detail
+_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#include <bits/regex_compiler.tcc>
diff --git a/libstdc++-v3/include/bits/regex_compiler.tcc b/libstdc++-v3/include/bits/regex_compiler.tcc
index a6d8016d87f..1f7dd91b643 100644
--- a/libstdc++-v3/include/bits/regex_compiler.tcc
+++ b/libstdc++-v3/include/bits/regex_compiler.tcc
@@ -55,10 +55,10 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
-namespace __detail
-{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
+namespace __detail
+{
template<typename _TraitsT>
_Compiler<_TraitsT>::
_Compiler(_IterT __b, _IterT __e,
@@ -633,7 +633,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return false;
}() ^ _M_is_non_matching;
}
+} // namespace __detail
_GLIBCXX_END_NAMESPACE_VERSION
-} // namespace __detail
} // namespace
diff --git a/libstdc++-v3/include/bits/regex_constants.h b/libstdc++-v3/include/bits/regex_constants.h
index dad2d637aa8..12c9eea4985 100644
--- a/libstdc++-v3/include/bits/regex_constants.h
+++ b/libstdc++-v3/include/bits/regex_constants.h
@@ -32,6 +32,8 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
/**
* @defgroup regex Regular Expressions
*
@@ -45,8 +47,6 @@ namespace std _GLIBCXX_VISIBILITY(default)
*/
namespace regex_constants
{
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
-
/**
* @name 5.1 Regular Expression Syntax Options
*/
@@ -408,10 +408,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ return __a = __a ^ __b; }
//@}
-
-_GLIBCXX_END_NAMESPACE_VERSION
} // namespace regex_constants
-
/* @} */ // group regex
+
+_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
diff --git a/libstdc++-v3/include/bits/regex_error.h b/libstdc++-v3/include/bits/regex_error.h
index 55f6db9cf7a..f2a3389e984 100644
--- a/libstdc++-v3/include/bits/regex_error.h
+++ b/libstdc++-v3/include/bits/regex_error.h
@@ -32,6 +32,8 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
/**
* @addtogroup regex
* @{
@@ -39,8 +41,6 @@ namespace std _GLIBCXX_VISIBILITY(default)
namespace regex_constants
{
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
-
/**
* @name 5.3 Error Types
*/
@@ -120,11 +120,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
constexpr error_type error_stack(_S_error_stack);
//@}
-_GLIBCXX_END_NAMESPACE_VERSION
} // namespace regex_constants
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
-
// [7.8] Class regex_error
/**
* @brief A regular expression exception class.
diff --git a/libstdc++-v3/include/bits/regex_executor.h b/libstdc++-v3/include/bits/regex_executor.h
index 61054742870..3d1f2516f50 100644
--- a/libstdc++-v3/include/bits/regex_executor.h
+++ b/libstdc++-v3/include/bits/regex_executor.h
@@ -32,10 +32,10 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
-namespace __detail
-{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
+namespace __detail
+{
/**
* @addtogroup regex-detail
* @{
@@ -251,8 +251,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
};
//@} regex-detail
-_GLIBCXX_END_NAMESPACE_VERSION
} // namespace __detail
+_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#include <bits/regex_executor.tcc>
diff --git a/libstdc++-v3/include/bits/regex_executor.tcc b/libstdc++-v3/include/bits/regex_executor.tcc
index 9d4ece74416..226e05856e1 100644
--- a/libstdc++-v3/include/bits/regex_executor.tcc
+++ b/libstdc++-v3/include/bits/regex_executor.tcc
@@ -30,10 +30,10 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
-namespace __detail
-{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
+namespace __detail
+{
template<typename _BiIter, typename _Alloc, typename _TraitsT,
bool __dfs_mode>
bool _Executor<_BiIter, _Alloc, _TraitsT, __dfs_mode>::
@@ -513,7 +513,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return __left_is_word != __right_is_word;
}
+} // namespace __detail
_GLIBCXX_END_NAMESPACE_VERSION
-} // namespace __detail
} // namespace
diff --git a/libstdc++-v3/include/bits/regex_scanner.h b/libstdc++-v3/include/bits/regex_scanner.h
index 37ad862a669..670efeda69f 100644
--- a/libstdc++-v3/include/bits/regex_scanner.h
+++ b/libstdc++-v3/include/bits/regex_scanner.h
@@ -30,10 +30,10 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
-namespace __detail
-{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
+namespace __detail
+{
/**
* @addtogroup regex-detail
* @{
@@ -265,8 +265,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
};
//@} regex-detail
-_GLIBCXX_END_NAMESPACE_VERSION
} // namespace __detail
+_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#include <bits/regex_scanner.tcc>
diff --git a/libstdc++-v3/include/bits/regex_scanner.tcc b/libstdc++-v3/include/bits/regex_scanner.tcc
index ad0b0477f3c..c65bfe2f68d 100644
--- a/libstdc++-v3/include/bits/regex_scanner.tcc
+++ b/libstdc++-v3/include/bits/regex_scanner.tcc
@@ -48,10 +48,10 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
-namespace __detail
-{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
+namespace __detail
+{
template<typename _CharT>
_Scanner<_CharT>::
_Scanner(typename _Scanner::_IterT __begin,
@@ -584,6 +584,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
#endif
-_GLIBCXX_END_NAMESPACE_VERSION
} // namespace __detail
+_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
diff --git a/libstdc++-v3/include/bits/specfun.h b/libstdc++-v3/include/bits/specfun.h
index 82bd02e227a..0aaebeab7ac 100644
--- a/libstdc++-v3/include/bits/specfun.h
+++ b/libstdc++-v3/include/bits/specfun.h
@@ -1203,6 +1203,7 @@ _GLIBCXX_END_NAMESPACE_VERSION
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
// Confluent hypergeometric functions
@@ -1302,6 +1303,7 @@ namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
return std::__detail::__hyperg<__type>(__a, __b, __c, __x);
}
+_GLIBCXX_END_NAMESPACE_VERSION
} // namespace __gnu_cxx
#pragma GCC visibility pop
diff --git a/libstdc++-v3/include/bits/sstream.tcc b/libstdc++-v3/include/bits/sstream.tcc
index 72e8742b4cf..56c53bc5923 100644
--- a/libstdc++-v3/include/bits/sstream.tcc
+++ b/libstdc++-v3/include/bits/sstream.tcc
@@ -88,6 +88,25 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return traits_type::not_eof(__c);
const __size_type __capacity = _M_string.capacity();
+
+#if _GLIBCXX_USE_CXX11_ABI
+ if ((this->epptr() - this->pbase()) < __capacity)
+ {
+ // There is additional capacity in _M_string that can be used.
+ char_type* __base = const_cast<char_type*>(_M_string.data());
+ _M_pbump(__base, __base + __capacity, this->pptr() - this->pbase());
+ if (_M_mode & ios_base::in)
+ {
+ const __size_type __nget = this->gptr() - this->eback();
+ const __size_type __eget = this->egptr() - this->eback();
+ this->setg(__base, __base + __nget, __base + __eget + 1);
+ }
+ *this->pptr() = traits_type::to_char_type(__c);
+ this->pbump(1);
+ return __c;
+ }
+#endif
+
const __size_type __max_size = _M_string.max_size();
const bool __testput = this->pptr() < this->epptr();
if (__builtin_expect(!__testput && __capacity == __max_size, false))
@@ -110,7 +129,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
const __size_type __opt_len = std::max(__size_type(2 * __capacity),
__size_type(512));
const __size_type __len = std::min(__opt_len, __max_size);
- __string_type __tmp;
+ __string_type __tmp(_M_string.get_allocator());
__tmp.reserve(__len);
if (this->pbase())
__tmp.assign(this->pbase(), this->epptr() - this->pbase());
diff --git a/libstdc++-v3/include/bits/stl_algo.h b/libstdc++-v3/include/bits/stl_algo.h
index 246193f38c7..ea413b1b155 100644
--- a/libstdc++-v3/include/bits/stl_algo.h
+++ b/libstdc++-v3/include/bits/stl_algo.h
@@ -3857,8 +3857,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#endif // C++11
-_GLIBCXX_END_NAMESPACE_VERSION
-
_GLIBCXX_BEGIN_NAMESPACE_ALGO
/**
@@ -5831,13 +5829,15 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
"sample size must be an integer type");
typename iterator_traits<_PopulationIterator>::difference_type __d = __n;
- return std::__sample(__first, __last, __pop_cat{}, __out, __samp_cat{},
- __d, std::forward<_UniformRandomBitGenerator>(__g));
+ return _GLIBCXX_STD_A::
+ __sample(__first, __last, __pop_cat{}, __out, __samp_cat{}, __d,
+ std::forward<_UniformRandomBitGenerator>(__g));
}
#endif // C++17
#endif // C++14
_GLIBCXX_END_NAMESPACE_ALGO
+_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif /* _STL_ALGO_H */
diff --git a/libstdc++-v3/include/bits/stl_algobase.h b/libstdc++-v3/include/bits/stl_algobase.h
index 0a49e6ff66c..f68ecb22b82 100644
--- a/libstdc++-v3/include/bits/stl_algobase.h
+++ b/libstdc++-v3/include/bits/stl_algobase.h
@@ -1020,8 +1020,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__lg(unsigned long long __n)
{ return sizeof(long long) * __CHAR_BIT__ - 1 - __builtin_clzll(__n); }
-_GLIBCXX_END_NAMESPACE_VERSION
-
_GLIBCXX_BEGIN_NAMESPACE_ALGO
/**
@@ -1411,6 +1409,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
#endif
_GLIBCXX_END_NAMESPACE_ALGO
+_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
// NB: This file is included within many other C++ includes, as a way
diff --git a/libstdc++-v3/include/bits/stl_bvector.h b/libstdc++-v3/include/bits/stl_bvector.h
index bf4b23eb2d3..d24e760d01b 100644
--- a/libstdc++-v3/include/bits/stl_bvector.h
+++ b/libstdc++-v3/include/bits/stl_bvector.h
@@ -62,6 +62,7 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
typedef unsigned long _Bit_type;
@@ -552,6 +553,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
};
_GLIBCXX_END_NAMESPACE_CONTAINER
+_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
// Declare a partial specialization of vector<T, Alloc>.
@@ -559,6 +561,7 @@ _GLIBCXX_END_NAMESPACE_CONTAINER
namespace std _GLIBCXX_VISIBILITY(default)
{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
/**
@@ -1305,6 +1308,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
};
_GLIBCXX_END_NAMESPACE_CONTAINER
+_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#if __cplusplus >= 201103L
diff --git a/libstdc++-v3/include/bits/stl_deque.h b/libstdc++-v3/include/bits/stl_deque.h
index e03e7f5808f..48b2bc7f5eb 100644
--- a/libstdc++-v3/include/bits/stl_deque.h
+++ b/libstdc++-v3/include/bits/stl_deque.h
@@ -67,6 +67,7 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
/**
@@ -2325,6 +2326,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
#undef _GLIBCXX_DEQUE_BUF_SIZE
_GLIBCXX_END_NAMESPACE_CONTAINER
+_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif /* _STL_DEQUE_H */
diff --git a/libstdc++-v3/include/bits/stl_iterator.h b/libstdc++-v3/include/bits/stl_iterator.h
index 18c6e3f625e..88667a568c3 100644
--- a/libstdc++-v3/include/bits/stl_iterator.h
+++ b/libstdc++-v3/include/bits/stl_iterator.h
@@ -984,15 +984,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__niter_base(__gnu_cxx::__normal_iterator<_Iterator, _Container> __it)
{ return __it.base(); }
-_GLIBCXX_END_NAMESPACE_VERSION
-} // namespace
-
#if __cplusplus >= 201103L
-namespace std _GLIBCXX_VISIBILITY(default)
-{
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
-
/**
* @addtogroup iterators
* @{
@@ -1243,9 +1236,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
-> decltype(__miter_base(__it.base()))
{ return __miter_base(__it.base()); }
-_GLIBCXX_END_NAMESPACE_VERSION
-} // namespace
-
#define _GLIBCXX_MAKE_MOVE_ITERATOR(_Iter) std::make_move_iterator(_Iter)
#define _GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(_Iter) \
std::__make_move_if_noexcept_iterator(_Iter)
@@ -1254,6 +1244,9 @@ _GLIBCXX_END_NAMESPACE_VERSION
#define _GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(_Iter) (_Iter)
#endif // C++11
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
#ifdef _GLIBCXX_DEBUG
# include <debug/stl_iterator.h>
#endif
diff --git a/libstdc++-v3/include/bits/stl_iterator_base_funcs.h b/libstdc++-v3/include/bits/stl_iterator_base_funcs.h
index e14a22ce255..86a93d34fa1 100644
--- a/libstdc++-v3/include/bits/stl_iterator_base_funcs.h
+++ b/libstdc++-v3/include/bits/stl_iterator_base_funcs.h
@@ -66,14 +66,14 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
// Forward declaration for the overloads of __distance.
template <typename> struct _List_iterator;
template <typename> struct _List_const_iterator;
_GLIBCXX_END_NAMESPACE_CONTAINER
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
-
template<typename _InputIterator>
inline _GLIBCXX14_CONSTEXPR
typename iterator_traits<_InputIterator>::difference_type
diff --git a/libstdc++-v3/include/bits/stl_list.h b/libstdc++-v3/include/bits/stl_list.h
index 232885af79d..cef94f728ef 100644
--- a/libstdc++-v3/include/bits/stl_list.h
+++ b/libstdc++-v3/include/bits/stl_list.h
@@ -66,10 +66,10 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
namespace __detail
{
- _GLIBCXX_BEGIN_NAMESPACE_VERSION
-
// Supporting structures are split into common and templated
// types; the latter publicly inherits from the former in an
// effort to reduce code duplication. This results in some
@@ -99,7 +99,64 @@ namespace std _GLIBCXX_VISIBILITY(default)
_M_unhook() _GLIBCXX_USE_NOEXCEPT;
};
- _GLIBCXX_END_NAMESPACE_VERSION
+ /// The %list node header.
+ struct _List_node_header : public _List_node_base
+ {
+#if _GLIBCXX_USE_CXX11_ABI
+ std::size_t _M_size;
+#endif
+
+ _List_node_header() _GLIBCXX_NOEXCEPT
+ { _M_init(); }
+
+#if __cplusplus >= 201103L
+ _List_node_header(_List_node_header&& __x) noexcept
+ : _List_node_base{ __x._M_next, __x._M_prev }
+# if _GLIBCXX_USE_CXX11_ABI
+ , _M_size(__x._M_size)
+# endif
+ {
+ if (__x._M_base()->_M_next == __x._M_base())
+ this->_M_next = this->_M_prev = this;
+ else
+ {
+ this->_M_next->_M_prev = this->_M_prev->_M_next = this->_M_base();
+ __x._M_init();
+ }
+ }
+
+ void
+ _M_move_nodes(_List_node_header&& __x)
+ {
+ _List_node_base* const __xnode = __x._M_base();
+ if (__xnode->_M_next == __xnode)
+ _M_init();
+ else
+ {
+ _List_node_base* const __node = this->_M_base();
+ __node->_M_next = __xnode->_M_next;
+ __node->_M_prev = __xnode->_M_prev;
+ __node->_M_next->_M_prev = __node->_M_prev->_M_next = __node;
+# if _GLIBCXX_USE_CXX11_ABI
+ _M_size = __x._M_size;
+# endif
+ __x._M_init();
+ }
+ }
+#endif
+
+ void
+ _M_init() _GLIBCXX_NOEXCEPT
+ {
+ this->_M_next = this->_M_prev = this;
+#if _GLIBCXX_USE_CXX11_ABI
+ this->_M_size = 0;
+#endif
+ }
+
+ private:
+ _List_node_base* _M_base() { return this; }
+ };
} // namespace detail
_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
@@ -323,23 +380,21 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
struct _List_impl
: public _Node_alloc_type
{
-#if _GLIBCXX_USE_CXX11_ABI
- _List_node<size_t> _M_node;
-#else
- __detail::_List_node_base _M_node;
-#endif
+ __detail::_List_node_header _M_node;
- _List_impl() _GLIBCXX_NOEXCEPT
- : _Node_alloc_type(), _M_node()
+ _List_impl() _GLIBCXX_NOEXCEPT_IF( noexcept(_Node_alloc_type()) )
+ : _Node_alloc_type()
{ }
_List_impl(const _Node_alloc_type& __a) _GLIBCXX_NOEXCEPT
- : _Node_alloc_type(__a), _M_node()
+ : _Node_alloc_type(__a)
{ }
#if __cplusplus >= 201103L
+ _List_impl(_List_impl&&) = default;
+
_List_impl(_Node_alloc_type&& __a) noexcept
- : _Node_alloc_type(std::move(__a)), _M_node()
+ : _Node_alloc_type(std::move(__a))
{ }
#endif
};
@@ -347,13 +402,13 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
_List_impl _M_impl;
#if _GLIBCXX_USE_CXX11_ABI
- size_t _M_get_size() const { return *_M_impl._M_node._M_valptr(); }
+ size_t _M_get_size() const { return _M_impl._M_node._M_size; }
- void _M_set_size(size_t __n) { *_M_impl._M_node._M_valptr() = __n; }
+ void _M_set_size(size_t __n) { _M_impl._M_node._M_size = __n; }
- void _M_inc_size(size_t __n) { *_M_impl._M_node._M_valptr() += __n; }
+ void _M_inc_size(size_t __n) { _M_impl._M_node._M_size += __n; }
- void _M_dec_size(size_t __n) { *_M_impl._M_node._M_valptr() -= __n; }
+ void _M_dec_size(size_t __n) { _M_impl._M_node._M_size -= __n; }
size_t
_M_distance(const __detail::_List_node_base* __first,
@@ -361,7 +416,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
{ return _S_distance(__first, __last); }
// return the stored size
- size_t _M_node_count() const { return *_M_impl._M_node._M_valptr(); }
+ size_t _M_node_count() const { return _M_get_size(); }
#else
// dummy implementations used when the size is not stored
size_t _M_get_size() const { return 0; }
@@ -397,44 +452,30 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
_M_get_Node_allocator() const _GLIBCXX_NOEXCEPT
{ return _M_impl; }
- _List_base()
- : _M_impl()
- { _M_init(); }
+#if __cplusplus >= 201103L
+ _List_base() = default;
+#else
+ _List_base() { }
+#endif
_List_base(const _Node_alloc_type& __a) _GLIBCXX_NOEXCEPT
: _M_impl(__a)
- { _M_init(); }
+ { }
#if __cplusplus >= 201103L
- _List_base(_List_base&& __x) noexcept
- : _M_impl(std::move(__x._M_get_Node_allocator()))
- { _M_move_nodes(std::move(__x)); }
+ _List_base(_List_base&&) = default;
_List_base(_List_base&& __x, _Node_alloc_type&& __a)
: _M_impl(std::move(__a))
{
if (__x._M_get_Node_allocator() == _M_get_Node_allocator())
_M_move_nodes(std::move(__x));
- else
- _M_init(); // Caller must move individual elements.
+ // else caller must move individual elements.
}
void
_M_move_nodes(_List_base&& __x)
- {
- auto* const __xnode = std::__addressof(__x._M_impl._M_node);
- if (__xnode->_M_next == __xnode)
- _M_init();
- else
- {
- auto* const __node = std::__addressof(_M_impl._M_node);
- __node->_M_next = __xnode->_M_next;
- __node->_M_prev = __xnode->_M_prev;
- __node->_M_next->_M_prev = __node->_M_prev->_M_next = __node;
- _M_set_size(__x._M_get_size());
- __x._M_init();
- }
- }
+ { _M_impl._M_node._M_move_nodes(std::move(__x._M_impl._M_node)); }
#endif
// This is what actually destroys the list.
@@ -446,11 +487,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
void
_M_init() _GLIBCXX_NOEXCEPT
- {
- this->_M_impl._M_node._M_next = &this->_M_impl._M_node;
- this->_M_impl._M_node._M_prev = &this->_M_impl._M_node;
- _M_set_size(0);
- }
+ { this->_M_impl._M_node._M_init(); }
};
/**
@@ -586,11 +623,11 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
/**
* @brief Creates a %list with no elements.
*/
- list()
#if __cplusplus >= 201103L
- noexcept(is_nothrow_default_constructible<_Node_alloc_type>::value)
+ list() = default;
+#else
+ list() { }
#endif
- : _Base() { }
/**
* @brief Creates a %list with no elements.
@@ -657,13 +694,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
#if __cplusplus >= 201103L
/**
* @brief %List move constructor.
- * @param __x A %list of identical element and allocator types.
*
- * The newly-created %list contains the exact contents of @a __x.
- * The contents of @a __x are a valid, but unspecified %list.
+ * The newly-created %list contains the exact contents of the moved
+ * instance. The contents of the moved instance are a valid, but
+ * unspecified %list.
*/
- list(list&& __x) noexcept
- : _Base(std::move(__x)) { }
+ list(list&&) = default;
/**
* @brief Builds a %list from an initializer_list
@@ -1838,17 +1874,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
_M_move_assign(list&& __x, true_type) noexcept
{
this->_M_clear();
- if (__x.empty())
- this->_M_init();
- else
- {
- this->_M_impl._M_node._M_next = __x._M_impl._M_node._M_next;
- this->_M_impl._M_node._M_next->_M_prev = &this->_M_impl._M_node;
- this->_M_impl._M_node._M_prev = __x._M_impl._M_node._M_prev;
- this->_M_impl._M_node._M_prev->_M_next = &this->_M_impl._M_node;
- this->_M_set_size(__x._M_get_size());
- __x._M_init();
- }
+ this->_M_move_nodes(std::move(__x));
std::__alloc_on_move(this->_M_get_Node_allocator(),
__x._M_get_Node_allocator());
}
@@ -1964,7 +1990,6 @@ _GLIBCXX_END_NAMESPACE_CXX11
_GLIBCXX_END_NAMESPACE_CONTAINER
#if _GLIBCXX_USE_CXX11_ABI
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
// Detect when distance is used to compute the size of the whole list.
template<typename _Tp>
@@ -1983,12 +2008,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_STD_C::_List_const_iterator<_Tp> __last,
input_iterator_tag)
{
- typedef _GLIBCXX_STD_C::_List_node<size_t> _Sentinel;
+ typedef __detail::_List_node_header _Sentinel;
_GLIBCXX_STD_C::_List_const_iterator<_Tp> __beyond = __last;
++__beyond;
- bool __whole = __first == __beyond;
+ const bool __whole = __first == __beyond;
if (__builtin_constant_p (__whole) && __whole)
- return *static_cast<const _Sentinel*>(__last._M_node)->_M_valptr();
+ return static_cast<const _Sentinel*>(__last._M_node)->_M_size;
ptrdiff_t __n = 0;
while (__first != __last)
@@ -1998,9 +2023,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
return __n;
}
+#endif
_GLIBCXX_END_NAMESPACE_VERSION
-#endif
} // namespace std
#endif /* _STL_LIST_H */
diff --git a/libstdc++-v3/include/bits/stl_map.h b/libstdc++-v3/include/bits/stl_map.h
index 30339536f57..0e8a98a96c1 100644
--- a/libstdc++-v3/include/bits/stl_map.h
+++ b/libstdc++-v3/include/bits/stl_map.h
@@ -65,6 +65,7 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template <typename _Key, typename _Tp, typename _Compare, typename _Alloc>
@@ -1437,7 +1438,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
_GLIBCXX_END_NAMESPACE_CONTAINER
#if __cplusplus > 201402L
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
// Allow std::map access to internals of compatible maps.
template<typename _Key, typename _Val, typename _Cmp1, typename _Alloc,
typename _Cmp2>
@@ -1456,9 +1456,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_S_get_tree(_GLIBCXX_STD_C::multimap<_Key, _Val, _Cmp2, _Alloc>& __map)
{ return __map._M_t; }
};
-_GLIBCXX_END_NAMESPACE_VERSION
#endif // C++17
+_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif /* _STL_MAP_H */
diff --git a/libstdc++-v3/include/bits/stl_multimap.h b/libstdc++-v3/include/bits/stl_multimap.h
index 7dc22a96a59..7e3cea48a47 100644
--- a/libstdc++-v3/include/bits/stl_multimap.h
+++ b/libstdc++-v3/include/bits/stl_multimap.h
@@ -63,6 +63,7 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template <typename _Key, typename _Tp, typename _Compare, typename _Alloc>
@@ -1102,7 +1103,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
_GLIBCXX_END_NAMESPACE_CONTAINER
#if __cplusplus > 201402L
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
// Allow std::multimap access to internals of compatible maps.
template<typename _Key, typename _Val, typename _Cmp1, typename _Alloc,
typename _Cmp2>
@@ -1121,9 +1121,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_S_get_tree(_GLIBCXX_STD_C::multimap<_Key, _Val, _Cmp2, _Alloc>& __map)
{ return __map._M_t; }
};
-_GLIBCXX_END_NAMESPACE_VERSION
#endif // C++17
+_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif /* _STL_MULTIMAP_H */
diff --git a/libstdc++-v3/include/bits/stl_multiset.h b/libstdc++-v3/include/bits/stl_multiset.h
index 60a3db844cb..517e77e9372 100644
--- a/libstdc++-v3/include/bits/stl_multiset.h
+++ b/libstdc++-v3/include/bits/stl_multiset.h
@@ -63,6 +63,7 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Key, typename _Compare, typename _Alloc>
@@ -953,7 +954,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
_GLIBCXX_END_NAMESPACE_CONTAINER
#if __cplusplus > 201402L
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
// Allow std::multiset access to internals of compatible sets.
template<typename _Val, typename _Cmp1, typename _Alloc, typename _Cmp2>
struct
@@ -971,9 +971,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_S_get_tree(_GLIBCXX_STD_C::multiset<_Val, _Cmp2, _Alloc>& __set)
{ return __set._M_t; }
};
-_GLIBCXX_END_NAMESPACE_VERSION
#endif // C++17
+_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif /* _STL_MULTISET_H */
diff --git a/libstdc++-v3/include/bits/stl_relops.h b/libstdc++-v3/include/bits/stl_relops.h
index a2614bd3040..e2a0e25ca31 100644
--- a/libstdc++-v3/include/bits/stl_relops.h
+++ b/libstdc++-v3/include/bits/stl_relops.h
@@ -66,10 +66,10 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
namespace rel_ops
{
- _GLIBCXX_BEGIN_NAMESPACE_VERSION
-
/** @namespace std::rel_ops
* @brief The generated relational operators are sequestered here.
*/
@@ -125,10 +125,9 @@ namespace std _GLIBCXX_VISIBILITY(default)
inline bool
operator>=(const _Tp& __x, const _Tp& __y)
{ return !(__x < __y); }
-
- _GLIBCXX_END_NAMESPACE_VERSION
} // namespace rel_ops
+_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif /* _STL_RELOPS_H */
diff --git a/libstdc++-v3/include/bits/stl_set.h b/libstdc++-v3/include/bits/stl_set.h
index 817bc2d870f..e804a7cae70 100644
--- a/libstdc++-v3/include/bits/stl_set.h
+++ b/libstdc++-v3/include/bits/stl_set.h
@@ -63,6 +63,7 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Key, typename _Compare, typename _Alloc>
@@ -969,7 +970,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
_GLIBCXX_END_NAMESPACE_CONTAINER
#if __cplusplus > 201402L
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
// Allow std::set access to internals of compatible sets.
template<typename _Val, typename _Cmp1, typename _Alloc, typename _Cmp2>
struct
@@ -986,8 +986,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_S_get_tree(_GLIBCXX_STD_C::multiset<_Val, _Cmp2, _Alloc>& __set)
{ return __set._M_t; }
};
-_GLIBCXX_END_NAMESPACE_VERSION
#endif // C++17
+_GLIBCXX_END_NAMESPACE_VERSION
} //namespace std
#endif /* _STL_SET_H */
diff --git a/libstdc++-v3/include/bits/stl_vector.h b/libstdc++-v3/include/bits/stl_vector.h
index 7ee3ce96890..69cb8030208 100644
--- a/libstdc++-v3/include/bits/stl_vector.h
+++ b/libstdc++-v3/include/bits/stl_vector.h
@@ -65,8 +65,15 @@
#include <debug/assertions.h>
+#if _GLIBCXX_SANITIZE_STD_ALLOCATOR && _GLIBCXX_SANITIZE_VECTOR
+extern "C" void
+__sanitizer_annotate_contiguous_container(const void*, const void*,
+ const void*, const void*);
+#endif
+
namespace std _GLIBCXX_VISIBILITY(default)
{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
/// See bits/stl_deque.h's _Deque_base for an explanation.
@@ -106,6 +113,121 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
std::swap(_M_finish, __x._M_finish);
std::swap(_M_end_of_storage, __x._M_end_of_storage);
}
+
+#if _GLIBCXX_SANITIZE_STD_ALLOCATOR && _GLIBCXX_SANITIZE_VECTOR
+ template<typename = _Tp_alloc_type>
+ struct _Asan
+ {
+ typedef typename __gnu_cxx::__alloc_traits<_Tp_alloc_type>
+ ::size_type size_type;
+
+ static void _S_shrink(_Vector_impl&, size_type) { }
+ static void _S_on_dealloc(_Vector_impl&) { }
+
+ typedef _Vector_impl& _Reinit;
+
+ struct _Grow
+ {
+ _Grow(_Vector_impl&, size_type) { }
+ void _M_grew(size_type) { }
+ };
+ };
+
+ // Enable ASan annotations for memory obtained from std::allocator.
+ template<typename _Up>
+ struct _Asan<allocator<_Up> >
+ {
+ typedef typename __gnu_cxx::__alloc_traits<_Tp_alloc_type>
+ ::size_type size_type;
+
+ // Adjust ASan annotation for [_M_start, _M_end_of_storage) to
+ // mark end of valid region as __curr instead of __prev.
+ static void
+ _S_adjust(_Vector_impl& __impl, pointer __prev, pointer __curr)
+ {
+ __sanitizer_annotate_contiguous_container(__impl._M_start,
+ __impl._M_end_of_storage, __prev, __curr);
+ }
+
+ static void
+ _S_grow(_Vector_impl& __impl, size_type __n)
+ { _S_adjust(__impl, __impl._M_finish, __impl._M_finish + __n); }
+
+ static void
+ _S_shrink(_Vector_impl& __impl, size_type __n)
+ { _S_adjust(__impl, __impl._M_finish + __n, __impl._M_finish); }
+
+ static void
+ _S_on_dealloc(_Vector_impl& __impl)
+ {
+ if (__impl._M_start)
+ _S_adjust(__impl, __impl._M_finish, __impl._M_end_of_storage);
+ }
+
+ // Used on reallocation to tell ASan unused capacity is invalid.
+ struct _Reinit
+ {
+ explicit _Reinit(_Vector_impl& __impl) : _M_impl(__impl)
+ {
+ // Mark unused capacity as valid again before deallocating it.
+ _S_on_dealloc(_M_impl);
+ }
+
+ ~_Reinit()
+ {
+ // Mark unused capacity as invalid after reallocation.
+ if (_M_impl._M_start)
+ _S_adjust(_M_impl, _M_impl._M_end_of_storage,
+ _M_impl._M_finish);
+ }
+
+ _Vector_impl& _M_impl;
+
+#if __cplusplus >= 201103L
+ _Reinit(const _Reinit&) = delete;
+ _Reinit& operator=(const _Reinit&) = delete;
+#endif
+ };
+
+ // Tell ASan when unused capacity is initialized to be valid.
+ struct _Grow
+ {
+ _Grow(_Vector_impl& __impl, size_type __n)
+ : _M_impl(__impl), _M_n(__n)
+ { _S_grow(_M_impl, __n); }
+
+ ~_Grow() { if (_M_n) _S_shrink(_M_impl, _M_n); }
+
+ void _M_grew(size_type __n) { _M_n -= __n; }
+
+#if __cplusplus >= 201103L
+ _Grow(const _Grow&) = delete;
+ _Grow& operator=(const _Grow&) = delete;
+#endif
+ private:
+ _Vector_impl& _M_impl;
+ size_type _M_n;
+ };
+ };
+
+#define _GLIBCXX_ASAN_ANNOTATE_REINIT \
+ typename _Base::_Vector_impl::template _Asan<>::_Reinit const \
+ __attribute__((__unused__)) __reinit_guard(this->_M_impl)
+#define _GLIBCXX_ASAN_ANNOTATE_GROW(n) \
+ typename _Base::_Vector_impl::template _Asan<>::_Grow \
+ __attribute__((__unused__)) __grow_guard(this->_M_impl, (n))
+#define _GLIBCXX_ASAN_ANNOTATE_GREW(n) __grow_guard._M_grew(n)
+#define _GLIBCXX_ASAN_ANNOTATE_SHRINK(n) \
+ _Base::_Vector_impl::template _Asan<>::_S_shrink(this->_M_impl, n)
+#define _GLIBCXX_ASAN_ANNOTATE_BEFORE_DEALLOC \
+ _Base::_Vector_impl::template _Asan<>::_S_on_dealloc(this->_M_impl)
+#else // ! (_GLIBCXX_SANITIZE_STD_ALLOCATOR && _GLIBCXX_SANITIZE_VECTOR)
+#define _GLIBCXX_ASAN_ANNOTATE_REINIT
+#define _GLIBCXX_ASAN_ANNOTATE_GROW(n)
+#define _GLIBCXX_ASAN_ANNOTATE_GREW(n)
+#define _GLIBCXX_ASAN_ANNOTATE_SHRINK(n)
+#define _GLIBCXX_ASAN_ANNOTATE_BEFORE_DEALLOC
+#endif // _GLIBCXX_SANITIZE_STD_ALLOCATOR && _GLIBCXX_SANITIZE_VECTOR
};
public:
@@ -159,8 +281,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
#endif
~_Vector_base() _GLIBCXX_NOEXCEPT
- { _M_deallocate(this->_M_impl._M_start, this->_M_impl._M_end_of_storage
- - this->_M_impl._M_start); }
+ {
+ _M_deallocate(_M_impl._M_start,
+ _M_impl._M_end_of_storage - _M_impl._M_start);
+ }
public:
_Vector_impl _M_impl;
@@ -190,7 +314,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
}
};
-
/**
* @brief A standard container which offers fixed time access to
* individual elements in any order.
@@ -431,8 +554,11 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* responsibility.
*/
~vector() _GLIBCXX_NOEXCEPT
- { std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,
- _M_get_Tp_allocator()); }
+ {
+ std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,
+ _M_get_Tp_allocator());
+ _GLIBCXX_ASAN_ANNOTATE_BEFORE_DEALLOC;
+ }
/**
* @brief %Vector assignment operator.
@@ -940,9 +1066,11 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
{
if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage)
{
+ _GLIBCXX_ASAN_ANNOTATE_GROW(1);
_Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish,
__x);
++this->_M_impl._M_finish;
+ _GLIBCXX_ASAN_ANNOTATE_GREW(1);
}
else
_M_realloc_insert(end(), __x);
@@ -977,6 +1105,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
__glibcxx_requires_nonempty();
--this->_M_impl._M_finish;
_Alloc_traits::destroy(this->_M_impl, this->_M_impl._M_finish);
+ _GLIBCXX_ASAN_ANNOTATE_SHRINK(1);
}
#if __cplusplus >= 201103L
@@ -1510,8 +1639,13 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
void
_M_erase_at_end(pointer __pos) _GLIBCXX_NOEXCEPT
{
- std::_Destroy(__pos, this->_M_impl._M_finish, _M_get_Tp_allocator());
- this->_M_impl._M_finish = __pos;
+ if (size_type __n = this->_M_impl._M_finish - __pos)
+ {
+ std::_Destroy(__pos, this->_M_impl._M_finish,
+ _M_get_Tp_allocator());
+ this->_M_impl._M_finish = __pos;
+ _GLIBCXX_ASAN_ANNOTATE_SHRINK(__n);
+ }
}
iterator
@@ -1655,6 +1789,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
{ __x.swap(__y); }
_GLIBCXX_END_NAMESPACE_CONTAINER
+_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif /* _STL_VECTOR_H */
diff --git a/libstdc++-v3/include/bits/uniform_int_dist.h b/libstdc++-v3/include/bits/uniform_int_dist.h
index af7ac14bccf..16509c4ef8a 100644
--- a/libstdc++-v3/include/bits/uniform_int_dist.h
+++ b/libstdc++-v3/include/bits/uniform_int_dist.h
@@ -36,10 +36,10 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace __detail
{
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
/* Determine whether number is a power of 2. */
template<typename _Tp>
inline bool
@@ -47,11 +47,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
return ((__x - 1) & __x) == 0;
};
-_GLIBCXX_END_NAMESPACE_VERSION
}
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
-
/**
* @brief Uniform discrete distribution for random numbers.
* A discrete random distribution on the range @f$[min, max]@f$ with equal
diff --git a/libstdc++-v3/include/bits/unordered_map.h b/libstdc++-v3/include/bits/unordered_map.h
index 4ef30ccccd6..df1302c80c0 100644
--- a/libstdc++-v3/include/bits/unordered_map.h
+++ b/libstdc++-v3/include/bits/unordered_map.h
@@ -32,6 +32,7 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
/// Base types for unordered_map.
@@ -1911,7 +1912,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
_GLIBCXX_END_NAMESPACE_CONTAINER
#if __cplusplus > 201402L
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
// Allow std::unordered_map access to internals of compatible maps.
template<typename _Key, typename _Val, typename _Hash1, typename _Eq1,
typename _Alloc, typename _Hash2, typename _Eq2>
@@ -1959,9 +1959,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_S_get_table(unordered_multimap<_Key, _Val, _Hash2, _Eq2, _Alloc>& __map)
{ return __map._M_h; }
};
-_GLIBCXX_END_NAMESPACE_VERSION
#endif // C++17
+_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif /* _UNORDERED_MAP_H */
diff --git a/libstdc++-v3/include/bits/unordered_set.h b/libstdc++-v3/include/bits/unordered_set.h
index 85c2562f89e..df57915f31a 100644
--- a/libstdc++-v3/include/bits/unordered_set.h
+++ b/libstdc++-v3/include/bits/unordered_set.h
@@ -32,6 +32,7 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
/// Base types for unordered_set.
@@ -1557,7 +1558,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
_GLIBCXX_END_NAMESPACE_CONTAINER
#if __cplusplus > 201402L
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
// Allow std::unordered_set access to internals of compatible sets.
template<typename _Val, typename _Hash1, typename _Eq1, typename _Alloc,
typename _Hash2, typename _Eq2>
@@ -1604,9 +1604,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_S_get_table(unordered_multiset<_Val, _Hash2, _Eq2, _Alloc>& __set)
{ return __set._M_h; }
};
-_GLIBCXX_END_NAMESPACE_VERSION
#endif // C++17
+_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif /* _UNORDERED_SET_H */
diff --git a/libstdc++-v3/include/bits/uses_allocator.h b/libstdc++-v3/include/bits/uses_allocator.h
index 89d4e435659..4d60716b494 100644
--- a/libstdc++-v3/include/bits/uses_allocator.h
+++ b/libstdc++-v3/include/bits/uses_allocator.h
@@ -109,6 +109,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__ret._M_a = std::__addressof(__a);
return __ret;
}
+
+ template<typename _Tp, typename _Alloc, typename... _Args>
+ void
+ __use_alloc(const _Alloc&&) = delete;
+
#if __cplusplus > 201402L
template <typename _Tp, typename _Alloc>
inline constexpr bool uses_allocator_v =
diff --git a/libstdc++-v3/include/bits/vector.tcc b/libstdc++-v3/include/bits/vector.tcc
index 8d688661c82..f14caaa713f 100644
--- a/libstdc++-v3/include/bits/vector.tcc
+++ b/libstdc++-v3/include/bits/vector.tcc
@@ -58,6 +58,7 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Tp, typename _Alloc>
@@ -73,6 +74,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
pointer __tmp = _M_allocate_and_copy(__n,
_GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(this->_M_impl._M_start),
_GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(this->_M_impl._M_finish));
+ _GLIBCXX_ASAN_ANNOTATE_REINIT;
std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,
_M_get_Tp_allocator());
_M_deallocate(this->_M_impl._M_start,
@@ -97,9 +99,11 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
{
if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage)
{
+ _GLIBCXX_ASAN_ANNOTATE_GROW(1);
_Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish,
std::forward<_Args>(__args)...);
++this->_M_impl._M_finish;
+ _GLIBCXX_ASAN_ANNOTATE_GREW(1);
}
else
_M_realloc_insert(end(), std::forward<_Args>(__args)...);
@@ -122,9 +126,11 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage)
if (__position == end())
{
+ _GLIBCXX_ASAN_ANNOTATE_GROW(1);
_Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish,
__x);
++this->_M_impl._M_finish;
+ _GLIBCXX_ASAN_ANNOTATE_GREW(1);
}
else
{
@@ -157,6 +163,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
_GLIBCXX_MOVE3(__position + 1, end(), __position);
--this->_M_impl._M_finish;
_Alloc_traits::destroy(this->_M_impl, this->_M_impl._M_finish);
+ _GLIBCXX_ASAN_ANNOTATE_SHRINK(1);
return __position;
}
@@ -181,6 +188,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
{
if (&__x != this)
{
+ _GLIBCXX_ASAN_ANNOTATE_REINIT;
#if __cplusplus >= 201103L
if (_Alloc_traits::_S_propagate_on_copy_assign())
{
@@ -245,10 +253,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
else if (__n > size())
{
std::fill(begin(), end(), __val);
+ const size_type __add = __n - size();
+ _GLIBCXX_ASAN_ANNOTATE_GROW(__add);
this->_M_impl._M_finish =
std::__uninitialized_fill_n_a(this->_M_impl._M_finish,
- __n - size(), __val,
- _M_get_Tp_allocator());
+ __add, __val, _M_get_Tp_allocator());
+ _GLIBCXX_ASAN_ANNOTATE_GREW(__add);
}
else
_M_erase_at_end(std::fill_n(this->_M_impl._M_start, __n, __val));
@@ -284,6 +294,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
if (__len > capacity())
{
pointer __tmp(_M_allocate_and_copy(__len, __first, __last));
+ _GLIBCXX_ASAN_ANNOTATE_REINIT;
std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,
_M_get_Tp_allocator());
_M_deallocate(this->_M_impl._M_start,
@@ -300,10 +311,13 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
_ForwardIterator __mid = __first;
std::advance(__mid, size());
std::copy(__first, __mid, this->_M_impl._M_start);
+ const size_type __attribute__((__unused__)) __n = __len - size();
+ _GLIBCXX_ASAN_ANNOTATE_GROW(__n);
this->_M_impl._M_finish =
std::__uninitialized_copy_a(__mid, __last,
this->_M_impl._M_finish,
_M_get_Tp_allocator());
+ _GLIBCXX_ASAN_ANNOTATE_GREW(__n);
}
}
@@ -317,9 +331,11 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage)
if (__position == cend())
{
+ _GLIBCXX_ASAN_ANNOTATE_GROW(1);
_Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish,
std::move(__v));
++this->_M_impl._M_finish;
+ _GLIBCXX_ASAN_ANNOTATE_GREW(1);
}
else
_M_insert_aux(begin() + __n, std::move(__v));
@@ -340,9 +356,11 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage)
if (__position == cend())
{
+ _GLIBCXX_ASAN_ANNOTATE_GROW(1);
_Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish,
std::forward<_Args>(__args)...);
++this->_M_impl._M_finish;
+ _GLIBCXX_ASAN_ANNOTATE_GREW(1);
}
else
{
@@ -370,10 +388,11 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
_M_insert_aux(iterator __position, const _Tp& __x)
#endif
{
+ _GLIBCXX_ASAN_ANNOTATE_GROW(1);
_Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish,
- _GLIBCXX_MOVE(*(this->_M_impl._M_finish
- - 1)));
+ _GLIBCXX_MOVE(*(this->_M_impl._M_finish - 1)));
++this->_M_impl._M_finish;
+ _GLIBCXX_ASAN_ANNOTATE_GREW(1);
#if __cplusplus < 201103L
_Tp __x_copy = __x;
#endif
@@ -443,11 +462,11 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
_M_deallocate(__new_start, __len);
__throw_exception_again;
}
+ _GLIBCXX_ASAN_ANNOTATE_REINIT;
std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,
_M_get_Tp_allocator());
_M_deallocate(this->_M_impl._M_start,
- this->_M_impl._M_end_of_storage
- - this->_M_impl._M_start);
+ this->_M_impl._M_end_of_storage - this->_M_impl._M_start);
this->_M_impl._M_start = __new_start;
this->_M_impl._M_finish = __new_finish;
this->_M_impl._M_end_of_storage = __new_start + __len;
@@ -473,11 +492,13 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
pointer __old_finish(this->_M_impl._M_finish);
if (__elems_after > __n)
{
+ _GLIBCXX_ASAN_ANNOTATE_GROW(__n);
std::__uninitialized_move_a(this->_M_impl._M_finish - __n,
this->_M_impl._M_finish,
this->_M_impl._M_finish,
_M_get_Tp_allocator());
this->_M_impl._M_finish += __n;
+ _GLIBCXX_ASAN_ANNOTATE_GREW(__n);
_GLIBCXX_MOVE_BACKWARD3(__position.base(),
__old_finish - __n, __old_finish);
std::fill(__position.base(), __position.base() + __n,
@@ -485,15 +506,18 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
}
else
{
+ _GLIBCXX_ASAN_ANNOTATE_GROW(__n);
this->_M_impl._M_finish =
std::__uninitialized_fill_n_a(this->_M_impl._M_finish,
__n - __elems_after,
__x_copy,
_M_get_Tp_allocator());
+ _GLIBCXX_ASAN_ANNOTATE_GREW(__n - __elems_after);
std::__uninitialized_move_a(__position.base(), __old_finish,
this->_M_impl._M_finish,
_M_get_Tp_allocator());
this->_M_impl._M_finish += __elems_after;
+ _GLIBCXX_ASAN_ANNOTATE_GREW(__elems_after);
std::fill(__position.base(), __old_finish, __x_copy);
}
}
@@ -536,6 +560,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
_M_deallocate(__new_start, __len);
__throw_exception_again;
}
+ _GLIBCXX_ASAN_ANNOTATE_REINIT;
std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,
_M_get_Tp_allocator());
_M_deallocate(this->_M_impl._M_start,
@@ -559,9 +584,11 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
if (size_type(this->_M_impl._M_end_of_storage
- this->_M_impl._M_finish) >= __n)
{
+ _GLIBCXX_ASAN_ANNOTATE_GROW(__n);
this->_M_impl._M_finish =
std::__uninitialized_default_n_a(this->_M_impl._M_finish,
__n, _M_get_Tp_allocator());
+ _GLIBCXX_ASAN_ANNOTATE_GREW(__n);
}
else
{
@@ -587,6 +614,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
_M_deallocate(__new_start, __len);
__throw_exception_again;
}
+ _GLIBCXX_ASAN_ANNOTATE_REINIT;
std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,
_M_get_Tp_allocator());
_M_deallocate(this->_M_impl._M_start,
@@ -606,6 +634,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
{
if (capacity() == size())
return false;
+ _GLIBCXX_ASAN_ANNOTATE_REINIT;
return std::__shrink_to_fit_aux<vector>::_S_do_it(*this);
}
#endif
@@ -617,10 +646,17 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
_M_range_insert(iterator __pos, _InputIterator __first,
_InputIterator __last, std::input_iterator_tag)
{
- for (; __first != __last; ++__first)
+ if (__pos == end())
+ {
+ for (; __first != __last; ++__first)
+ insert(end(), *__first);
+ }
+ else if (__first != __last)
{
- __pos = insert(__pos, *__first);
- ++__pos;
+ vector __tmp(__first, __last, _M_get_Tp_allocator());
+ insert(__pos,
+ _GLIBCXX_MAKE_MOVE_ITERATOR(__tmp.begin()),
+ _GLIBCXX_MAKE_MOVE_ITERATOR(__tmp.end()));
}
}
@@ -641,11 +677,13 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
pointer __old_finish(this->_M_impl._M_finish);
if (__elems_after > __n)
{
+ _GLIBCXX_ASAN_ANNOTATE_GROW(__n);
std::__uninitialized_move_a(this->_M_impl._M_finish - __n,
this->_M_impl._M_finish,
this->_M_impl._M_finish,
_M_get_Tp_allocator());
this->_M_impl._M_finish += __n;
+ _GLIBCXX_ASAN_ANNOTATE_GREW(__n);
_GLIBCXX_MOVE_BACKWARD3(__position.base(),
__old_finish - __n, __old_finish);
std::copy(__first, __last, __position);
@@ -654,15 +692,18 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
{
_ForwardIterator __mid = __first;
std::advance(__mid, __elems_after);
+ _GLIBCXX_ASAN_ANNOTATE_GROW(__n);
std::__uninitialized_copy_a(__mid, __last,
this->_M_impl._M_finish,
_M_get_Tp_allocator());
this->_M_impl._M_finish += __n - __elems_after;
+ _GLIBCXX_ASAN_ANNOTATE_GREW(__n - __elems_after);
std::__uninitialized_move_a(__position.base(),
__old_finish,
this->_M_impl._M_finish,
_M_get_Tp_allocator());
this->_M_impl._M_finish += __elems_after;
+ _GLIBCXX_ASAN_ANNOTATE_GREW(__elems_after);
std::copy(__first, __mid, __position);
}
}
@@ -694,6 +735,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
_M_deallocate(__new_start, __len);
__throw_exception_again;
}
+ _GLIBCXX_ASAN_ANNOTATE_REINIT;
std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,
_M_get_Tp_allocator());
_M_deallocate(this->_M_impl._M_start,
@@ -856,6 +898,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
#endif
_GLIBCXX_END_NAMESPACE_CONTAINER
+_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#if __cplusplus >= 201103L
@@ -902,4 +945,9 @@ _GLIBCXX_END_NAMESPACE_VERSION
#endif // C++11
+#undef _GLIBCXX_ASAN_ANNOTATE_REINIT
+#undef _GLIBCXX_ASAN_ANNOTATE_GROW
+#undef _GLIBCXX_ASAN_ANNOTATE_GREW
+#undef _GLIBCXX_ASAN_ANNOTATE_SHRINK
+
#endif /* _VECTOR_TCC */