Closed
Bug 1237201
Opened 9 years ago
Closed 9 years ago
Use MOZ_WARN_UNUSED_RESULT for fallible Vector methods
Categories
(Core :: MFBT, defect)
Core
MFBT
Tracking
()
RESOLVED
FIXED
mozilla46
Tracking | Status | |
---|---|---|
firefox46 | --- | fixed |
People
(Reporter: jandem, Assigned: jandem)
References
Details
Attachments
(9 files)
(deleted),
patch
|
yury
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
kats
:
review+
jrmuizel
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
n.nethercote
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
billm
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
n.nethercote
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
jesup
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
Yoric
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
Waldo
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
froydnj
:
review+
|
Details | Diff | Splinter Review |
Vector is used mostly in js/src and I fixed most issues there in bug 1231224, but there are still warnings left in other parts of Gecko.
Assignee | ||
Comment 1•9 years ago
|
||
I just used MOZ_ALWAYS_TRUE here because there's a reserve(capacity) call before it.
Attachment #8704601 -
Flags: review?(ydelendik)
Assignee | ||
Comment 2•9 years ago
|
||
I propagated OOM where that was possible. Other places I added a MOZ_CRASH.
Attachment #8704604 -
Flags: review?(bugmail.mozilla)
Comment 3•9 years ago
|
||
Comment on attachment 8704601 [details] [diff] [review]
Part 1 - nsScriptLoader
Looks good. Thanks.
Attachment #8704601 -
Flags: review?(ydelendik) → review+
Assignee | ||
Comment 4•9 years ago
|
||
Attachment #8704610 -
Flags: review?(seth)
Comment 5•9 years ago
|
||
Comment on attachment 8704604 [details] [diff] [review]
Part 2 - gfx/
Review of attachment 8704604 [details] [diff] [review]:
-----------------------------------------------------------------
The APZC changes look ok to me, but I'm not familiar with the other bits of code, so flagging jeff for review.
Attachment #8704604 -
Flags: review?(jmuizelaar)
Attachment #8704604 -
Flags: review?(bugmail.mozilla)
Attachment #8704604 -
Flags: review+
Assignee | ||
Comment 6•9 years ago
|
||
Attachment #8704614 -
Flags: review?(wmccloskey)
Assignee | ||
Comment 7•9 years ago
|
||
There's already a comment "silently ignore OOM errors", so this patch does that.
Attachment #8704627 -
Flags: review?(n.nethercote)
Assignee | ||
Comment 8•9 years ago
|
||
Comment on attachment 8704614 [details] [diff] [review]
Part 4 - ipc/
Review of attachment 8704614 [details] [diff] [review]:
-----------------------------------------------------------------
::: ipc/glue/MessageChannel.cpp
@@ +778,5 @@
>
> for (MessageQueue::iterator it = mPending.begin(); it != mPending.end(); ) {
> Message &msg = *it;
> if (!ShouldDeferMessage(msg)) {
> + if (!toProcess.append(OCMove(msg)))
Ugh, no idea where the "OC" came from. Please ignore that part.
Assignee | ||
Comment 9•9 years ago
|
||
Attachment #8704629 -
Flags: review?(rjesup)
Updated•9 years ago
|
Attachment #8704629 -
Flags: review?(rjesup) → review+
Assignee | ||
Comment 10•9 years ago
|
||
As discussed on IRC, I made most of them MOZ_CRASH and I'll file a follow-up bug to try to handle (some of) them more gracefully.
In some cases handling the OOM was straight-forward. We have to be careful not to leak anything on OOM so if there was any doubt that could happen I went with MOZ_CRASH.
Attachment #8704645 -
Flags: review?(dteller)
Comment on attachment 8704645 [details] [diff] [review]
Part 7 - nsPerformanceStats, telemetry
Review of attachment 8704645 [details] [diff] [review]:
-----------------------------------------------------------------
::: toolkit/components/telemetry/Telemetry.cpp
@@ +3671,5 @@
>
> MutexAutoLock autoLock(sTelemetry->mThreadHangStatsMutex);
>
> + // Ignore OOM.
> + mozilla::Unused << sTelemetry->mThreadHangStats.append(Move(aStats));
I'm quite happy to r+ this line, but just to be clear, it's not my code.
::: toolkit/components/telemetry/ThreadHangStats.h
@@ +187,5 @@
> void Add(PRIntervalTime aTime, HangMonitor::HangAnnotationsPtr aAnnotations) {
> TimeHistogram::Add(aTime);
> if (aAnnotations) {
> + if (!mAnnotations.append(Move(aAnnotations))) {
> + MOZ_CRASH();
This looks like it should fail silently. I'm willing to r+, but could you file a followup bug for each of ThreadHangStats and BackgroundHangMonitor?
Attachment #8704645 -
Flags: review?(dteller) → review+
Assignee | ||
Comment 12•9 years ago
|
||
Adds MOZ_WARN_UNUSED_RESULT to all fallible methods in Vector.h
Attachment #8704670 -
Flags: review?(jwalden+bmo)
Attachment #8704614 -
Flags: review?(wmccloskey) → review+
Comment 13•9 years ago
|
||
Comment on attachment 8704604 [details] [diff] [review]
Part 2 - gfx/
Review of attachment 8704604 [details] [diff] [review]:
-----------------------------------------------------------------
It's not clear to me why any of this code is using mozilla::Vector instead of std::vector. I expect some of them should just be using std::vector instead.
Updated•9 years ago
|
Updated•9 years ago
|
Attachment #8704627 -
Flags: review?(n.nethercote) → review+
Assignee | ||
Comment 14•9 years ago
|
||
(In reply to Jeff Muizelaar [:jrmuizel] from comment #13)
> It's not clear to me why any of this code is using mozilla::Vector instead
> of std::vector. I expect some of them should just be using std::vector
> instead.
I can file a follow-up bug for this? I was hoping I could land this soon to avoid new failures, and the patch is simple and a clear improvement...
Comment 15•9 years ago
|
||
Comment on attachment 8704670 [details] [diff] [review]
Part 8 - Use MOZ_WARN_UNUSED_RESULT
Review of attachment 8704670 [details] [diff] [review]:
-----------------------------------------------------------------
http://suzlyfe.com/wp-content/uploads/2015/04/brilliant-guinness-meme.jpg
Attachment #8704670 -
Flags: review?(jwalden+bmo) → review+
Assignee | ||
Comment 16•9 years ago
|
||
Comment on attachment 8704610 [details] [diff] [review]
Part 3 - StreamingLexer
According to firebot and bugzilla, Seth has been inactive for a while so forwarding the request to njn.
Attachment #8704610 -
Flags: review?(seth) → review?(n.nethercote)
Updated•9 years ago
|
Attachment #8704604 -
Flags: review?(jmuizelaar) → review+
Updated•9 years ago
|
Attachment #8704610 -
Flags: review?(n.nethercote) → review+
Comment 17•9 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/9a062cdf1c8a
https://hg.mozilla.org/integration/mozilla-inbound/rev/96f5d3e2f0d3
https://hg.mozilla.org/integration/mozilla-inbound/rev/2ebafa1c0eee
https://hg.mozilla.org/integration/mozilla-inbound/rev/13e154623939
https://hg.mozilla.org/integration/mozilla-inbound/rev/b072874b9253
https://hg.mozilla.org/integration/mozilla-inbound/rev/9746d5b3df80
https://hg.mozilla.org/integration/mozilla-inbound/rev/cdd2accc2d1a
Assignee | ||
Comment 19•9 years ago
|
||
I fixed all warnings I got locally with a Clang browser build, but Try uncovered some more issues:
* A (void) cast is enough to silence Clang but not GCC. I changed these to mozilla::Unused.
* There were some append() calls in SpiderMonkey's Profilers.cpp. We don't build this code by default so I didn't notice this before.
* I had to fix some append calls in Android/B2G code.
Attachment #8708036 -
Flags: review?(nfroyd)
Updated•9 years ago
|
Attachment #8708036 -
Flags: review?(nfroyd) → review+
Comment 20•9 years ago
|
||
Comment 21•9 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/9a062cdf1c8a
https://hg.mozilla.org/mozilla-central/rev/96f5d3e2f0d3
https://hg.mozilla.org/mozilla-central/rev/2ebafa1c0eee
https://hg.mozilla.org/mozilla-central/rev/13e154623939
https://hg.mozilla.org/mozilla-central/rev/b072874b9253
https://hg.mozilla.org/mozilla-central/rev/9746d5b3df80
https://hg.mozilla.org/mozilla-central/rev/cdd2accc2d1a
https://hg.mozilla.org/mozilla-central/rev/e1fba9e69aa9
https://hg.mozilla.org/mozilla-central/rev/6593b2842fa1
Assignee | ||
Updated•9 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
status-firefox46:
--- → fixed
Keywords: leave-open
Resolution: --- → FIXED
Target Milestone: --- → mozilla46
You need to log in
before you can comment on or make changes to this bug.
Description
•