[ https://issues.apache.org/jira/browse/THRIFT-1398?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13132609#comment-13132609 ]
Jake Farrell commented on THRIFT-1398: -------------------------------------- Nevo, right now the CI server is set to run with -Wall -Wno-sign-compare -Wno-unused. -Werror was enabled but we have some issues we are trying to cleanup to be able to reenable that flag. If you would like to contribute a patch for this issue please see http://wiki.apache.org/thrift/HowToContribute > 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.6, 0.7 > 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 possible lack of return > 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]" > IMHO we should have a single return at the end of the function > I would add a generation-time option to suppress multiface if that seems > reasonable > At this time we find that we need to either 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