diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2017-07-21 17:05:10 +0100 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2017-07-21 17:05:10 +0100 |
commit | 8c7331c5563e00e63837d0246f1325371157d46a (patch) | |
tree | 6043f52919e5b7b0577fcb51573583ea8183b79c /libstdc++-v3/config | |
parent | 5c2dee6fc9c52bf0cb0ddbd95333ab3d0745df3b (diff) | |
download | gcc-8c7331c5563e00e63837d0246f1325371157d46a.zip gcc-8c7331c5563e00e63837d0246f1325371157d46a.tar.gz gcc-8c7331c5563e00e63837d0246f1325371157d46a.tar.bz2 |
Add AddressSanitizer annotations to std::vector
* config/allocator/malloc_allocator_base.h [__SANITIZE_ADDRESS__]
(_GLIBCXX_SANITIZE_STD_ALLOCATOR): Define.
* config/allocator/new_allocator_base.h [__SANITIZE_ADDRESS__]
(_GLIBCXX_SANITIZE_STD_ALLOCATOR): Define.
* doc/xml/manual/using.xml (_GLIBCXX_SANITIZE_VECTOR): Document macro.
* include/bits/stl_vector.h [_GLIBCXX_SANITIZE_VECTOR]
(_Vector_impl::_Asan, _Vector_impl::_Asan::_Reinit)
(_Vector_impl::_Asan::_Grow, _GLIBCXX_ASAN_ANNOTATE_REINIT)
(_GLIBCXX_ASAN_ANNOTATE_GROW, _GLIBCXX_ASAN_ANNOTATE_GREW)
(_GLIBCXX_ASAN_ANNOTATE_SHRINK, _GLIBCXX_ASAN_ANNOTATE_BEFORE_DEALLOC):
Define annotation helper types and macros.
(vector::~vector, vector::push_back, vector::pop_back)
(vector::_M_erase_at_end): Add annotations.
* include/bits/vector.tcc (vector::reserve, vector::emplace_back)
(vector::insert, vector::_M_erase, vector::operator=)
(vector::_M_fill_assign, vector::_M_assign_aux)
(vector::_M_insert_rval, vector::_M_emplace_aux)
(vector::_M_insert_aux, vector::_M_realloc_insert)
(vector::_M_fill_insert, vector::_M_default_append)
(vector::_M_shrink_to_fit, vector::_M_range_insert): Annotate.
From-SVN: r250430
Diffstat (limited to 'libstdc++-v3/config')
-rw-r--r-- | libstdc++-v3/config/allocator/malloc_allocator_base.h | 4 | ||||
-rw-r--r-- | libstdc++-v3/config/allocator/new_allocator_base.h | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/libstdc++-v3/config/allocator/malloc_allocator_base.h b/libstdc++-v3/config/allocator/malloc_allocator_base.h index b091bbc..54e0837 100644 --- a/libstdc++-v3/config/allocator/malloc_allocator_base.h +++ b/libstdc++-v3/config/allocator/malloc_allocator_base.h @@ -52,4 +52,8 @@ namespace std # define __allocator_base __gnu_cxx::malloc_allocator #endif +#if defined(__SANITIZE_ADDRESS__) && !defined(_GLIBCXX_SANITIZE_STD_ALLOCATOR) +# define _GLIBCXX_SANITIZE_STD_ALLOCATOR 1 +#endif + #endif diff --git a/libstdc++-v3/config/allocator/new_allocator_base.h b/libstdc++-v3/config/allocator/new_allocator_base.h index 3d2bb67..e776ed3 100644 --- a/libstdc++-v3/config/allocator/new_allocator_base.h +++ b/libstdc++-v3/config/allocator/new_allocator_base.h @@ -52,4 +52,8 @@ namespace std # define __allocator_base __gnu_cxx::new_allocator #endif +#if defined(__SANITIZE_ADDRESS__) && !defined(_GLIBCXX_SANITIZE_STD_ALLOCATOR) +# define _GLIBCXX_SANITIZE_STD_ALLOCATOR 1 +#endif + #endif |