shill: Ignore missing-field-initializers warning on LAZY_INSTANCE_INITIALIZER.

When compiling with -Wextra, GCC gives a missing-field-initializers
warning (which is promoted to an error by -Werror) on the
LAZY_INSTANCE_INITIALIZER macro defined in base/lazy_instance.h.

This CL adds -Wno-missing-field-initializers to CXXFLAGS in Makefile to
ignore the warning on LAZY_INSTANCE_INITIALIZER.

BUG=chromium-os:29866
TEST=Build and run unit tests.

Change-Id: I8533f3b89780d1ec2b2c7222be3f5e26aa0e3b83
Reviewed-on: https://gerrit.chromium.org/gerrit/20888
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Commit-Ready: Ben Chan <benchan@chromium.org>
diff --git a/Makefile b/Makefile
index 5df7de4..d871669 100644
--- a/Makefile
+++ b/Makefile
@@ -5,6 +5,7 @@
 CXX ?= g++
 CXXFLAGS ?= -fno-strict-aliasing
 CXXFLAGS += -Wall -Wextra -Wno-unused-parameter -Wno-unused-result \
+	    -Wno-missing-field-initializers \
 	    -Werror -Wuninitialized -Woverloaded-virtual
 CXXFLAGS += $(EXTRA_CXXFLAGS)
 CPPFLAGS ?= -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
diff --git a/metrics.cc b/metrics.cc
index bf37f72..57de815 100644
--- a/metrics.cc
+++ b/metrics.cc
@@ -4,7 +4,6 @@
 
 #include "shill/metrics.h"
 
-#include <base/lazy_instance.h>
 #include <base/logging.h>
 #include <base/string_util.h>
 #include <base/stringprintf.h>
diff --git a/metrics.h b/metrics.h
index d4e7e69..aa1493f 100644
--- a/metrics.h
+++ b/metrics.h
@@ -7,7 +7,6 @@
 
 #include <list>
 
-#include <base/lazy_instance.h>
 #include <base/memory/scoped_vector.h>
 #include <metrics/metrics_library.h>
 #include <metrics/timer.h>
@@ -220,7 +219,6 @@
                          int max, int num_buckets);
 
  private:
-  friend struct base::DefaultLazyInstanceTraits<Metrics>;
   friend class MetricsTest;
   FRIEND_TEST(MetricsTest, FrequencyToChannel);
   FRIEND_TEST(MetricsTest, ServiceFailure);
diff --git a/nss.cc b/nss.cc
index 0db532a..5156cf6 100644
--- a/nss.cc
+++ b/nss.cc
@@ -20,14 +20,11 @@
 namespace shill {
 
 namespace {
+base::LazyInstance<NSS> g_nss = LAZY_INSTANCE_INITIALIZER;
 const char kCertfileBasename[] = "/tmp/nss-cert.";
 const char kNSSGetCertScript[] = SCRIPTDIR "/nss-get-cert";
 }  // namespace
 
-// TODO(ers): not using LAZY_INSTANCE_INITIALIZER
-// because of http://crbug.com/114828
-static base::LazyInstance<NSS> g_nss = { 0, {{0}} };
-
 NSS::NSS()
     : glib_(NULL) {
   SLOG(Crypto, 2) << __func__;
diff --git a/proxy_factory.cc b/proxy_factory.cc
index 2264398..63fe9ac 100644
--- a/proxy_factory.cc
+++ b/proxy_factory.cc
@@ -29,9 +29,9 @@
 
 namespace shill {
 
-// TODO(ers): not using LAZY_INSTANCE_INITIALIZER
-// because of http://crbug.com/114828
-static base::LazyInstance<ProxyFactory> g_proxy_factory = {0, {{0}}};
+namespace {
+base::LazyInstance<ProxyFactory> g_proxy_factory = LAZY_INSTANCE_INITIALIZER;
+}  // namespace
 
 ProxyFactory::ProxyFactory() {}
 
diff --git a/resolver.cc b/resolver.cc
index 22632c7..b0bc41c 100644
--- a/resolver.cc
+++ b/resolver.cc
@@ -20,9 +20,9 @@
 
 namespace shill {
 
-// TODO(ers): not using LAZY_INSTANCE_INITIALIZER
-// because of http://crbug.com/114828
-static base::LazyInstance<Resolver> g_resolver = {0, {{0}}};
+namespace {
+base::LazyInstance<Resolver> g_resolver = LAZY_INSTANCE_INITIALIZER;
+}  // namespace
 
 Resolver::Resolver() {}
 
diff --git a/routing_table.cc b/routing_table.cc
index 9c8941a..e227b07 100644
--- a/routing_table.cc
+++ b/routing_table.cc
@@ -41,9 +41,9 @@
 
 namespace shill {
 
-// TODO(ers): not using LAZY_INSTANCE_INITIALIZER
-// because of http://crbug.com/114828
-static base::LazyInstance<RoutingTable> g_routing_table = {0, {{0}}};
+namespace {
+base::LazyInstance<RoutingTable> g_routing_table = LAZY_INSTANCE_INITIALIZER;
+}  // namespace
 
 // static
 const char RoutingTable::kRouteFlushPath4[] = "/proc/sys/net/ipv4/route/flush";
diff --git a/rtnl_handler.cc b/rtnl_handler.cc
index 1447295..032b0c8 100644
--- a/rtnl_handler.cc
+++ b/rtnl_handler.cc
@@ -35,9 +35,9 @@
 
 namespace shill {
 
-// TODO(ers): not using LAZY_INSTANCE_INITIALIZER
-// because of http://crbug.com/114828
-static base::LazyInstance<RTNLHandler> g_rtnl_handler = {0, {{0}}};
+namespace {
+base::LazyInstance<RTNLHandler> g_rtnl_handler = LAZY_INSTANCE_INITIALIZER;
+}  // namespace
 
 RTNLHandler::RTNLHandler()
     : sockets_(NULL),
diff --git a/scope_logger.cc b/scope_logger.cc
index 1865ed8..119b105 100644
--- a/scope_logger.cc
+++ b/scope_logger.cc
@@ -52,9 +52,7 @@
 COMPILE_ASSERT(arraysize(kScopeNames) == ScopeLogger::kNumScopes,
                scope_tags_does_not_have_expected_number_of_strings);
 
-// TODO(benchan): not using LAZY_INSTANCE_INITIALIZER
-// because of http://crbug.com/114828
-base::LazyInstance<ScopeLogger> g_scope_logger = {0, {{0}}};
+base::LazyInstance<ScopeLogger> g_scope_logger = LAZY_INSTANCE_INITIALIZER;
 
 }  // namespace
 
diff --git a/shill_ares.cc b/shill_ares.cc
index 9743950..93e9ecd 100644
--- a/shill_ares.cc
+++ b/shill_ares.cc
@@ -6,9 +6,9 @@
 
 namespace shill {
 
-// TODO(ers): not using LAZY_INSTANCE_INITIALIZER
-// because of http://crbug.com/114828
-static base::LazyInstance<Ares> g_ares = {0, {{0}}};
+namespace {
+base::LazyInstance<Ares> g_ares = LAZY_INSTANCE_INITIALIZER;
+}  // namespace
 
 Ares::Ares() { }
 
diff --git a/shill_time.cc b/shill_time.cc
index c55c152..c691c8c 100644
--- a/shill_time.cc
+++ b/shill_time.cc
@@ -8,9 +8,9 @@
 
 namespace shill {
 
-// TODO(ers): not using LAZY_INSTANCE_INITIALIZER
-// because of http://crbug.com/114828
-static base::LazyInstance<Time> g_time = {0, {{0}}};
+namespace {
+base::LazyInstance<Time> g_time = LAZY_INSTANCE_INITIALIZER;
+}  // namespace
 
 Time::Time() { }