Don't generate code with unused private fields

A recent update to libchrome reveals that we were previously suppressing
warnings about unused private fields.  Without that, the generated code
can cause errors when interfaces have no methods.

Bug: 28117776
Change-Id: Ic734c1ce9485797065e504c566cad8d6edf45d07
Test: Generated code now compiles.
diff --git a/chromeos-dbus-bindings/adaptor_generator.cc b/chromeos-dbus-bindings/adaptor_generator.cc
index 0f980b5..1916534 100644
--- a/chromeos-dbus-bindings/adaptor_generator.cc
+++ b/chromeos-dbus-bindings/adaptor_generator.cc
@@ -86,7 +86,7 @@
   text->AddLine(StringPrintf("class %s {", class_name.c_str()));
   text->AddLineWithOffset("public:", kScopeOffset);
   text->PushOffset(kBlockOffset);
-  AddConstructor(class_name, itf_name, text);
+  AddConstructor(interface, class_name, itf_name, text);
   AddRegisterWithDBusObject(itf_name, interface, text);
   AddSendSignalMethods(interface, text);
   AddPropertyMethodImplementation(interface, text);
@@ -107,9 +107,11 @@
   AddSignalDataMembers(interface, text);
   AddPropertyDataMembers(interface, text);
 
-  text->AddLine(StringPrintf(
-      "%s* interface_;  // Owned by container of this adapter.",
-      itf_name.c_str()));
+  if (!interface.methods.empty()) {
+    text->AddLine(StringPrintf(
+        "%s* interface_;  // Owned by container of this adapter.",
+        itf_name.c_str()));
+  }
 
   text->AddBlankLine();
   text->AddLine(StringPrintf("DISALLOW_COPY_AND_ASSIGN(%s);",
@@ -122,11 +124,18 @@
 }
 
 // static
-void AdaptorGenerator::AddConstructor(const string& class_name,
+void AdaptorGenerator::AddConstructor(const Interface& interface,
+                                      const string& class_name,
                                       const string& itf_name,
                                       IndentedText *text) {
-  text->AddLine(StringPrintf("%s(%s* interface) : interface_(interface) {}",
-                             class_name.c_str(), itf_name.c_str()));
+  if (interface.methods.empty()) {
+    text->AddLine(StringPrintf("%s(%s* /* interface */) {}",
+                               class_name.c_str(), itf_name.c_str()));
+
+  } else {
+    text->AddLine(StringPrintf("%s(%s* interface) : interface_(interface) {}",
+                               class_name.c_str(), itf_name.c_str()));
+  }
 }
 
 // static
diff --git a/chromeos-dbus-bindings/adaptor_generator.h b/chromeos-dbus-bindings/adaptor_generator.h
index 57e2bf5..5cd68a3 100644
--- a/chromeos-dbus-bindings/adaptor_generator.h
+++ b/chromeos-dbus-bindings/adaptor_generator.h
@@ -41,7 +41,8 @@
                                   IndentedText *text);
 
   // Generates the constructor for the adaptor.
-  static void AddConstructor(const std::string& class_name,
+  static void AddConstructor(const Interface& interface,
+                             const std::string& class_name,
                              const std::string& itf_name,
                              IndentedText *text);