Closed Bug 824883 Opened 11 years ago Closed 11 years ago

Fix three warnings in dom/ code

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla20

People

(Reporter: n.nethercote, Assigned: n.nethercote)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

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: 11 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.