diff options
author | Ulrich Drepper <drepper@redhat.com> | 2019-01-16 08:01:22 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2019-01-16 08:01:22 +0000 |
commit | e675143a7df5224b26471ad653e034d1948cee6c (patch) | |
tree | b9245463a68430af8129b767c77468d18b048233 /libstdc++-v3/include/bits/c++config | |
parent | dadef9cef925e9ce83f3f2dec2804ac48899ccb8 (diff) |
PR libstdc++/88738 treat shared_ptr and unique_ptr more like plain old pointers
PR libstdc++/88738
Warn about unused comparisons of shared_ptr/unique_ptr
* include/bits/c++config [_GLIBCXX_NODISCARD]: Define.
* include/bits/shared_ptr.h: Use it for operator ==, !=,
<, <=, >, >= for shared_ptr.
* include/bits/unique_ptr.h: Likewise for unique_ptr.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@267964 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/bits/c++config')
-rw-r--r-- | libstdc++-v3/include/bits/c++config | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config index 9b2fabd7d76..97bb6db70b1 100644 --- a/libstdc++-v3/include/bits/c++config +++ b/libstdc++-v3/include/bits/c++config @@ -99,6 +99,14 @@ # define _GLIBCXX_ABI_TAG_CXX11 __attribute ((__abi_tag__ ("cxx11"))) #endif +// Macro to warn about unused results. +#if __cplusplus >= 201703L +# define _GLIBCXX_NODISCARD [[__nodiscard__]] +#else +# define _GLIBCXX_NODISCARD +#endif + + #if __cplusplus |