Summary: | Missing default switch for baselineShift case statement | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | James Hawkins <jhawkins> | ||||
Component: | CSS | Assignee: | Nobody <webkit-unassigned> | ||||
Status: | RESOLVED DUPLICATE | ||||||
Severity: | Trivial | CC: | cmarcelo, eric | ||||
Priority: | P2 | ||||||
Version: | 528+ (Nightly build) | ||||||
Hardware: | All | ||||||
OS: | All | ||||||
Attachments: |
|
Description
James Hawkins
2009-07-31 17:01:10 PDT
Created attachment 33909 [details]
Assert on unhandled values for baselineShift
Comment on attachment 33909 [details]
Assert on unhandled values for baselineShift
By adding the default case, you are turning off the gcc feature that complains if an enum value is not handled in a switch statement.
So you are turning off compile-time detection (under gcc) of the very thing you are trying to catch at runtime.
And compile-time detection is even better, so we don't want it turned off!
Please put the assertion outside the switch statement instead of adding a default case. Or just drop this while thing, since we'll catch missing enum values immediately due to gcc's warning as soon as this file is compiled with gcc.
Ok, thanks for letting me know about that. Would you be opposed to me moving the assert outside the switch statement for the sake of older and/or non-gcc compilers? Yes, we can certainly add ASSERT_NOT_REACHED after the switch. That would be beneficial, because even with a compile time check, there can be e.g. memory corruption that results in a value that's not covered by case statements. |