Remove warnings from generated adaptors.

This patch modifies the dbusxx-xml2cpp's generate_adaptor function  so
that it prevents generation of the MessageIter ri in cases where an
interface method has no input arguments.

By making this element conditional based on the presence of input
arguments we avoid "unused-but-set-variable" warning in code that uses
the DBus-C++ adaptor glue headers.

Change-Id: I0f04439bf7b2b3cecb9d639e61c2b6dedc148e51
Type: Code Improvement
This commit is contained in:
James Harris 2013-10-28 08:39:21 -05:00 committed by Jeena
parent 63edf7777f
commit 63c7175250

View file

@ -485,9 +485,12 @@ void generate_adaptor(Xml::Document &doc, const char *filename)
Xml::Nodes args_out = args.select("direction", "out");
body << tab << "::DBus::Message " << stub_name(method.get("name")) << "(const ::DBus::CallMessage &call)" << endl
<< tab << "{" << endl
<< tab << tab << "::DBus::MessageIter ri = call.reader();" << endl
<< endl;
<< tab << "{" << endl;
if(!args_in.empty())
{
body << tab << tab << "::DBus::MessageIter ri = call.reader();" << endl;
body << endl;
}
// generate the 'in' variables
unsigned int i = 1;