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

Filip Pizlo fpizlo at apple.com
Fri Sep 13 14:09:34 PDT 2013


On Sep 13, 2013, at 10:33 AM, Darin Adler <darin at apple.com> wrote:

> On Sep 13, 2013, at 10:31 AM, Oliver Hunt <oliver at apple.com> wrote:
> 
>> We may want to hunt through the other cases of default: ASSERT_NOT_REACHED() and clobber those with RELEASE_ASSERT_NOT_REACHED() as well.
>> 
>> I wonder if it would be easier to have DEFAULT_NOT_REACHED() and DEFAULT_OKAY() macros, and convince the style bot to require ether a default: block or one of these two macros at the end of every switch?
> 
> 
> Maybe.
> 
> The advantage of doing the not-reached assertion after the switch is that we get the compile time warning if we don’t enumerate one of the enum values. Having a default case turns that warning off.

Yes.  I've already been moving towards this idiom.

-F

> 
> -- Darin
> _______________________________________________
> 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