diff options
author | Mikhail Kashkarov <m.kashkarov@partner.samsung.com> | 2018-02-12 14:01:28 +0300 |
---|---|---|
committer | Mikhail Kashkarov <m.kashkarov@partner.samsung.com> | 2018-04-13 15:55:42 +0300 |
commit | 96138eae7953ab7c589e78bbcb8cb03516555f26 (patch) | |
tree | d5c42295584e6ff7079ca72d9bd3773a21542829 | |
parent | 5906dbb3f366091926e58b16ce4317bdd114eba8 (diff) | |
download | linaro-gcc-96138eae7953ab7c589e78bbcb8cb03516555f26.tar.gz linaro-gcc-96138eae7953ab7c589e78bbcb8cb03516555f26.tar.bz2 linaro-gcc-96138eae7953ab7c589e78bbcb8cb03516555f26.zip |
Testing annotations for basic_streambuf.
Change-Id: Ie6069aaf2b4750d8c22255551c2ded0e961f8e9d
-rw-r--r-- | libstdc++-v3/include/bits/basic_string.h | 12 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/c++config | 16 | ||||
-rw-r--r-- | libstdc++-v3/include/std/streambuf | 25 |
3 files changed, 41 insertions, 12 deletions
diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h index 4f180edd4dd..fe987655206 100644 --- a/libstdc++-v3/include/bits/basic_string.h +++ b/libstdc++-v3/include/bits/basic_string.h @@ -174,6 +174,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 static const size_type npos = static_cast<size_type>(-1); friend class basic_stringbuf<_CharT, _Traits, _Alloc>; + friend class basic_streambuf<_CharT, _Traits>; + friend class basic_ostream<_CharT, _Traits>; + private: //#ifdef _GLIBCXX_HAS_ASAN // The annotation for size increase should happen before the actual @@ -2884,8 +2887,9 @@ _GLIBCXX_END_NAMESPACE_CXX11 struct _Rep : _Rep_base { friend class basic_string; - friend class basic_ostream; - // Types: + //friend class basic_ostream<_CharT, _Traits>; + //friend class basic_streambuf<_CharT, _Traits>; + // Types: typedef typename _Alloc::template rebind<char>::other _Raw_bytes_alloc; typedef basic_string_asan_traits<_CharT, _CharT_alloc_type> __asan_traits; @@ -5657,9 +5661,9 @@ _GLIBCXX_END_NAMESPACE_CXX11 { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 586. string inserter not a formatted function - __str.__annotate_delete(); + //__str.__annotate_delete(); return __ostream_insert(__os, __str.data(), __str.size()); - __str.__annotate_new(__str.size()); + //__str.__annotate_new(__str.size()); } /** diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config index 0a99267459e..26561132241 100644 --- a/libstdc++-v3/include/bits/c++config +++ b/libstdc++-v3/include/bits/c++config @@ -431,14 +431,16 @@ namespace std #endif // Containers' sanitization must be explicitly enabled. -#if defined(_GLIBCXX_ADDRESS_SANITIZER_ANNOTATIONS) && defined(__SANITIZE_ADDRESS__) -# define _GLIBCXX_HAS_ASAN -#else -# if defined(__has_feature) -# if defined(_GLIBCXX_ADDRESS_SANITIZER_ANNOTATIONS) && __has_feature(address_sanitizer) -# define _GLIBCXX_HAS_ASAN -# endif +#if defined(_GLIBCXX_ADDRESS_SANITIZER_ANNOTATIONS) +# if defined(__SANITIZE_ADDRESS__) +# define _GLIBCXX_HAS_ASAN # endif +# else +# if defined(__has_feature) +# if __has_feature(address_sanitizer) +# define _GLIBCXX_HAS_ASAN +# endif +# endif #endif // Disable std::string explicit instantiation declarations to not break ASan diff --git a/libstdc++-v3/include/std/streambuf b/libstdc++-v3/include/std/streambuf index cb3315e85ba..31ce9e356b0 100644 --- a/libstdc++-v3/include/std/streambuf +++ b/libstdc++-v3/include/std/streambuf @@ -131,6 +131,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION typedef typename traits_type::int_type int_type; typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; + //typedef basic_string_asan_traits<_CharT, _Char_alloc_type> __asan_traits; //@} //@{ @@ -426,6 +427,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION int_type __ret; if (__builtin_expect(this->pptr() < this->epptr(), true)) { + //this->__annotate_grow(_M_out_cur + 1); *this->pptr() = __c; this->pbump(1); __ret = traits_type::to_int_type(__c); @@ -464,7 +466,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : _M_in_beg(0), _M_in_cur(0), _M_in_end(0), _M_out_beg(0), _M_out_cur(0), _M_out_end(0), _M_buf_locale(locale()) - { } + { + //__annotate_new(_M_in_beg, _M_in_cur, _M_in_end); + //__annotate_new(_M_out_beg, _M_out_cur, _M_out_end); + } // [27.5.2.3.1] get area access //@{ @@ -511,6 +516,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_in_beg = __gbeg; _M_in_cur = __gnext; _M_in_end = __gend; + //__annotate_new(_M_in_beg, _M_in_cur, _M_in_end); } // [27.5.2.3.2] put area access @@ -556,6 +562,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { _M_out_beg = _M_out_cur = __pbeg; _M_out_end = __pend; + //__annotate_new(_M_out_beg, _M_out_cur, _M_out_end); } // [27.5.2.4] virtual functions @@ -796,6 +803,22 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION void __safe_pbump(streamsize __n) { _M_out_cur += __n; } + //private: + //void __annotate_new(size_type beg, size_type mid, size_type end) const _GLIBCXX_VISIBILITY(hidden) + //{ + //__asan_traits::__annotate_new(beg, mid, end); + //} + // + //void __annotate_grow(size_type beg, size_type old_mid, size_type new_mid, size_type end) const _GLIBCXX_VISIBILITY(hidden) + //{ + //__asan_traits::__annotate_grow(beg, old_mid, new_mid, end); + //} + // + //void __annotate_dekete(size_type beg, size_type mid, size_type end) const _GLIBCXX_VISIBILITY(hidden) + //{ + //__asan_traits::__annotate_delete(beg, mid, end); + //} + // #if __cplusplus < 201103L private: #else |