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}
This commit is contained in:
committed by
Commit Bot
parent
f5c3ba15f0
commit
91df091ba6
@ -82,11 +82,6 @@ rtc_static_library("common_audio") {
|
|||||||
|
|
||||||
public_configs = [ ":common_audio_config" ]
|
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") {
|
if (current_cpu == "x86" || current_cpu == "x64") {
|
||||||
deps += [ ":common_audio_sse2" ]
|
deps += [ ":common_audio_sse2" ]
|
||||||
}
|
}
|
||||||
@ -296,10 +291,6 @@ if (current_cpu == "x86" || current_cpu == "x64") {
|
|||||||
cflags = [ "-msse2" ]
|
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 = [
|
deps = [
|
||||||
":fir_filter",
|
":fir_filter",
|
||||||
":sinc_resampler",
|
":sinc_resampler",
|
||||||
@ -335,11 +326,6 @@ if (rtc_build_with_neon) {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
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 = [
|
deps = [
|
||||||
":common_audio_neon_c",
|
":common_audio_neon_c",
|
||||||
":fir_filter",
|
":fir_filter",
|
||||||
@ -375,10 +361,6 @@ if (rtc_build_with_neon) {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
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 = [
|
deps = [
|
||||||
":common_audio_c",
|
":common_audio_c",
|
||||||
"../rtc_base:checks",
|
"../rtc_base:checks",
|
||||||
@ -427,11 +409,6 @@ if (rtc_include_tests) {
|
|||||||
sources += [ "resampler/sinc_resampler_unittest.cc" ]
|
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 = [
|
deps = [
|
||||||
":common_audio",
|
":common_audio",
|
||||||
":common_audio_c",
|
":common_audio_c",
|
||||||
|
|||||||
@ -24,7 +24,7 @@ AudioRingBuffer::AudioRingBuffer(size_t channels, size_t max_frames) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
AudioRingBuffer::~AudioRingBuffer() {
|
AudioRingBuffer::~AudioRingBuffer() {
|
||||||
for (auto buf : buffers_)
|
for (auto* buf : buffers_)
|
||||||
WebRtc_FreeBuffer(buf);
|
WebRtc_FreeBuffer(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ size_t AudioRingBuffer::WriteFramesAvailable() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AudioRingBuffer::MoveReadPositionForward(size_t frames) {
|
void AudioRingBuffer::MoveReadPositionForward(size_t frames) {
|
||||||
for (auto buf : buffers_) {
|
for (auto* buf : buffers_) {
|
||||||
const size_t moved =
|
const size_t moved =
|
||||||
static_cast<size_t>(WebRtc_MoveReadPtr(buf, static_cast<int>(frames)));
|
static_cast<size_t>(WebRtc_MoveReadPtr(buf, static_cast<int>(frames)));
|
||||||
RTC_CHECK_EQ(moved, frames);
|
RTC_CHECK_EQ(moved, frames);
|
||||||
@ -66,7 +66,7 @@ void AudioRingBuffer::MoveReadPositionForward(size_t frames) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AudioRingBuffer::MoveReadPositionBackward(size_t frames) {
|
void AudioRingBuffer::MoveReadPositionBackward(size_t frames) {
|
||||||
for (auto buf : buffers_) {
|
for (auto* buf : buffers_) {
|
||||||
const size_t moved = static_cast<size_t>(
|
const size_t moved = static_cast<size_t>(
|
||||||
-WebRtc_MoveReadPtr(buf, -static_cast<int>(frames)));
|
-WebRtc_MoveReadPtr(buf, -static_cast<int>(frames)));
|
||||||
RTC_CHECK_EQ(moved, frames);
|
RTC_CHECK_EQ(moved, frames);
|
||||||
|
|||||||
@ -24,11 +24,11 @@ class NoopCallback : public webrtc::LappedTransform::Callback {
|
|||||||
public:
|
public:
|
||||||
NoopCallback() : block_num_(0) {}
|
NoopCallback() : block_num_(0) {}
|
||||||
|
|
||||||
virtual void ProcessAudioBlock(const complex<float>* const* in_block,
|
void ProcessAudioBlock(const complex<float>* const* in_block,
|
||||||
size_t in_channels,
|
size_t in_channels,
|
||||||
size_t frames,
|
size_t frames,
|
||||||
size_t out_channels,
|
size_t out_channels,
|
||||||
complex<float>* const* out_block) {
|
complex<float>* const* out_block) override {
|
||||||
RTC_CHECK_EQ(in_channels, out_channels);
|
RTC_CHECK_EQ(in_channels, out_channels);
|
||||||
for (size_t i = 0; i < out_channels; ++i) {
|
for (size_t i = 0; i < out_channels; ++i) {
|
||||||
memcpy(out_block[i], in_block[i], sizeof(**in_block) * frames);
|
memcpy(out_block[i], in_block[i], sizeof(**in_block) * frames);
|
||||||
@ -46,11 +46,11 @@ class FftCheckerCallback : public webrtc::LappedTransform::Callback {
|
|||||||
public:
|
public:
|
||||||
FftCheckerCallback() : block_num_(0) {}
|
FftCheckerCallback() : block_num_(0) {}
|
||||||
|
|
||||||
virtual void ProcessAudioBlock(const complex<float>* const* in_block,
|
void ProcessAudioBlock(const complex<float>* const* in_block,
|
||||||
size_t in_channels,
|
size_t in_channels,
|
||||||
size_t frames,
|
size_t frames,
|
||||||
size_t out_channels,
|
size_t out_channels,
|
||||||
complex<float>* const* out_block) {
|
complex<float>* const* out_block) override {
|
||||||
RTC_CHECK_EQ(in_channels, out_channels);
|
RTC_CHECK_EQ(in_channels, out_channels);
|
||||||
|
|
||||||
size_t full_length = (frames - 1) * 2;
|
size_t full_length = (frames - 1) * 2;
|
||||||
|
|||||||
@ -51,7 +51,7 @@ void RealFourierOoura::Forward(const float* src, complex<float>* dest) const {
|
|||||||
{
|
{
|
||||||
// This cast is well-defined since C++11. See "Non-static data members" at:
|
// This cast is well-defined since C++11. See "Non-static data members" at:
|
||||||
// http://en.cppreference.com/w/cpp/numeric/complex
|
// 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);
|
std::copy(src, src + length_, dest_float);
|
||||||
WebRtc_rdft(length_, 1, dest_float, work_ip_.get(), work_w_.get());
|
WebRtc_rdft(length_, 1, dest_float, work_ip_.get(), work_w_.get());
|
||||||
}
|
}
|
||||||
@ -65,7 +65,7 @@ void RealFourierOoura::Forward(const float* src, complex<float>* dest) const {
|
|||||||
|
|
||||||
void RealFourierOoura::Inverse(const complex<float>* src, float* dest) const {
|
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
|
// The real output array is shorter than the input complex array by one
|
||||||
// complex element.
|
// complex element.
|
||||||
const size_t dest_complex_length = complex_length_ - 1;
|
const size_t dest_complex_length = complex_length_ - 1;
|
||||||
|
|||||||
@ -58,7 +58,7 @@ class PushSincResamplerTest : public ::testing::TestWithParam<
|
|||||||
|
|
||||||
class ZeroSource : public SincResamplerCallback {
|
class ZeroSource : public SincResamplerCallback {
|
||||||
public:
|
public:
|
||||||
void Run(size_t frames, float* destination) {
|
void Run(size_t frames, float* destination) override {
|
||||||
std::memset(destination, 0, sizeof(float) * frames);
|
std::memset(destination, 0, sizeof(float) * frames);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -42,8 +42,8 @@ bool ValidRates(int in_rate, int out_rate) {
|
|||||||
class ResamplerTest : public testing::Test {
|
class ResamplerTest : public testing::Test {
|
||||||
protected:
|
protected:
|
||||||
ResamplerTest();
|
ResamplerTest();
|
||||||
virtual void SetUp();
|
void SetUp() override;
|
||||||
virtual void TearDown();
|
void TearDown() override;
|
||||||
|
|
||||||
void ResetIfNeededAndPush(int in_rate, int out_rate, int num_channels);
|
void ResetIfNeededAndPush(int in_rate, int out_rate, int num_channels);
|
||||||
|
|
||||||
|
|||||||
@ -31,7 +31,7 @@ class SinusoidalLinearChirpSource : public SincResamplerCallback {
|
|||||||
double max_frequency,
|
double max_frequency,
|
||||||
double delay_samples);
|
double delay_samples);
|
||||||
|
|
||||||
virtual ~SinusoidalLinearChirpSource() {}
|
~SinusoidalLinearChirpSource() override {}
|
||||||
|
|
||||||
void Run(size_t frames, float* destination) override;
|
void Run(size_t frames, float* destination) override;
|
||||||
|
|
||||||
|
|||||||
@ -28,7 +28,7 @@ static const int16_t vector16[kVector16Size] = {1,
|
|||||||
class SplTest : public testing::Test {
|
class SplTest : public testing::Test {
|
||||||
protected:
|
protected:
|
||||||
SplTest() { WebRtcSpl_Init(); }
|
SplTest() { WebRtcSpl_Init(); }
|
||||||
virtual ~SplTest() {}
|
~SplTest() override {}
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(SplTest, MacroTest) {
|
TEST_F(SplTest, MacroTest) {
|
||||||
|
|||||||
@ -39,8 +39,8 @@ const size_t kFrameLengthsSize = sizeof(kFrameLengths) / sizeof(*kFrameLengths);
|
|||||||
class VadTest : public ::testing::Test {
|
class VadTest : public ::testing::Test {
|
||||||
protected:
|
protected:
|
||||||
VadTest();
|
VadTest();
|
||||||
virtual void SetUp();
|
void SetUp() override;
|
||||||
virtual void TearDown();
|
void TearDown() override;
|
||||||
|
|
||||||
// Returns true if the rate and frame length combination is valid.
|
// Returns true if the rate and frame length combination is valid.
|
||||||
bool ValidRatesAndFrameLengths(int rate, size_t frame_length);
|
bool ValidRatesAndFrameLengths(int rate, size_t frame_length);
|
||||||
|
|||||||
@ -30,7 +30,7 @@ static const size_t kBytesPerSample = 2;
|
|||||||
class ReadableWavFile : public ReadableWav {
|
class ReadableWavFile : public ReadableWav {
|
||||||
public:
|
public:
|
||||||
explicit ReadableWavFile(FILE* file) : file_(file) {}
|
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_);
|
return fread(buf, 1, num_bytes, file_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -32,13 +32,13 @@ class ReadableWavBuffer : public ReadableWav {
|
|||||||
buf_exhausted_(false),
|
buf_exhausted_(false),
|
||||||
check_read_size_(check_read_size) {}
|
check_read_size_(check_read_size) {}
|
||||||
|
|
||||||
virtual ~ReadableWavBuffer() {
|
~ReadableWavBuffer() override {
|
||||||
// Verify the entire buffer has been read.
|
// Verify the entire buffer has been read.
|
||||||
if (check_read_size_)
|
if (check_read_size_)
|
||||||
EXPECT_EQ(size_, pos_);
|
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.
|
// Verify we don't try to read outside of a properly sized header.
|
||||||
if (size_ >= kWavHeaderSize)
|
if (size_ >= kWavHeaderSize)
|
||||||
EXPECT_GE(size_, pos_ + num_bytes);
|
EXPECT_GE(size_, pos_ + num_bytes);
|
||||||
|
|||||||
Reference in New Issue
Block a user