Bug 65598 - [V8] V8CSSRuleCustom.cpp: not all enum values are listed in switch statement
Summary: [V8] V8CSSRuleCustom.cpp: not all enum values are listed in switch statement
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P3 Minor
Assignee: Roland Steiner
URL:
Keywords:
Depends on:
Blocks: 65506
  Show dependency treegraph
 
Reported: 2011-08-03 00:42 PDT by Roland Steiner
Modified: 2011-08-03 09:15 PDT (History)
2 users (show)

See Also:


Attachments
Patch (1.63 KB, patch)
2011-08-03 00:45 PDT, Roland Steiner
no flags Details | Formatted Diff | Diff
Patch (1.63 KB, patch)
2011-08-03 02:24 PDT, Roland Steiner
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Roland Steiner 2011-08-03 00:42:09 PDT
The (only) switch statement in V8CSSRuleCustom.cpp misses an entry for UNKNOWN_RULE. Although it's fine that UNKNOWN_RULE is handled by the fallback code, this causes a build warning -> error when the type() function used in the switch() expression is changed to return an enum (currently unsigned int). This blocks https://bugs.webkit.org/show_bug.cgi?id=65506.
Comment 1 Roland Steiner 2011-08-03 00:45:47 PDT
Created attachment 102748 [details]
Patch
Comment 2 Dominic Cooney 2011-08-03 02:06:12 PDT
Comment on attachment 102748 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=102748&action=review

> Source/WebCore/ChangeLog:6
> +        Added UNKNOWN_RULE to the switch() statement.

Drop the parens?

> Source/WebCore/ChangeLog:8
> +        Reviewed by NOBODY (OOPS!).

Doesn’t this go before the previous paragraph.

> Source/WebCore/bindings/v8/custom/V8CSSRuleCustom.cpp:49
>      switch (impl->type()) {

If the switch is exhausted, isn’t the code after the switch dead? You should remove it.

> Source/WebCore/bindings/v8/custom/V8CSSRuleCustom.cpp:51
> +        // CSSUnknownRule.idl is explicitly excluded as it doesn't add anything

Shorten this? You don’t need to talk about GYP files or IDL files… just say you’re wrapping at the base type.
Comment 3 Roland Steiner 2011-08-03 02:24:48 PDT
Created attachment 102756 [details]
Patch
Comment 4 Roland Steiner 2011-08-03 02:27:37 PDT
(In reply to comment #2)
> (From update of attachment 102748 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=102748&action=review
> 
> > Source/WebCore/ChangeLog:6
> > +        Added UNKNOWN_RULE to the switch() statement.
> 
> Drop the parens?

Sure.

> > Source/WebCore/ChangeLog:8
> > +        Reviewed by NOBODY (OOPS!).
> 
> Doesn’t this go before the previous paragraph.

Oops, that's right - corrected.

> > Source/WebCore/bindings/v8/custom/V8CSSRuleCustom.cpp:49
> >      switch (impl->type()) {
> 
> If the switch is exhausted, isn’t the code after the switch dead? You should remove it.

type() still returns unsigned int, so the compiler would scream at me. Can only remove with the patch to bug 65506.

> > Source/WebCore/bindings/v8/custom/V8CSSRuleCustom.cpp:51
> > +        // CSSUnknownRule.idl is explicitly excluded as it doesn't add anything
> 
> Shorten this? You don’t need to talk about GYP files or IDL files… just say you’re wrapping at the base type.

Originally I had 

    return toV8(static_cast<CSSUnknownRule*>(impl));

but this doesn't link, even though V8CSSUnknownRule.cpp exists. It took me quite a while to figure out why, so I believe this comment has merit.
Comment 5 WebKit Review Bot 2011-08-03 09:15:35 PDT
Comment on attachment 102756 [details]
Patch

Clearing flags on attachment: 102756

Committed r92285: <http://trac.webkit.org/changeset/92285>
Comment 6 WebKit Review Bot 2011-08-03 09:15:40 PDT
All reviewed patches have been landed.  Closing bug.