shill: re-enable unused-result warning

Eliminate code that violates no-unused-result, and remove
-Wno-unused-result from the c++ compiler flags in the gyp
file.

BUG=chromium:293668
TEST=unit tests

Change-Id: I2edb193e0cf43c2ca70545ada11229a1737f5d0c
Reviewed-on: https://chromium-review.googlesource.com/195763
Tested-by: mukesh agrawal <quiche@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Queue: mukesh agrawal <quiche@chromium.org>
diff --git a/dbus_async_call_helper.h b/dbus_async_call_helper.h
index a765543..2e952c5 100644
--- a/dbus_async_call_helper.h
+++ b/dbus_async_call_helper.h
@@ -7,6 +7,7 @@
 
 #include "shill/logging.h"
 
+#include <base/basictypes.h>  // for ignore_result
 #include <dbus-c++/error.h>
 
 #include "shill/error.h"
@@ -39,7 +40,16 @@
   auto cb = make_scoped_ptr(new CallbackT(callback));
   try {
     (proxy.*call)(call_args..., cb.get(), timeout);
-    cb.release();
+    // We've successfully passed ownership of |cb| to |proxy|, so we
+    // must release() ownership.  (Otherwise, |cb| will be deleted on
+    // return from this function.)
+    //
+    // Since we have no further need to reference the CallbackT in
+    // this scope, we ignore the return value of release().  Ignoring
+    // the return value is normally an error, because that means
+    // you're leaking the object.  However, it's fine here, because
+    // |proxy| now owns |cb|.
+    ignore_result(cb.release());
   } catch (const DBus::Error &e) {
     if (error)
       error_converter(e, error);
diff --git a/device_info_unittest.cc b/device_info_unittest.cc
index f058c08..c413953 100644
--- a/device_info_unittest.cc
+++ b/device_info_unittest.cc
@@ -1077,7 +1077,7 @@
   virtual ~DeviceInfoTechnologyTest() {}
 
   virtual void SetUp() {
-    temp_dir_.CreateUniqueTempDir();
+    CHECK(temp_dir_.CreateUniqueTempDir());
     device_info_root_ = temp_dir_.path().Append("sys/class/net");
     device_info_.device_info_root_ = device_info_root_;
     // Most tests require that the uevent file exist.
@@ -1092,6 +1092,7 @@
   void CreateInfoSymLink(const string &name, const string &contents);
   void SetDeviceName(const string &name) {
     test_device_name_ = name;
+    EXPECT_TRUE(temp_dir_.Delete());  // nuke old temp dir
     SetUp();
   }
 
diff --git a/openvpn_driver_unittest.cc b/openvpn_driver_unittest.cc
index eb7f6fb..f5b1b9e 100644
--- a/openvpn_driver_unittest.cc
+++ b/openvpn_driver_unittest.cc
@@ -109,7 +109,7 @@
     driver_->extra_certificates_file_.reset(
         extra_certificates_file_);  // Passes ownership.
     driver_->process_killer_ = &process_killer_;
-    temporary_directory_.CreateUniqueTempDir();
+    CHECK(temporary_directory_.CreateUniqueTempDir());
     driver_->openvpn_config_directory_ =
         temporary_directory_.path().Append(kOpenVPNConfigDirectory);
   }
diff --git a/shill.gyp b/shill.gyp
index 44f1a8c..5a21e60 100644
--- a/shill.gyp
+++ b/shill.gyp
@@ -18,7 +18,6 @@
       '-std=gnu++11',
       '-Woverloaded-virtual',
       '-Wno-missing-field-initializers',  # for LAZY_INSTANCE_INITIALIZER
-      '-Wno-unused-result',  # crbug.com/293668
     ],
     'defines': [
       '__STDC_FORMAT_MACROS',