Bug 165975 - Address some style problems found by static analysis
Summary: Address some style problems found by static analysis
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Brent Fulgham
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-16 16:33 PST by Brent Fulgham
Modified: 2016-12-20 15:33 PST (History)
7 users (show)

See Also:


Attachments
Patch (21.62 KB, patch)
2016-12-16 16:40 PST, Brent Fulgham
no flags Details | Formatted Diff | Diff
Patch (35.70 KB, patch)
2016-12-20 09:06 PST, Brent Fulgham
no flags Details | Formatted Diff | Diff
Patch (35.78 KB, patch)
2016-12-20 09:47 PST, Brent Fulgham
no flags Details | Formatted Diff | Diff
Patch (43.99 KB, patch)
2016-12-20 10:17 PST, Brent Fulgham
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brent Fulgham 2016-12-16 16:33:52 PST
The static analyzer identified some miscellaneous problems in the code:

1. Some methods did not actually override the expected method due to signature differences.
2. Some large arguments were being passed by value.

This patch tidies up these issues.
Comment 1 Brent Fulgham 2016-12-16 16:40:37 PST
Created attachment 297374 [details]
Patch
Comment 2 Brent Fulgham 2016-12-16 16:41:24 PST
Note that the instances of "const int*" -> "const int* const", etc., were to match the method declarations in the implementation files.
Comment 3 Alex Christensen 2016-12-19 09:14:24 PST
Comment on attachment 297374 [details]
Patch

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

> Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h:70
> +    void setBreakpointByUrl(ErrorString&, int lineNumber, const String* const optionalURL, const String* const optionalURLRegex, const int* const optionalColumnNumber, const Inspector::InspectorObject* options, Inspector::Protocol::Debugger::BreakpointId*, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Debugger::Location>>& locations) final;

This change caused a warning on Windows.  Let's double check it.

> Source/WebKit2/Shared/WebBackForwardListItem.h:47
> -    static PassRefPtr<WebBackForwardListItem> create(BackForwardListItemState, uint64_t pageID);
> +    static PassRefPtr<WebBackForwardListItem> create(BackForwardListItemState&&, uint64_t pageID);

As long as we're touching this, can we make this return a Ref?
Comment 4 Brent Fulgham 2016-12-19 09:54:23 PST
Comment on attachment 297374 [details]
Patch

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

>> Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h:70
>> +    void setBreakpointByUrl(ErrorString&, int lineNumber, const String* const optionalURL, const String* const optionalURLRegex, const int* const optionalColumnNumber, const Inspector::InspectorObject* options, Inspector::Protocol::Debugger::BreakpointId*, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Debugger::Location>>& locations) final;
> 
> This change caused a warning on Windows.  Let's double check it.

I think this is due to out-of-sync intermediate files. It's clear that JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp is declared as "const String* const" (etc.), so the headers should be made to match.
Comment 5 Brent Fulgham 2016-12-20 09:06:51 PST
Created attachment 297521 [details]
Patch
Comment 6 WebKit Commit Bot 2016-12-20 09:09:27 PST
Attachment 297521 [details] did not pass style-queue:


ERROR: Source/WebCore/inspector/PageDebuggerAgent.h:68:  The parameter name "const" adds no information, so it should be removed.  [readability/parameter_name] [5]
ERROR: Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h:86:  The parameter name "const" adds no information, so it should be removed.  [readability/parameter_name] [5]
Total errors found: 2 in 20 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 7 Brent Fulgham 2016-12-20 09:47:52 PST
Created attachment 297527 [details]
Patch
Comment 8 WebKit Commit Bot 2016-12-20 09:49:34 PST
Attachment 297527 [details] did not pass style-queue:


ERROR: Source/WebCore/inspector/PageDebuggerAgent.h:68:  The parameter name "const" adds no information, so it should be removed.  [readability/parameter_name] [5]
ERROR: Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h:86:  The parameter name "const" adds no information, so it should be removed.  [readability/parameter_name] [5]
Total errors found: 2 in 20 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 9 BJ Burg 2016-12-20 10:06:04 PST
(In reply to comment #4)
> Comment on attachment 297374 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=297374&action=review
> 
> >> Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h:70
> >> +    void setBreakpointByUrl(ErrorString&, int lineNumber, const String* const optionalURL, const String* const optionalURLRegex, const int* const optionalColumnNumber, const Inspector::InspectorObject* options, Inspector::Protocol::Debugger::BreakpointId*, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Debugger::Location>>& locations) final;
> > 
> > This change caused a warning on Windows.  Let's double check it.
> 
> I think this is due to out-of-sync intermediate files. It's clear that
> JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp is declared as
> "const String* const" (etc.), so the headers should be made to match.

Someday these will use std::optional.
Comment 10 BJ Burg 2016-12-20 10:07:20 PST
Comment on attachment 297527 [details]
Patch

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

> Source/JavaScriptCore/inspector/scripts/codegen/cpp_generator.py:142
> +                return 'const %s* const' % cpp_name

You'll need to rebaseline the expected test results:

./Tools/Scripts/run-inspector-generator-tests --reset-results
Comment 11 BJ Burg 2016-12-20 10:09:36 PST
(In reply to comment #6)
> Attachment 297521 [details] did not pass style-queue:
> 
> 
> ERROR: Source/WebCore/inspector/PageDebuggerAgent.h:68:  The parameter name
> "const" adds no information, so it should be removed. 
> [readability/parameter_name] [5]
> ERROR: Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h:86: 
> The parameter name "const" adds no information, so it should be removed. 
> [readability/parameter_name] [5]
> Total errors found: 2 in 20 files
> 
> 
> If any of these errors are false positives, please file a bug against
> check-webkit-style.

LOL, please file a bug about this.
Comment 12 Brent Fulgham 2016-12-20 10:15:16 PST
(In reply to comment #11)
> (In reply to comment #6)
> > Attachment 297521 [details] did not pass style-queue:
> > 
> > 
> > ERROR: Source/WebCore/inspector/PageDebuggerAgent.h:68:  The parameter name
> > "const" adds no information, so it should be removed. 
> > [readability/parameter_name] [5]
> > ERROR: Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h:86: 
> > The parameter name "const" adds no information, so it should be removed. 
> > [readability/parameter_name] [5]
> > Total errors found: 2 in 20 files
> > 
> > 
> > If any of these errors are false positives, please file a bug against
> > check-webkit-style.
> 
> LOL, please file a bug about this.

Already did! Bug 166067.
Comment 13 Brent Fulgham 2016-12-20 10:17:55 PST
Created attachment 297532 [details]
Patch
Comment 14 WebKit Commit Bot 2016-12-20 10:21:03 PST
Attachment 297532 [details] did not pass style-queue:


ERROR: Source/WebCore/inspector/PageDebuggerAgent.h:68:  The parameter name "const" adds no information, so it should be removed.  [readability/parameter_name] [5]
ERROR: Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h:86:  The parameter name "const" adds no information, so it should be removed.  [readability/parameter_name] [5]
Total errors found: 2 in 21 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 15 WebKit Commit Bot 2016-12-20 15:33:41 PST
Comment on attachment 297532 [details]
Patch

Clearing flags on attachment: 297532

Committed r210042: <http://trac.webkit.org/changeset/210042>
Comment 16 WebKit Commit Bot 2016-12-20 15:33:45 PST
All reviewed patches have been landed.  Closing bug.