Hi all,
I am running the following code which spits out “[-Wunused-value]” warnings,
bool setNameGeneral(TObject* obj, const std::string& name) {
if (obj != 0) {
TClass* kl = obj->IsA();
TMethod* klm = kl->GetMethod("SetName", "\"Reference\"");
if (klm) {
obj->Execute("SetName", ("\""+name+"\"").c_str());
return true;
}
}
return false;
}
...
setNameGeneral(obj, somename);
E.g.
In file included from input_line_1:1:
In file included from /afs/cern.ch/sw/lcg/releases/gcc/4.8.1/x86_64-slc6/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../include/c++/4.8.1/new:14:
input_line_33319:2:2: warning: expression result unused [-Wunused-value]
"Rphi";
^~~~~~
In file included from input_line_1:1:
In file included from /afs/cern.ch/sw/lcg/releases/gcc/4.8.1/x86_64-slc6/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../include/c++/4.8.1/new:14:
input_line_33320:2:2: warning: expression result unused [-Wunused-value]
"charge";
^~~~~~~~
In file included from input_line_1:1:
In file included from /afs/cern.ch/sw/lcg/releases/gcc/4.8.1/x86_64-slc6/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../include/c++/4.8.1/new:14:
input_line_33321:2:2: warning: expression result unused [-Wunused-value]
"d0";
^~~~
In file included from input_line_1:1:
In file included from /afs/cern.ch/sw/lcg/releases/gcc/4.8.1/x86_64-slc6/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../include/c++/4.8.1/new:14:
input_line_33322:2:2: warning: expression result unused [-Wunused-value]
"d0sig";
^~~~~~~
I think these warnings can be disabled if setting pragma clang statement,
#pragma clang diagnostic ignored "-Wunused-value"
Do you know how to do that? Or maybe there is a better way to get rid of these nasty clang warnings?
Thanks!