Bug 188983 - [GTK][JSC] Add warn_unused_result attribute to some APIs
Summary: [GTK][JSC] Add warn_unused_result attribute to some APIs
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-08-27 07:38 PDT by Patrick Griffis
Modified: 2018-09-03 00:18 PDT (History)
10 users (show)

See Also:


Attachments
Patch (2.68 KB, patch)
2018-08-27 07:38 PDT, Patrick Griffis
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Griffis 2018-08-27 07:38:28 PDT
[GTK][JSC] Add warn_unused_result attribute to some APIs
Comment 1 Patrick Griffis 2018-08-27 07:38:56 PDT
Created attachment 348143 [details]
Patch
Comment 2 Michael Catanzaro 2018-08-27 09:12:50 PDT
Normally I would leave this to Carlos Garcia, but he is quite busy this week and it's clearly a good improvement.
Comment 3 Michael Catanzaro 2018-08-27 09:13:21 PDT
P.S. I assume this doesn't add build warnings in WebKit's own build!
Comment 4 Michael Catanzaro 2018-08-27 09:15:46 PDT
Rationale: programmers intuitively expect that it is safe to ignore the return value of a function call if the result is unneeded or void. But, as Patrick discovered, this leads to memory leaks if you think you can get away with that when using jsc_value_object_invoke_method() or jsc_value_function_call().
Comment 5 WebKit Commit Bot 2018-08-27 09:39:19 PDT
Comment on attachment 348143 [details]
Patch

Clearing flags on attachment: 348143

Committed r235373: <https://trac.webkit.org/changeset/235373>
Comment 6 WebKit Commit Bot 2018-08-27 09:39:20 PDT
All reviewed patches have been landed.  Closing bug.
Comment 7 Radar WebKit Bug Importer 2018-08-27 09:40:22 PDT
<rdar://problem/43756976>
Comment 8 Carlos Garcia Campos 2018-09-03 00:18:07 PDT
Thanks! There are more cases like evaluate functions.