Bug 174469 - -Wimplicit-fallthrough warning in ComputedStyleExtractor::propertyValue
Summary: -Wimplicit-fallthrough warning in ComputedStyleExtractor::propertyValue
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: Other
Hardware: PC All
: P2 Normal
Assignee: Michael Catanzaro
URL:
Keywords: InRadar
Depends on:
Blocks: 174463
  Show dependency treegraph
 
Reported: 2017-07-13 11:22 PDT by Michael Catanzaro
Modified: 2017-08-07 15:01 PDT (History)
8 users (show)

See Also:


Attachments
Patch (1.60 KB, patch)
2017-08-07 12:28 PDT, Michael Catanzaro
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Catanzaro 2017-07-13 11:22:21 PDT
This new warning from GCC 7 has found a problem in ComputedStyleExtractor::propertyValue:

[2701/5861] Building CXX object Source.../css/CSSComputedStyleDeclaration.cpp.o
../../Source/WebCore/css/CSSComputedStyleDeclaration.cpp: In member function ‘WTF::RefPtr<WebCore::CSSValue> WebCore::ComputedStyleExtractor::propertyValue(WebCore::CSSPropertyID, WebCore::EUpdateLayout)’:
../../Source/WebCore/css/CSSComputedStyleDeclaration.cpp:3344:13: warning: this statement may fall through [-Wimplicit-fallthrough=]
             }
             ^
../../Source/WebCore/css/CSSComputedStyleDeclaration.cpp:3345:9: note: here
         case CSSPropertyTextIndent: {
         ^~~~

Looking at the code, the fallthrough there appears to almost surely be undesired. But I have no clue how to fix it.
Comment 1 Radar WebKit Bug Importer 2017-07-14 01:19:19 PDT
<rdar://problem/33311638>
Comment 2 Michael Catanzaro 2017-08-07 10:15:45 PDT
Anyone know how to fix this one?
Comment 3 Simon Fraser (smfr) 2017-08-07 10:44:59 PDT
I don't think this is harmful. The switch in the previous block returns under every condition.
Comment 4 Michael Catanzaro 2017-08-07 12:25:52 PDT
Um, so it does. I'm surprised I missed that. Let's just silence the warning, then.
Comment 5 Michael Catanzaro 2017-08-07 12:28:14 PDT
Created attachment 317452 [details]
Patch
Comment 6 Simon Fraser (smfr) 2017-08-07 13:20:32 PDT
Comment on attachment 317452 [details]
Patch

Or maybe just return nullptr?
Comment 7 Michael Catanzaro 2017-08-07 14:26:21 PDT
(In reply to Simon Fraser (smfr) from comment #6)
> Comment on attachment 317452 [details]
> Patch
> 
> Or maybe just return nullptr?

I assume that if we don't want that code to ever be hit, an assert is most appropriate?
Comment 8 Simon Fraser (smfr) 2017-08-07 14:31:56 PDT
Comment on attachment 317452 [details]
Patch

Sure, i guess.
Comment 9 WebKit Commit Bot 2017-08-07 15:01:29 PDT
Comment on attachment 317452 [details]
Patch

Clearing flags on attachment: 317452

Committed r220354: <http://trac.webkit.org/changeset/220354>
Comment 10 WebKit Commit Bot 2017-08-07 15:01:31 PDT
All reviewed patches have been landed.  Closing bug.