diff options
author | Christopher Wiley <wiley@google.com> | 2016-01-04 19:40:37 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2016-01-04 19:40:37 +0000 |
commit | fc305a170ef11c3fa05fde88e59e098b5ab66b3c (patch) | |
tree | 84efcf8cbb9e56db9f9bbccc4491e0a5689bd3f1 | |
parent | e0affa61fcf906611bf8332a392f72845eb9424b (diff) | |
parent | 4d7450f26396d6a5d3135e058873d484c3857aa0 (diff) | |
download | dbus-binding-generator-fc305a170ef11c3fa05fde88e59e098b5ab66b3c.tar.gz |
Fix compiler warnings in dbus-binding-generator
am: 4d7450f263
* commit '4d7450f26396d6a5d3135e058873d484c3857aa0':
Fix compiler warnings in dbus-binding-generator
-rw-r--r-- | Android.mk | 2 | ||||
-rw-r--r-- | chromeos-dbus-bindings/proxy_generator.cc | 20 | ||||
-rw-r--r-- | chromeos-dbus-bindings/proxy_generator_unittest.cc | 7 |
3 files changed, 22 insertions, 7 deletions
@@ -14,7 +14,7 @@ LOCAL_PATH := $(call my-dir) -libdbusBindingGenCFlags := -Wno-unused-parameter +libdbusBindingGenCFlags := -Wall -Werror include $(CLEAR_VARS) LOCAL_MODULE := libdbus-binding-gen-host diff --git a/chromeos-dbus-bindings/proxy_generator.cc b/chromeos-dbus-bindings/proxy_generator.cc index 55c9eee..8c295ee 100644 --- a/chromeos-dbus-bindings/proxy_generator.cc +++ b/chromeos-dbus-bindings/proxy_generator.cc @@ -767,7 +767,7 @@ void ProxyGenerator::AddAsyncMethodProxy(const Interface::Method& method, // static void ProxyGenerator::AddMethodMock(const Interface::Method& method, - const string& interface_name, + const string& /* interface_name */, IndentedText* text) { DbusSignature signature; vector<string> arguments; @@ -794,7 +794,7 @@ void ProxyGenerator::AddMethodMock(const Interface::Method& method, // static void ProxyGenerator::AddAsyncMethodMock(const Interface::Method& method, - const string& interface_name, + const string& /* interface_name */, IndentedText* text) { DbusSignature signature; vector<string> arguments; @@ -1137,6 +1137,22 @@ void ProxyGenerator::ObjectManager::AddInterfaceAccessors( void ProxyGenerator::ObjectManager::AddOnPropertyChanged( const std::vector<Interface>& interfaces, IndentedText* text) { + // If there are no interfaces with properties, comment out parameter + // names for OnPropertyChanged() to prevent compiler warnings on unused + // function parameters. + auto has_props = [](const Interface& itf) { return !itf.properties.empty(); }; + auto itf_with_props = std::find_if(interfaces.begin(), interfaces.end(), + has_props); + if (itf_with_props == interfaces.end()) { + text->AddLineAndPushOffsetTo("void OnPropertyChanged(" + "const dbus::ObjectPath& /* object_path */,", + 1, '('); + text->AddLine("const std::string& /* interface_name */,"); + text->AddLine("const std::string& /* property_name */) {}"); + text->PopOffset(); + text->AddBlankLine(); + return; + } text->AddLineAndPushOffsetTo("void OnPropertyChanged(" "const dbus::ObjectPath& object_path,", 1, '('); diff --git a/chromeos-dbus-bindings/proxy_generator_unittest.cc b/chromeos-dbus-bindings/proxy_generator_unittest.cc index 4eda77c..728e977 100644 --- a/chromeos-dbus-bindings/proxy_generator_unittest.cc +++ b/chromeos-dbus-bindings/proxy_generator_unittest.cc @@ -1196,10 +1196,9 @@ class ObjectManagerProxy : public dbus::ObjectManager::Interface { } private: - void OnPropertyChanged(const dbus::ObjectPath& object_path, - const std::string& interface_name, - const std::string& property_name) { - } + void OnPropertyChanged(const dbus::ObjectPath& /* object_path */, + const std::string& /* interface_name */, + const std::string& /* property_name */) {} void ObjectAdded( const dbus::ObjectPath& object_path, |