Closed Bug 1383020 Opened 2 years ago Closed 2 years ago

mediaconduit_unittests.cpp: suggest explicit braces to avoid ambiguous 'else' [-Werror=dangling-else]

Categories

(Core :: WebRTC: Signaling, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla56
Tracking Status
firefox56 --- fixed

People

(Reporter: Sylvestre, Assigned: Sylvestre)

References

Details

Attachments

(1 file)

Fails the build with gcc 7.1 & --enable-warnings-as-errors
35:47.40 /root/firefox-gcc-last/media/webrtc/signaling/gtest/mediaconduit_unittests.cpp: In member function 'void test::TransportConduitTest::TestDummyAudioAndTransport()':
35:47.40 /root/firefox-gcc-last/media/webrtc/signaling/gtest/mediaconduit_unittests.cpp:380:7: error: suggest explicit braces to avoid ambiguous 'else' [-Werror=dangling-else]
35:47.40      if( !mAudioSession )
35:47.40        ^
35:47.40 /root/firefox-gcc-last/media/webrtc/signaling/gtest/mediaconduit_unittests.cpp:384:7: error: suggest explicit braces to avoid ambiguous 'else' [-Werror=dangling-else]
35:47.40      if( !mAudioSession2 )
35:47.40        ^
35:47.42 /root/firefox-gcc-last/media/webrtc/signaling/gtest/mediaconduit_unittests.cpp: In member function 'void test::TransportConduitTest::TestVideoConduitCodecAPI()':
35:47.42 /root/firefox-gcc-last/media/webrtc/signaling/gtest/mediaconduit_unittests.cpp:439:7: error: suggest explicit braces to avoid ambiguous 'else' [-Werror=dangling-else]
35:47.42      if( !videoSession )
35:47.42        ^
35:47.44 /root/firefox-gcc-last/media/webrtc/signaling/gtest/mediaconduit_unittests.cpp: In member function 'void test::TransportConduitTest::GetVideoResolutionWithMaxFs(short unsigned int, short unsigned int, int, short unsigned int&, short unsigned int&)':
35:47.44 /root/firefox-gcc-last/media/webrtc/signaling/gtest/mediaconduit_unittests.cpp:560:7: error: suggest explicit braces to avoid ambiguous 'else' [-Werror=dangling-else]
35:47.44      if( !mVideoSession )
35:47.44        ^
35:49.95 cc1plus: all warnings being treated as errors

This is because ASSERT_NE is a macro and can be multiline. This could lead to the first line to be skipped and the second to be executed.
Assignee: nobody → sledru
Component: Security: Process Sandboxing → WebRTC: Signaling
Comment on attachment 8888744 [details]
Bug 1383020 - Add braces to avoid some -Wdangling-else warnings

https://reviewboard.mozilla.org/r/159780/#review165124
Attachment #8888744 - Flags: review?(rjesup) → review+
Pushed by sledru@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/95efad45c16f
Add braces to avoid some -Wdangling-else warnings r=jesup
https://hg.mozilla.org/mozilla-central/rev/95efad45c16f
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
You need to log in before you can comment on or make changes to this bug.