Compiler warning on generated code (Multiface kills -Wall -Werror on gcc 4.6.1)
-------------------------------------------------------------------------------
Key: THRIFT-1398
URL: https://issues.apache.org/jira/browse/THRIFT-1398
Project: Thrift
Issue Type: Bug
Components: C++ - Compiler
Affects Versions: 0.7, 0.6
Environment: g++ v4.6.1, with all warnings enabled -Wall, using the
purist "treat warnings as errors" -Werror flag. No optimization flags
Reporter: Nevo Hed
I use an older version of g++ (4.1.2) but some of my fellow team members who
are using a more recent version (4.6.1)
they are reporting that (when used with '-Wall') g++, justifiably complains
about the second
int32_t calculate(const int32_t logid, const Work& w) {
size_t sz = ifaces_.size();
for (size_t i = 0; i < sz; ++i) {
if (i == sz - 1) {
return ifaces_[i]->calculate(logid, w);
} else {
ifaces_[i]->calculate(logid, w);
}
}
}
Though a human reading this code can see that the last loop execution results
in a return, the compiler can't
"error: control reaches end of non-void function [-Werror=return-type]"
I would add a generation-time option to suppress multiface if that seems
reasonable
At this time we find that we need to eother disable the warning or up the
optimization (or both?)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira