diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2017-07-21 16:05:10 +0000 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2017-07-21 16:05:10 +0000 |
commit | c11c579a688c446de01162e0a12a2837b6ebedea (patch) | |
tree | 6043f52919e5b7b0577fcb51573583ea8183b79c /libstdc++-v3/config | |
parent | 272feecab8181ddb4c82f150f391720f08f95221 (diff) |
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.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@250430 138bc75d-0d04-0410-961f-82ee72b054a4
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 b091bbca863..54e0837f01f 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 3d2bb67887f..e776ed31864 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 |