Bug 174469

Summary: -Wimplicit-fallthrough warning in ComputedStyleExtractor::propertyValue
Product: WebKit Reporter: Michael Catanzaro <mcatanzaro>
Component: CSSAssignee: Michael Catanzaro <mcatanzaro>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, cdumez, commit-queue, koivisto, mcatanzaro, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: InRadar
Version: Other   
Hardware: PC   
OS: All   
Bug Depends on:    
Bug Blocks: 174463    
Attachments:
Description Flags
Patch none

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.