From 7e415de1e84078d0601cae617dce6b365b7faf72 Mon Sep 17 00:00:00 2001 From: Emily McDonough Date: Wed, 3 May 2023 20:25:16 +0000 Subject: [PATCH] Bug 1829437 - Fix GCC -Wuninitialized warnings in MediaTrackGraph r=azebrowski Differential Revision: https://phabricator.services.mozilla.com/D176196 --- dom/media/MediaTrackGraph.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dom/media/MediaTrackGraph.cpp b/dom/media/MediaTrackGraph.cpp index 328f336e9ea2..7aab1aec7df4 100644 --- a/dom/media/MediaTrackGraph.cpp +++ b/dom/media/MediaTrackGraph.cpp @@ -3741,7 +3741,10 @@ class AudioContextOperationControlMessage : public ControlMessage { void MediaTrackGraphImpl::ApplyAudioContextOperationImpl( AudioContextOperationControlMessage* aMessage) { MOZ_ASSERT(OnGraphThread()); - AudioContextState state; + // Initialize state to zero. This silences a GCC warning about uninitialized + // values, because although the switch below initializes state for all valid + // enum values, the actual value could be any integer that fits in the enum. + AudioContextState state{0}; switch (aMessage->mAudioContextOperation) { // Suspend and Close operations may be performed immediately because no // specific kind of GraphDriver is required. CheckDriver() will schedule -- 2.11.4.GIT