From 3e3c551ac63c0bacda15004a60f19f3b8505e558 Mon Sep 17 00:00:00 2001 From: Jerome Humbert Date: Mon, 13 Jan 2020 11:58:26 +0000 Subject: [PATCH] Suppress C5041 constexpr warning for MSVC 2019 Disable the C5041 warning which makes the build fail. This is a C++17-only change and WebRTC doesn't support C++17 yet, so the code is technically correct, but fails to build on MSVC 2019 and warning-as-error active. Also fix another warning-as-error build error with MSVC 2019 due to ignoring the result of a [[nodiscard]] function. No-Presubmit: True Bug: webrtc:11275,webrtc:11276 Change-Id: I891a894ee87252f96e84fd8d282576f46907256f Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/165781 Commit-Queue: Mirko Bonadei Reviewed-by: Mirko Bonadei Reviewed-by: Karl Wiberg Cr-Commit-Position: refs/heads/master@{#30244} --- BUILD.gn | 3 +++ modules/audio_coding/BUILD.gn | 4 ++-- modules/audio_coding/acm2/acm_receiver_unittest.cc | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index eaa7ad502e..49227d93bc 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -334,6 +334,9 @@ config("common_config") { # TODO(bugs.webrtc.org/9274): Remove these warnings as soon as MSVC allows # external headers warning suppression (or fix them upstream). cflags += [ "/wd4702" ] # unreachable code + + # MSVC 2019 warning suppressions for C++17 compiling + cflags += [ "/wd5041" ] # out-of-line definition for constexpr static data member is not needed and is deprecated in C++17 } } diff --git a/modules/audio_coding/BUILD.gn b/modules/audio_coding/BUILD.gn index ec00aad4d8..3935105307 100644 --- a/modules/audio_coding/BUILD.gn +++ b/modules/audio_coding/BUILD.gn @@ -1272,12 +1272,12 @@ rtc_library("audio_coding_modules_tests_shared") { if (rtc_include_tests) { audio_coding_deps = [ - "../../common_audio", - "../../system_wrappers", ":audio_encoder_cng", ":g711", ":g722", ":pcm16b", + "../../common_audio", + "../../system_wrappers", ] if (rtc_include_ilbc) { audio_coding_deps += [ ":ilbc" ] diff --git a/modules/audio_coding/acm2/acm_receiver_unittest.cc b/modules/audio_coding/acm2/acm_receiver_unittest.cc index 175d11ffc4..74a0c7a243 100644 --- a/modules/audio_coding/acm2/acm_receiver_unittest.cc +++ b/modules/audio_coding/acm2/acm_receiver_unittest.cc @@ -289,7 +289,8 @@ TEST_F(AcmReceiverTestPostDecodeVadPassiveOldApi, MAYBE_PostdecodingVad) { constexpr int payload_type = 34; const SdpAudioFormat codec = {"L16", 16000, 1}; const AudioCodecInfo info = SetEncoder(payload_type, codec); - encoder_factory_->QueryAudioEncoder(codec).value(); + auto const value = encoder_factory_->QueryAudioEncoder(codec); + ASSERT_TRUE(value.has_value()); receiver_->SetCodecs({{payload_type, codec}}); const int kNumPackets = 5; AudioFrame frame;