Enabling clang::find_bad_constructs for common_audio.
This CL removes //build/config/clang:find_bad_constructs from the
suppressed_configs list, which means that clang:find_bad_constructs
is now enabled on these translation units.
Bug: webrtc:9251
Change-Id: I1607df2a3ad177e2f3023156eb8cf37857ae06ba
Reviewed-on: https://webrtc-review.googlesource.com/89041
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24002}
diff --git a/common_audio/BUILD.gn b/common_audio/BUILD.gn
index 06c9cd3..57cf699 100644
--- a/common_audio/BUILD.gn
+++ b/common_audio/BUILD.gn
@@ -82,11 +82,6 @@
public_configs = [ ":common_audio_config" ]
- if (!build_with_chromium && is_clang) {
- # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
- suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
- }
-
if (current_cpu == "x86" || current_cpu == "x64") {
deps += [ ":common_audio_sse2" ]
}
@@ -296,10 +291,6 @@
cflags = [ "-msse2" ]
}
- if (!build_with_chromium && is_clang) {
- # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
- suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
- }
deps = [
":fir_filter",
":sinc_resampler",
@@ -335,11 +326,6 @@
]
}
- if (!build_with_chromium && is_clang) {
- # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
- suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
- }
-
deps = [
":common_audio_neon_c",
":fir_filter",
@@ -375,10 +361,6 @@
]
}
- if (!build_with_chromium && is_clang) {
- # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
- suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
- }
deps = [
":common_audio_c",
"../rtc_base:checks",
@@ -427,11 +409,6 @@
sources += [ "resampler/sinc_resampler_unittest.cc" ]
}
- if (!build_with_chromium && is_clang) {
- # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
- suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
- }
-
deps = [
":common_audio",
":common_audio_c",
diff --git a/common_audio/audio_ring_buffer.cc b/common_audio/audio_ring_buffer.cc
index ed4a5dd..b3bdc25 100644
--- a/common_audio/audio_ring_buffer.cc
+++ b/common_audio/audio_ring_buffer.cc
@@ -24,7 +24,7 @@
}
AudioRingBuffer::~AudioRingBuffer() {
- for (auto buf : buffers_)
+ for (auto* buf : buffers_)
WebRtc_FreeBuffer(buf);
}
@@ -58,7 +58,7 @@
}
void AudioRingBuffer::MoveReadPositionForward(size_t frames) {
- for (auto buf : buffers_) {
+ for (auto* buf : buffers_) {
const size_t moved =
static_cast<size_t>(WebRtc_MoveReadPtr(buf, static_cast<int>(frames)));
RTC_CHECK_EQ(moved, frames);
@@ -66,7 +66,7 @@
}
void AudioRingBuffer::MoveReadPositionBackward(size_t frames) {
- for (auto buf : buffers_) {
+ for (auto* buf : buffers_) {
const size_t moved = static_cast<size_t>(
-WebRtc_MoveReadPtr(buf, -static_cast<int>(frames)));
RTC_CHECK_EQ(moved, frames);
diff --git a/common_audio/lapped_transform_unittest.cc b/common_audio/lapped_transform_unittest.cc
index 7f3d19f..687df89 100644
--- a/common_audio/lapped_transform_unittest.cc
+++ b/common_audio/lapped_transform_unittest.cc
@@ -24,11 +24,11 @@
public:
NoopCallback() : block_num_(0) {}
- virtual void ProcessAudioBlock(const complex<float>* const* in_block,
- size_t in_channels,
- size_t frames,
- size_t out_channels,
- complex<float>* const* out_block) {
+ void ProcessAudioBlock(const complex<float>* const* in_block,
+ size_t in_channels,
+ size_t frames,
+ size_t out_channels,
+ complex<float>* const* out_block) override {
RTC_CHECK_EQ(in_channels, out_channels);
for (size_t i = 0; i < out_channels; ++i) {
memcpy(out_block[i], in_block[i], sizeof(**in_block) * frames);
@@ -46,11 +46,11 @@
public:
FftCheckerCallback() : block_num_(0) {}
- virtual void ProcessAudioBlock(const complex<float>* const* in_block,
- size_t in_channels,
- size_t frames,
- size_t out_channels,
- complex<float>* const* out_block) {
+ void ProcessAudioBlock(const complex<float>* const* in_block,
+ size_t in_channels,
+ size_t frames,
+ size_t out_channels,
+ complex<float>* const* out_block) override {
RTC_CHECK_EQ(in_channels, out_channels);
size_t full_length = (frames - 1) * 2;
diff --git a/common_audio/real_fourier_ooura.cc b/common_audio/real_fourier_ooura.cc
index a3dfbd6..db65d26 100644
--- a/common_audio/real_fourier_ooura.cc
+++ b/common_audio/real_fourier_ooura.cc
@@ -51,7 +51,7 @@
{
// This cast is well-defined since C++11. See "Non-static data members" at:
// http://en.cppreference.com/w/cpp/numeric/complex
- auto dest_float = reinterpret_cast<float*>(dest);
+ auto* dest_float = reinterpret_cast<float*>(dest);
std::copy(src, src + length_, dest_float);
WebRtc_rdft(length_, 1, dest_float, work_ip_.get(), work_w_.get());
}
@@ -65,7 +65,7 @@
void RealFourierOoura::Inverse(const complex<float>* src, float* dest) const {
{
- auto dest_complex = reinterpret_cast<complex<float>*>(dest);
+ auto* dest_complex = reinterpret_cast<complex<float>*>(dest);
// The real output array is shorter than the input complex array by one
// complex element.
const size_t dest_complex_length = complex_length_ - 1;
diff --git a/common_audio/resampler/push_sinc_resampler_unittest.cc b/common_audio/resampler/push_sinc_resampler_unittest.cc
index 042b5f3..487a09f 100644
--- a/common_audio/resampler/push_sinc_resampler_unittest.cc
+++ b/common_audio/resampler/push_sinc_resampler_unittest.cc
@@ -58,7 +58,7 @@
class ZeroSource : public SincResamplerCallback {
public:
- void Run(size_t frames, float* destination) {
+ void Run(size_t frames, float* destination) override {
std::memset(destination, 0, sizeof(float) * frames);
}
};
diff --git a/common_audio/resampler/resampler_unittest.cc b/common_audio/resampler/resampler_unittest.cc
index d992d50..fd636e2 100644
--- a/common_audio/resampler/resampler_unittest.cc
+++ b/common_audio/resampler/resampler_unittest.cc
@@ -42,8 +42,8 @@
class ResamplerTest : public testing::Test {
protected:
ResamplerTest();
- virtual void SetUp();
- virtual void TearDown();
+ void SetUp() override;
+ void TearDown() override;
void ResetIfNeededAndPush(int in_rate, int out_rate, int num_channels);
diff --git a/common_audio/resampler/sinusoidal_linear_chirp_source.h b/common_audio/resampler/sinusoidal_linear_chirp_source.h
index e9f3ca3..71dcff5 100644
--- a/common_audio/resampler/sinusoidal_linear_chirp_source.h
+++ b/common_audio/resampler/sinusoidal_linear_chirp_source.h
@@ -31,7 +31,7 @@
double max_frequency,
double delay_samples);
- virtual ~SinusoidalLinearChirpSource() {}
+ ~SinusoidalLinearChirpSource() override {}
void Run(size_t frames, float* destination) override;
diff --git a/common_audio/signal_processing/signal_processing_unittest.cc b/common_audio/signal_processing/signal_processing_unittest.cc
index 4ef0c90..8e65ebd 100644
--- a/common_audio/signal_processing/signal_processing_unittest.cc
+++ b/common_audio/signal_processing/signal_processing_unittest.cc
@@ -28,7 +28,7 @@
class SplTest : public testing::Test {
protected:
SplTest() { WebRtcSpl_Init(); }
- virtual ~SplTest() {}
+ ~SplTest() override {}
};
TEST_F(SplTest, MacroTest) {
diff --git a/common_audio/vad/vad_unittest.h b/common_audio/vad/vad_unittest.h
index ec4e876..5521983 100644
--- a/common_audio/vad/vad_unittest.h
+++ b/common_audio/vad/vad_unittest.h
@@ -39,8 +39,8 @@
class VadTest : public ::testing::Test {
protected:
VadTest();
- virtual void SetUp();
- virtual void TearDown();
+ void SetUp() override;
+ void TearDown() override;
// Returns true if the rate and frame length combination is valid.
bool ValidRatesAndFrameLengths(int rate, size_t frame_length);
diff --git a/common_audio/wav_file.cc b/common_audio/wav_file.cc
index e96b39d..21b64a8 100644
--- a/common_audio/wav_file.cc
+++ b/common_audio/wav_file.cc
@@ -30,7 +30,7 @@
class ReadableWavFile : public ReadableWav {
public:
explicit ReadableWavFile(FILE* file) : file_(file) {}
- virtual size_t Read(void* buf, size_t num_bytes) {
+ size_t Read(void* buf, size_t num_bytes) override {
return fread(buf, 1, num_bytes, file_);
}
diff --git a/common_audio/wav_header_unittest.cc b/common_audio/wav_header_unittest.cc
index 101f3ff..b7169b5 100644
--- a/common_audio/wav_header_unittest.cc
+++ b/common_audio/wav_header_unittest.cc
@@ -32,13 +32,13 @@
buf_exhausted_(false),
check_read_size_(check_read_size) {}
- virtual ~ReadableWavBuffer() {
+ ~ReadableWavBuffer() override {
// Verify the entire buffer has been read.
if (check_read_size_)
EXPECT_EQ(size_, pos_);
}
- virtual size_t Read(void* buf, size_t num_bytes) {
+ size_t Read(void* buf, size_t num_bytes) override {
// Verify we don't try to read outside of a properly sized header.
if (size_ >= kWavHeaderSize)
EXPECT_GE(size_, pos_ + num_bytes);