Fix three warnings in dom/ code

RESOLVED FIXED in mozilla20

Status

()

defect
RESOLVED FIXED
7 years ago
4 months ago

People

(Reporter: njn, Assigned: njn)

Tracking

(Blocks 1 bug)

unspecified
mozilla20
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

clang 3.2 gives three warnings in dom/:

- dom/base/nsStructuredCloneContainer.cpp:120:18 [-Wsometimes-uninitialized] variable 'hasTransferable' is used uninitialized whenever '&&' condition i

- dom/bindings/BindingUtils.cpp:1280:10 [-Wunused-private-field] private field 'mSlot' is not used

- dom/plugins/ipc/PluginInstanceChild.cpp:261:13 [-Wsometimes-uninitialized] variable 'currentResult' is used uninitialized whenever switch default is
taken
This patch fixes the warnings.

For the third one, note that this code is DEBUG-only;  the patch lacks
sufficient context for this to be clear.  Note also that I'm using MOZ_ASSERT
in the manner recommended by the patch in bug 820686:  

> You should only use MOZ_NOT_REACHED when you care about the compiler
> optimizations it triggers. If you want to crash both debug and release
> builds when a particular line is reached, use MOZ_CRASH instead of
> MOZ_NOT_REACHED. If you want a debug-only crash, use MOZ_ASSERT(false).

I guess MOZ_ASSERT has |noreturn| annotations that NS_NOTREACHED does not, and
this is enough to fix the warning.
Attachment #695905 - Flags: review?(bzbarsky)
Blocks: buildwarning
Comment on attachment 695905 [details] [diff] [review]
Fix three warnings in dom/ code.

Instead of MOZ_ASSERT and losing the string, please use MOZ_NOT_REACHED (which has the same noreturn annotations as MOZ_ASSERT).

r=me with that
Attachment #695905 - Flags: review?(bzbarsky) → review+
> Instead of MOZ_ASSERT and losing the string, please use MOZ_NOT_REACHED
> (which has the same noreturn annotations as MOZ_ASSERT).

But that contradicts the patch I quoted...
> But that contradicts the patch I quoted

Oh, I see.  I'd definitely missed that subtlety....

OK, r=me on the patch as it stands.
https://hg.mozilla.org/integration/mozilla-inbound/rev/77834ecaec46
Summary: Fix three warnings in dom/ code. → Fix three warnings in dom/ code
https://hg.mozilla.org/mozilla-central/rev/77834ecaec46
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla20
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.