On Fri, 04 Apr 2014 11:03:57 -0400, Zack Weinberg wrote:

>> On Tue, Apr 1, 2014 at 10:13 PM, Karl Tomlinson <mozn...@karlt.net>
>> wrote:
>>> Does WARNINGS_AS_ERRORS make the default:MOZ_CRASH()
>>> unnecessary?
>> 
>> No, because it's possible that the thing you're testing is not 
>> actually a valid enum value, such as if it was incorrectly cast.
>> Our codebase has no shortage of dubious casts.
>
> Also, in many cases default:MOZ_CRASH() would kill control flow paths
> that make the compiler think variables might be used uninitialized.

OK.  Even with -Wswitch issuing no warning with no default clause,
the compiler may need to handle the switch matching no case,
because enumeration types may hold values that don't match any of
their enumerator values.

However, if the compiler knows that falling through would cause a
variable to be used uninitialized, then it knows that would have
undefined behaviour, so it would not need to handle that situation
in any particular way.
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to