Closed
Bug 1461540
Opened 7 years ago
Closed 7 years ago
warning: ‘errorMessage’ may be used uninitialized, for MediaBufferDecoder.cpp:563:15
Categories
(Core :: Web Audio, defect, P3)
Core
Web Audio
Tracking
()
RESOLVED
FIXED
mozilla62
Tracking | Status | |
---|---|---|
firefox62 | --- | fixed |
People
(Reporter: cpearce, Assigned: cpearce)
Details
Attachments
(1 file)
I see this warning building on Ubuntu with gcc (Ubuntu 7.2.0-8ubuntu3.2) 7.2.0:
0:27.66 In file included from /home/cpearce/src/firefox/obj-x86_64-pc-linux-gnu/dist/include/nsString.h:23:0,
0:27.66 from /home/cpearce/src/firefox/obj-x86_64-pc-linux-gnu/dist/include/nsAtom.h:11,
0:27.66 from /home/cpearce/src/firefox/obj-x86_64-pc-linux-gnu/dist/include/nsGkAtoms.h:10,
0:27.66 from /home/cpearce/src/firefox/obj-x86_64-pc-linux-gnu/dist/include/mozilla/DOMEventTargetHelper.h:11,
0:27.66 from /home/cpearce/src/firefox/obj-x86_64-pc-linux-gnu/dist/include/mozilla/dom/AudioNode.h:10,
0:27.66 from /home/cpearce/src/firefox/obj-x86_64-pc-linux-gnu/dist/include/mozilla/dom/ChannelMergerNode.h:10,
0:27.66 from /home/cpearce/src/firefox/dom/media/webaudio/ChannelMergerNode.cpp:7,
0:27.66 from /home/cpearce/src/firefox/obj-x86_64-pc-linux-gnu/dom/media/webaudio/Unified_cpp_dom_media_webaudio1.cpp:2:
0:27.66 /home/cpearce/src/firefox/obj-x86_64-pc-linux-gnu/dist/include/nsTString.h: In member function ‘void mozilla::WebAudioDecodeJob::OnFailure(mozilla::WebAudioDecodeJob::ErrorCode)’:
0:27.66 /home/cpearce/src/firefox/obj-x86_64-pc-linux-gnu/dist/include/nsTString.h:605:5: warning: ‘errorMessage’ may be used uninitialized in this function [-Wmaybe-uninitialized]
0:27.66 this->Assign(aData, aLength);
0:27.66 ^~~~
0:27.66 In file included from /home/cpearce/src/firefox/obj-x86_64-pc-linux-gnu/dom/media/webaudio/Unified_cpp_dom_media_webaudio1.cpp:92:0:
0:27.66 /home/cpearce/src/firefox/dom/media/webaudio/MediaBufferDecoder.cpp:563:15: note: ‘errorMessage’ was declared here
0:27.66 const char* errorMessage;
0:27.66 ^~~~~~~~~~~~
Comment hidden (mozreview-request) |
Updated•7 years ago
|
Assignee: nobody → cpearce
Status: NEW → ASSIGNED
Rank: 25
Priority: -- → P3
Comment 2•7 years ago
|
||
mozreview-review |
Comment on attachment 8975699 [details]
Bug 1461540 - Ensure errorMessage is initialized on all code paths in WebAudioDecodeJob::OnFailure().
https://reviewboard.mozilla.org/r/243918/#review250870
Attachment #8975699 -
Flags: review+
Pushed by cpearce@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/ff5eea52d8da
Ensure errorMessage is initialized on all code paths in WebAudioDecodeJob::OnFailure(). r=jya
Comment 4•7 years ago
|
||
mozreview-review |
Comment on attachment 8975699 [details]
Bug 1461540 - Ensure errorMessage is initialized on all code paths in WebAudioDecodeJob::OnFailure().
https://reviewboard.mozilla.org/r/243918/#review250884
Prior to this change we would have a warning that would cause a CI error if
any ErrorCode enumeration value were not listed in this switch statement
e.g.
dom/media/webaudio/MediaBufferDecoder.cpp:564:11: warning: enumeration value 'NoAudio' not handled in switch [-Wswitch]
Adding a default to the switch statement defeats the -Wswitch warning, and so
adding a new enumerator to ErrorCode would no longer require adding a
coresponding case to this switch statement.
The -Wswitch warning seems useful to me, useful enough that I wouldn't disable
it for the sake of a notorious non-error warning that the compiler spits out
randomly.
Chris has checked that making the ErrorCode a scoped enumeration does not
suppress the warning.
For addressing the noise of the -Wmaybe-uninitialized, IMO the best solution
is to disable that warning globally, but that may be contentious.
This would also be an acceptable solution IMO:
const char* errorMessage = "MediaDecodeAudioDataUnknownError";
with the corresponding assignment in case UnknownError also removed.
Attachment #8975699 -
Flags: review?(karlt) → review-
Comment 5•7 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
status-firefox62:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla62
You need to log in
before you can comment on or make changes to this bug.
Description
•