diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-07 01:03:53 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-07 01:03:53 +0000 |
commit | 8d09c271e3b13bac6d9aab9244e588fc88486c5f (patch) | |
tree | 2a5ed80f3119d9de7c1558f0acb170bdcb5e7c72 /base/scoped_ptr.h | |
parent | 04a8a104d96c96ee64bdbeb8dd1ed515e6521c5f (diff) | |
download | chromium_src-8d09c271e3b13bac6d9aab9244e588fc88486c5f.zip chromium_src-8d09c271e3b13bac6d9aab9244e588fc88486c5f.tar.gz chromium_src-8d09c271e3b13bac6d9aab9244e588fc88486c5f.tar.bz2 |
Warn about unused results on release() for three scoped_ptr classes.
Depends on cleaning up existing uses of release().
BUG=42904
TEST=compile
Review URL: http://codereview.chromium.org/1783015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46649 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/scoped_ptr.h')
-rw-r--r-- | base/scoped_ptr.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/base/scoped_ptr.h b/base/scoped_ptr.h index 34e4666a..c716e77 100644 --- a/base/scoped_ptr.h +++ b/base/scoped_ptr.h @@ -44,6 +44,8 @@ #include <stdlib.h> #include <cstddef> +#include "base/compiler_specific.h" + // A scoped_ptr<T> is like a T*, except that the destructor of scoped_ptr<T> // automatically deletes the pointer it holds (if any). // That is, scoped_ptr<T> owns the T object that it points to. @@ -113,7 +115,7 @@ class scoped_ptr { // If this object holds a NULL pointer, the return value is NULL. // After this operation, this object will hold a NULL pointer, // and will not own the object any more. - C* release() { + C* release() WARN_UNUSED_RESULT { C* retVal = ptr_; ptr_ = NULL; return retVal; @@ -220,7 +222,7 @@ class scoped_array { // If this object holds a NULL pointer, the return value is NULL. // After this operation, this object will hold a NULL pointer, // and will not own the object any more. - C* release() { + C* release() WARN_UNUSED_RESULT { C* retVal = array_; array_ = NULL; return retVal; @@ -337,7 +339,7 @@ class scoped_ptr_malloc { // If this object holds a NULL pointer, the return value is NULL. // After this operation, this object will hold a NULL pointer, // and will not own the object any more. - C* release() { + C* release() WARN_UNUSED_RESULT { C* tmp = ptr_; ptr_ = NULL; return tmp; |