thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nevo Hed <nhed+thrift...@bamboom.com>
Subject Generated multiface code causes compiler warning: control reaches end of non-void function
Date Fri, 14 Oct 2011 02:06:19 GMT
This was generated with a fresh copy of 0.7.0 using the tutorial.thrift

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 did not see anything in JIRA for this, should I create an issue for this?
(reluctant to address it myself because I'm not a user of Multiface and I
would not know if its fixed)

I would add a generation-time option to suppress multiface if that seems
reasonable

Thanks
   -Nevo


p.s. We like to compile with -Wall -Werror, and would rather not disable any
warnings ... hence this simple looking issue, is an issue for us.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message