[webkit-dev] Can we disable "control reaches end of non-void function" warning on Qt?

Allan Sandfeld Jensen kde at carewolf.com
Thu Sep 12 16:45:03 PDT 2013


Don't worry we are still here, just in fewer numbers, and with fewer things to 
support. 

I would prefer to keep the warning, it is quite useful at times, and when it 
isn't you just add a default case with an ASSERT_NOT_REACHED().

`Allan

On Friday 13 September 2013, Benjamin Poulain wrote:
> The problem here is Qt uses older compilers which do not detect when all
> cases are handled before the end of the function (like the example of
> Ryosuke).
> 
> It looks like this will not be a problem for much longer. Qt people are
> giving up on developing a web engine:
> http://blog.qt.digia.com/blog/2013/09/12/introducing-the-qt-webengine/
> 
> Benjamin
> 
> On 9/12/13 4:19 PM, Myles C. Maxfield wrote:
> > I can't speak for Qt, but this warning has been helpful for me in the
> > past.
> > 
> > 
> > On Thu, Sep 12, 2013 at 2:07 PM, Ryosuke Niwa <rniwa at webkit.org
> > 
> > <mailto:rniwa at webkit.org>> wrote:
> >     Hi,
> >     
> >     http://trac.webkit.org/changeset/155643 broke Qt build with an
> >     error saying:
> >     
> >     Source/JavaScriptCore/dfg/DFGGPRInfo.h:169:5: error: control
> >     reaches end of non-void function [-Werror=return-type]
> >     cc1plus: all warnings being treated as errors
> >     
> >     because of the following code:
> >     
> >     GPRReg gpr(WhichValueWord which) const
> >     {
> >     
> >         switch (which) {
> >         
> >         case TagWord:
> >             return tagGPR();
> >         
> >         case PayloadWord:
> >             return payloadGPR();
> >         
> >         }
> >     
> >     }
> >     
> >     But the code works just fine as is because WhichValueWord only
> >     takes two values (TagWord and PayloadWord) and they're all handled
> >     in the switch statement.
> >     
> >     Can we disable this warning so that we don't have to add a bogus
> >     code like the one I had to add in
> >     http://trac.webkit.org/changeset/155649/trunk/Source/JavaScriptCore/d
> >     fg/DFGGPRInfo.h ?
> >     
> >     - R. Niwa
> >     
> >     
> >     _______________________________________________
> >     webkit-dev mailing list
> >     webkit-dev at lists.webkit.org <mailto:webkit-dev at lists.webkit.org>
> >     https://lists.webkit.org/mailman/listinfo/webkit-dev
> > 
> > _______________________________________________
> > webkit-dev mailing list
> > webkit-dev at lists.webkit.org
> > https://lists.webkit.org/mailman/listinfo/webkit-dev



More information about the webkit-dev mailing list