Enabling clang::find_bad_constructs for common_video.

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, webrtc:163
Change-Id: I6d3b45de9dca3a5a04f0cdd5583919d35a585a7e
Reviewed-on: https://webrtc-review.googlesource.com/89043
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24018}
This commit is contained in:
Mirko Bonadei 2018-07-17 15:47:51 +02:00 committed by Commit Bot
parent 9d764e8521
commit d93a51dfaa
11 changed files with 38 additions and 25 deletions

View file

@ -49,11 +49,6 @@ rtc_static_library("common_video") {
public_configs = [ ":common_video_config" ] public_configs = [ ":common_video_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" ]
}
deps = [ deps = [
"..:webrtc_common", "..:webrtc_common",
"../:typedefs", "../:typedefs",
@ -99,11 +94,6 @@ if (rtc_include_tests) {
"video_frame_unittest.cc", "video_frame_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_video", ":common_video",
"../api/video:video_frame", "../api/video:video_frame",

View file

@ -140,7 +140,7 @@ void WritePps(const PpsParser::PpsState& pps,
class PpsParserTest : public ::testing::Test { class PpsParserTest : public ::testing::Test {
public: public:
PpsParserTest() {} PpsParserTest() {}
virtual ~PpsParserTest() {} ~PpsParserTest() override {}
void RunTest() { void RunTest() {
VerifyParsing(generated_pps_, 0, 1, 0); VerifyParsing(generated_pps_, 0, 1, 0);

View file

@ -32,6 +32,8 @@ constexpr int kScaldingDeltaMax = 127;
namespace webrtc { namespace webrtc {
SpsParser::SpsState::SpsState() = default; SpsParser::SpsState::SpsState() = default;
SpsParser::SpsState::SpsState(const SpsState&) = default;
SpsParser::SpsState::~SpsState() = default;
// General note: this is based off the 02/2014 version of the H.264 standard. // General note: this is based off the 02/2014 version of the H.264 standard.
// You can find it on this page: // You can find it on this page:

View file

@ -26,6 +26,8 @@ class SpsParser {
// Add more as they are actually needed. // Add more as they are actually needed.
struct SpsState { struct SpsState {
SpsState(); SpsState();
SpsState(const SpsState&);
~SpsState();
uint32_t width = 0; uint32_t width = 0;
uint32_t height = 0; uint32_t height = 0;

View file

@ -110,7 +110,7 @@ void GenerateFakeSps(uint16_t width,
class H264SpsParserTest : public ::testing::Test { class H264SpsParserTest : public ::testing::Test {
public: public:
H264SpsParserTest() {} H264SpsParserTest() {}
virtual ~H264SpsParserTest() {} ~H264SpsParserTest() override {}
absl::optional<SpsParser::SpsState> sps_; absl::optional<SpsParser::SpsState> sps_;
}; };

View file

@ -35,8 +35,8 @@ void Calc16ByteAlignedStride(int width, int* stride_y, int* stride_uv) {
class TestLibYuv : public ::testing::Test { class TestLibYuv : public ::testing::Test {
protected: protected:
TestLibYuv(); TestLibYuv();
virtual void SetUp(); void SetUp() override;
virtual void TearDown(); void TearDown() override;
FILE* source_file_; FILE* source_file_;
std::unique_ptr<VideoFrame> orig_frame_; std::unique_ptr<VideoFrame> orig_frame_;

View file

@ -38,6 +38,8 @@ uint32_t EnsureValidRenderDelay(uint32_t render_delay) {
VideoRenderFrames::VideoRenderFrames(uint32_t render_delay_ms) VideoRenderFrames::VideoRenderFrames(uint32_t render_delay_ms)
: render_delay_ms_(EnsureValidRenderDelay(render_delay_ms)) {} : render_delay_ms_(EnsureValidRenderDelay(render_delay_ms)) {}
VideoRenderFrames::~VideoRenderFrames() = default;
int32_t VideoRenderFrames::AddFrame(VideoFrame&& new_frame) { int32_t VideoRenderFrames::AddFrame(VideoFrame&& new_frame) {
const int64_t time_now = rtc::TimeMillis(); const int64_t time_now = rtc::TimeMillis();

View file

@ -25,6 +25,7 @@ class VideoRenderFrames {
public: public:
explicit VideoRenderFrames(uint32_t render_delay_ms); explicit VideoRenderFrames(uint32_t render_delay_ms);
VideoRenderFrames(const VideoRenderFrames&) = delete; VideoRenderFrames(const VideoRenderFrames&) = delete;
~VideoRenderFrames();
// Add a frame to the render queue // Add a frame to the render queue
int32_t AddFrame(VideoFrame&& new_frame); int32_t AddFrame(VideoFrame&& new_frame);

View file

@ -793,9 +793,10 @@ TEST_F(TestSimulcastEncoderAdapterFake,
} }
// TODO(nisse): Reuse definition in webrtc/test/fake_texture_handle.h. // TODO(nisse): Reuse definition in webrtc/test/fake_texture_handle.h.
class FakeNativeBuffer : public VideoFrameBuffer { class FakeNativeBufferNoI420 : public VideoFrameBuffer {
public: public:
FakeNativeBuffer(int width, int height) : width_(width), height_(height) {} FakeNativeBufferNoI420(int width, int height)
: width_(width), height_(height) {}
Type type() const override { return Type::kNative; } Type type() const override { return Type::kNative; }
int width() const override { return width_; } int width() const override { return width_; }
@ -827,7 +828,7 @@ TEST_F(TestSimulcastEncoderAdapterFake,
EXPECT_TRUE(adapter_->SupportsNativeHandle()); EXPECT_TRUE(adapter_->SupportsNativeHandle());
rtc::scoped_refptr<VideoFrameBuffer> buffer( rtc::scoped_refptr<VideoFrameBuffer> buffer(
new rtc::RefCountedObject<FakeNativeBuffer>(1280, 720)); new rtc::RefCountedObject<FakeNativeBufferNoI420>(1280, 720));
VideoFrame input_frame(buffer, 100, 1000, kVideoRotation_180); VideoFrame input_frame(buffer, 100, 1000, kVideoRotation_180);
// Expect calls with the given video frame verbatim, since it's a texture // Expect calls with the given video frame verbatim, since it's a texture
// frame and can't otherwise be modified/resized. // frame and can't otherwise be modified/resized.

View file

@ -21,5 +21,24 @@ VideoFrame FakeNativeBuffer::CreateFrame(int width,
return VideoFrame(new rtc::RefCountedObject<FakeNativeBuffer>(width, height), return VideoFrame(new rtc::RefCountedObject<FakeNativeBuffer>(width, height),
timestamp, render_time_ms, rotation); timestamp, render_time_ms, rotation);
} }
VideoFrameBuffer::Type FakeNativeBuffer::type() const {
return Type::kNative;
}
int FakeNativeBuffer::width() const {
return width_;
}
int FakeNativeBuffer::height() const {
return height_;
}
rtc::scoped_refptr<I420BufferInterface> FakeNativeBuffer::ToI420() {
rtc::scoped_refptr<I420Buffer> buffer = I420Buffer::Create(width_, height_);
I420Buffer::SetBlack(buffer);
return buffer;
}
} // namespace test } // namespace test
} // namespace webrtc } // namespace webrtc

View file

@ -28,16 +28,12 @@ class FakeNativeBuffer : public VideoFrameBuffer {
FakeNativeBuffer(int width, int height) : width_(width), height_(height) {} FakeNativeBuffer(int width, int height) : width_(width), height_(height) {}
Type type() const override { return Type::kNative; } Type type() const override;
int width() const override { return width_; } int width() const override;
int height() const override { return height_; } int height() const override;
private: private:
rtc::scoped_refptr<I420BufferInterface> ToI420() override { rtc::scoped_refptr<I420BufferInterface> ToI420() override;
rtc::scoped_refptr<I420Buffer> buffer = I420Buffer::Create(width_, height_);
I420Buffer::SetBlack(buffer);
return buffer;
}
const int width_; const int width_;
const int height_; const int height_;