Bug 188983

Summary: [GTK][JSC] Add warn_unused_result attribute to some APIs
Product: WebKit Reporter: Patrick Griffis <pgriffis>
Component: New BugsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: bugs-noreply, cgarcia, commit-queue, ews-watchlist, keith_miller, mark.lam, mcatanzaro, msaboff, saam, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

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.