Bug 190907

Summary: Fix clang static analyzer warning in StyleBuilderConverter.h
Product: WebKit Reporter: David Kilzer (:ddkilzer) <ddkilzer>
Component: CSSAssignee: David Kilzer (:ddkilzer) <ddkilzer>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, don.olmstead, joepeck, koivisto, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch v1 none

David Kilzer (:ddkilzer)
Reported 2018-10-25 10:54:05 PDT
Fix the following clang static warning in StyleBuilderConverter.h: Value stored to 'autoFlow' during its initialization is never read
Attachments
Patch v1 (2.39 KB, patch)
2018-10-25 11:03 PDT, David Kilzer (:ddkilzer)
no flags
David Kilzer (:ddkilzer)
Comment 1 2018-10-25 11:03:07 PDT
Created attachment 353094 [details] Patch v1
David Kilzer (:ddkilzer)
Comment 2 2018-10-25 11:15:52 PDT
This fixes 7 clang static analyzer warnings in WebCore where this code is inlined.
David Kilzer (:ddkilzer)
Comment 3 2018-10-25 12:03:40 PDT
Comment on attachment 353094 [details] Patch v1 View in context: https://bugs.webkit.org/attachment.cgi?id=353094&action=review > Source/WebCore/css/StyleBuilderConverter.h:1069 > case CSSValueDense: > if (second && second->valueID() == CSSValueColumn) > - return AutoFlowColumnDense; > - return AutoFlowRowDense; > + autoFlow = AutoFlowColumnDense; > + else > + autoFlow = AutoFlowRowDense; > + break; BTW, if the preference is to change this `switch` statement to use early returns everywhere, I'm happy to do that instead.
Don Olmstead
Comment 4 2018-10-25 16:06:49 PDT
(In reply to David Kilzer (:ddkilzer) from comment #3) > Comment on attachment 353094 [details] > Patch v1 > > View in context: > https://bugs.webkit.org/attachment.cgi?id=353094&action=review > > > Source/WebCore/css/StyleBuilderConverter.h:1069 > > case CSSValueDense: > > if (second && second->valueID() == CSSValueColumn) > > - return AutoFlowColumnDense; > > - return AutoFlowRowDense; > > + autoFlow = AutoFlowColumnDense; > > + else > > + autoFlow = AutoFlowRowDense; > > + break; > > BTW, if the preference is to change this `switch` statement to use early > returns everywhere, I'm happy to do that instead. Patch looks good to me since its keeping with the style in the rest of the method. If you're going to do the early return maybe change them to use a ternary?
Antti Koivisto
Comment 5 2018-10-29 10:28:39 PDT
Looks fine, stylistic improvements can be done separately.
WebKit Commit Bot
Comment 6 2018-10-29 10:53:53 PDT
Comment on attachment 353094 [details] Patch v1 Clearing flags on attachment: 353094 Committed r237557: <https://trac.webkit.org/changeset/237557>
WebKit Commit Bot
Comment 7 2018-10-29 10:53:55 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 8 2018-10-29 13:32:14 PDT
Note You need to log in before you can comment on or make changes to this bug.