WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
210336
check-webkit-style should warn about 'decode' functions with missing WARN_UNUSED_RETURN attribute
https://bugs.webkit.org/show_bug.cgi?id=210336
Summary
check-webkit-style should warn about 'decode' functions with missing WARN_UNU...
David Kilzer (:ddkilzer)
Reported
2020-04-10 08:45:54 PDT
check-webkit-style should warn about 'decode' functions that are missing the WARN_UNUSED_RETURN attribute. This will help to find bugs when using CoreIPC decode() methods.
Attachments
Patch v1
(9.73 KB, patch)
2020-04-10 08:54 PDT
,
David Kilzer (:ddkilzer)
no flags
Details
Formatted Diff
Diff
Patch for landing
(9.51 KB, patch)
2020-04-11 03:51 PDT
,
David Kilzer (:ddkilzer)
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2020-04-10 08:52:38 PDT
<
rdar://problem/61585835
>
David Kilzer (:ddkilzer)
Comment 2
2020-04-10 08:54:52 PDT
Created
attachment 396088
[details]
Patch v1
Darin Adler
Comment 3
2020-04-10 09:00:47 PDT
Comment on
attachment 396088
[details]
Patch v1 For functions returning bool I think this is a good rule. For ones returning Optional I think this is not helpful, but I suppose no big deal to comply anyway.
Jonathan Bedard
Comment 4
2020-04-10 09:07:21 PDT
Comment on
attachment 396088
[details]
Patch v1 View in context:
https://bugs.webkit.org/attachment.cgi?id=396088&action=review
> Tools/Scripts/webkitpy/style/checkers/cpp.py:1818 > + if function_state.has_return_type('(auto|bool|Optional<.+>)'):
I would actually expect this to be an inverse check. If a function does not have a void return type, then we should trigger this logic. Any reason we picked this set of types?
Jonathan Bedard
Comment 5
2020-04-10 09:08:03 PDT
Comment on
attachment 396088
[details]
Patch v1 Darin r+ed it, I accidentally removed the r+ when adding a comment
Darin Adler
Comment 6
2020-04-10 09:18:36 PDT
If we are going to consider return types, the real issue is about bool return types. I don’t see a real unused return value issue outside of the bool return type case.
Alex Christensen
Comment 7
2020-04-10 11:44:41 PDT
Comment on
attachment 396088
[details]
Patch v1 View in context:
https://bugs.webkit.org/attachment.cgi?id=396088&action=review
> Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py:3039 > + ' static WARN_UNUSED_RETURN Optional<std::tuple<>> decode(Decoder&)\n'
This shouldn't be added.
David Kilzer (:ddkilzer)
Comment 8
2020-04-10 17:42:30 PDT
Comment on
attachment 396088
[details]
Patch v1 View in context:
https://bugs.webkit.org/attachment.cgi?id=396088&action=review
>> Tools/Scripts/webkitpy/style/checkers/cpp.py:1818 >> + if function_state.has_return_type('(auto|bool|Optional<.+>)'): > > I would actually expect this to be an inverse check. If a function does not have a void return type, then we should trigger this logic. Any reason we picked this set of types?
This set of types are specific to the decode() methods we care about. I'm going to remove Optional<.+> from the list per feedback from Alex and Darin.
>> Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py:3039 >> + ' static WARN_UNUSED_RETURN Optional<std::tuple<>> decode(Decoder&)\n' > > This shouldn't be added.
I will remove "Optional<.+>" from the list of types based on feedback from you and Darin, and remove this test (since it's a dupe of the one above) before landing.
David Kilzer (:ddkilzer)
Comment 9
2020-04-11 03:51:28 PDT
Created
attachment 396158
[details]
Patch for landing
EWS
Comment 10
2020-04-11 04:28:44 PDT
Committed
r259925
: <
https://trac.webkit.org/changeset/259925
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 396158
[details]
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug