Closed
Bug 1185104
Opened 10 years ago
Closed 10 years ago
jsfriendapi.h misuses MOZ_WARN_UNUSED_RESULT
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla42
| Tracking | Status | |
|---|---|---|
| firefox42 | --- | fixed |
People
(Reporter: dholbert, Assigned: dholbert)
References
Details
Attachments
(1 file)
|
1.19 KB,
patch
|
tromey
:
review+
|
Details | Diff | Splinter Review |
Quoting jsfriendapi.h:
> 1309 bool init(JSContext* cx, JSString* s) MOZ_WARN_UNUSED_RESULT;
[...]
> 1312 bool initTwoByte(JSContext* cx, JSString* s) MOZ_WARN_UNUSED_RESULT;
http://mxr.mozilla.org/mozilla-central/source/js/src/jsfriendapi.h?rev=198bf962586d#1309
The MOZ_WARN_UNUSED_RESULT annotation should be at the beginning of the function decl, not at the end, according to its documentation in MFBT:
> 319 * Place this attribute at the very beginning of a function definition. For
> 320 * example, write
> 321 *
> 322 * MOZ_WARN_UNUSED_RESULT int foo();
http://mxr.mozilla.org/mozilla-central/source/mfbt/Attributes.h?rev=6f25cf876490#319
(I don't actually know if this recommendation is purely stylistic, or if it has functional implications -- i.e. not sure if the annotation has zero effect or weird interactions when incorrectly placed at the end of a decl, or if it still works just fine. Regardless, we should follow the documentation & be consistent with other usages.)
| Assignee | ||
Comment 1•10 years ago
|
||
Tagging tromey for review since he added these decls (in bug 1168593).
Assignee: nobody → dholbert
Attachment #8635526 -
Flags: review?(ttromey)
Comment 2•10 years ago
|
||
(In reply to Daniel Holbert [:dholbert] from comment #0)
> (I don't actually know if this recommendation is purely stylistic, or if it
> has functional implications -- i.e. not sure if the annotation has zero
> effect or weird interactions when incorrectly placed at the end of a decl,
> or if it still works just fine. Regardless, we should follow the
> documentation & be consistent with other usages.)
Totally agreed. Sorry I missed this first time around.
IIRC I did make sure the error triggered before I added the fix.
Comment 3•10 years ago
|
||
Comment on attachment 8635526 [details] [diff] [review]
fix v1
Review of attachment 8635526 [details] [diff] [review]:
-----------------------------------------------------------------
Thanks.
Attachment #8635526 -
Flags: review?(ttromey) → review+
| Assignee | ||
Comment 4•10 years ago
|
||
No worries, & thanks for the quick review turnaround! Landed:
https://hg.mozilla.org/integration/mozilla-inbound/rev/0a1f292ba8cc
Comment 5•10 years ago
|
||
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla42
You need to log in
before you can comment on or make changes to this bug.
Description
•