Added stricter warning options

Change-Id: Id06921376ec1c6ed4ce1784952fd80e0dc0a3a2a
Reviewed-on: https://weave-review.googlesource.com/1190
Reviewed-by: Alex Vakulenko <avakulenko@google.com>
diff --git a/libweave/examples/ubuntu/curl_http_client.cc b/libweave/examples/ubuntu/curl_http_client.cc
index 10e3155..3e996e3 100644
--- a/libweave/examples/ubuntu/curl_http_client.cc
+++ b/libweave/examples/ubuntu/curl_http_client.cc
@@ -121,13 +121,14 @@
                               weak_ptr_factory_.GetWeakPtr(), success_callback,
                               request_id_, base::Passed(&response)),
         {});
-    return request_id_;
+  } else {
+    task_runner_->PostDelayedTask(
+        FROM_HERE, base::Bind(&CurlHttpClient::RunErrorCallback,
+                              weak_ptr_factory_.GetWeakPtr(), error_callback,
+                              request_id_, base::Passed(&error)),
+        {});
   }
-  task_runner_->PostDelayedTask(
-      FROM_HERE, base::Bind(&CurlHttpClient::RunErrorCallback,
-                            weak_ptr_factory_.GetWeakPtr(), error_callback,
-                            request_id_, base::Passed(&error)),
-      {});
+  return request_id_;
 }
 
 void CurlHttpClient::RunSuccessCallback(const SuccessCallback& success_callback,
diff --git a/libweave/examples/ubuntu/event_http_server.cc b/libweave/examples/ubuntu/event_http_server.cc
index 31b569d..9c0dc78 100644
--- a/libweave/examples/ubuntu/event_http_server.cc
+++ b/libweave/examples/ubuntu/event_http_server.cc
@@ -58,7 +58,7 @@
   void CancelPendingOperations() override {}
 
  private:
-  const std::vector<uint8_t>& data_;
+  std::vector<uint8_t> data_;
   provider::TaskRunner* task_runner_;
   size_t read_position_{0};
 };
diff --git a/libweave/examples/ubuntu/network_manager.cc b/libweave/examples/ubuntu/network_manager.cc
index b910b55..0fdae2d 100644
--- a/libweave/examples/ubuntu/network_manager.cc
+++ b/libweave/examples/ubuntu/network_manager.cc
@@ -34,13 +34,14 @@
 
   execvp(path.c_str(), const_cast<char**>(args_vector.data()));
   NOTREACHED();
+  return 0;
 }
 
 }  // namespace
 
 NetworkImpl::NetworkImpl(provider::TaskRunner* task_runner,
                          bool force_bootstrapping)
-    : task_runner_{task_runner}, force_bootstrapping_{force_bootstrapping} {
+    : force_bootstrapping_{force_bootstrapping}, task_runner_{task_runner} {
   SSL_load_error_strings();
   SSL_library_init();
 
@@ -141,8 +142,6 @@
                                 base::Bind(&NetworkImpl::UpdateNetworkState,
                                            weak_ptr_factory_.GetWeakPtr()),
                                 base::TimeDelta::FromSeconds(10));
-
-  bool online = GetConnectionState() == State::kConnected;
   for (const auto& cb : callbacks_)
     cb.Run();
 }
@@ -194,8 +193,8 @@
 }
 
 void NetworkImpl::StopAccessPoint() {
-  int res = std::system("pkill -f dnsmasq.*/tmp/weave");
-  res = std::system("pkill -f hostapd.*/tmp/weave");
+  base::IgnoreResult(std::system("pkill -f dnsmasq.*/tmp/weave"));
+  base::IgnoreResult(std::system("pkill -f hostapd.*/tmp/weave"));
   CHECK_EQ(0, std::system("nmcli nm wifi on"));
   hostapd_started_ = false;
 }
diff --git a/libweave/include/weave/settings.h b/libweave/include/weave/settings.h
index 264c6fa..4d55f97 100644
--- a/libweave/include/weave/settings.h
+++ b/libweave/include/weave/settings.h
@@ -14,21 +14,29 @@
 namespace weave {
 
 struct Settings {
-  std::string client_id;
-  std::string client_secret;
-  std::string api_key;
-  std::string oauth_url;
-  std::string service_url;
-  std::string name;
-  std::string description;
-  std::string location;
-  std::string local_anonymous_access_role;
-  bool local_discovery_enabled{true};
-  bool local_pairing_enabled{true};
+  // Model specific information. Must be set by ConfigStore::LoadDefaults.
   std::string firmware_version;
   std::string oem_name;
   std::string model_name;
   std::string model_id;
+
+  // Basic device information. Can be set from ConfigStore::LoadDefaults.
+  std::string name;
+  std::string description;
+  std::string location;
+
+  // Cloud information. Must be set from ConfigStore::LoadDefaults.
+  std::string api_key;
+  std::string client_id;
+  std::string client_secret;
+
+  // Optional cloud information. Can be used for testing or debugging.
+  std::string oauth_url;
+  std::string service_url;
+
+  std::string local_anonymous_access_role;
+  bool local_discovery_enabled{true};
+  bool local_pairing_enabled{true};
   base::TimeDelta polling_period;
   base::TimeDelta backup_polling_period;
 
diff --git a/libweave/libweave_common.gypi b/libweave/libweave_common.gypi
index a290f7e..84c7a17 100644
--- a/libweave/libweave_common.gypi
+++ b/libweave/libweave_common.gypi
@@ -29,11 +29,19 @@
     'cflags': [
       '-fPIC',
       '-fvisibility=hidden',
+      '-std=c++11',
+      '-Wall',
+      '-Werror',
+      '-Wextra',
       '-Wl,--exclude-libs,ALL',
-      '--std=c++11',
-      '-Wno-format-nonliteral',
       '-Wno-char-subscripts',
-      #'-Wno-deprecated-register',
+      '-Wno-format-nonliteral',
+      '-Wno-missing-field-initializers',
+      '-Wno-unused-local-typedefs',
+      '-Wno-unused-parameter',
+      '-Wpacked',
+      '-Wpointer-arith',
+      '-Wwrite-strings',
     ],
     'libraries': [
       '-L../../third_party/lib',