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}
diff --git a/common_video/BUILD.gn b/common_video/BUILD.gn
index 7b08e42..7dfac4f 100644
--- a/common_video/BUILD.gn
+++ b/common_video/BUILD.gn
@@ -49,11 +49,6 @@
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 = [
"..:webrtc_common",
"../:typedefs",
@@ -99,11 +94,6 @@
"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 = [
":common_video",
"../api/video:video_frame",
diff --git a/common_video/h264/pps_parser_unittest.cc b/common_video/h264/pps_parser_unittest.cc
index 9fdbf7e..bfafecf 100644
--- a/common_video/h264/pps_parser_unittest.cc
+++ b/common_video/h264/pps_parser_unittest.cc
@@ -140,7 +140,7 @@
class PpsParserTest : public ::testing::Test {
public:
PpsParserTest() {}
- virtual ~PpsParserTest() {}
+ ~PpsParserTest() override {}
void RunTest() {
VerifyParsing(generated_pps_, 0, 1, 0);
diff --git a/common_video/h264/sps_parser.cc b/common_video/h264/sps_parser.cc
index b313f48..ce12834 100644
--- a/common_video/h264/sps_parser.cc
+++ b/common_video/h264/sps_parser.cc
@@ -32,6 +32,8 @@
namespace webrtc {
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.
// You can find it on this page:
diff --git a/common_video/h264/sps_parser.h b/common_video/h264/sps_parser.h
index d4294b2..386d468 100644
--- a/common_video/h264/sps_parser.h
+++ b/common_video/h264/sps_parser.h
@@ -26,6 +26,8 @@
// Add more as they are actually needed.
struct SpsState {
SpsState();
+ SpsState(const SpsState&);
+ ~SpsState();
uint32_t width = 0;
uint32_t height = 0;
diff --git a/common_video/h264/sps_parser_unittest.cc b/common_video/h264/sps_parser_unittest.cc
index 50227ed..e88d0c3 100644
--- a/common_video/h264/sps_parser_unittest.cc
+++ b/common_video/h264/sps_parser_unittest.cc
@@ -110,7 +110,7 @@
class H264SpsParserTest : public ::testing::Test {
public:
H264SpsParserTest() {}
- virtual ~H264SpsParserTest() {}
+ ~H264SpsParserTest() override {}
absl::optional<SpsParser::SpsState> sps_;
};
diff --git a/common_video/libyuv/libyuv_unittest.cc b/common_video/libyuv/libyuv_unittest.cc
index 41d111c..79e7cb6 100644
--- a/common_video/libyuv/libyuv_unittest.cc
+++ b/common_video/libyuv/libyuv_unittest.cc
@@ -35,8 +35,8 @@
class TestLibYuv : public ::testing::Test {
protected:
TestLibYuv();
- virtual void SetUp();
- virtual void TearDown();
+ void SetUp() override;
+ void TearDown() override;
FILE* source_file_;
std::unique_ptr<VideoFrame> orig_frame_;
diff --git a/common_video/video_render_frames.cc b/common_video/video_render_frames.cc
index 982923c..02a105a 100644
--- a/common_video/video_render_frames.cc
+++ b/common_video/video_render_frames.cc
@@ -38,6 +38,8 @@
VideoRenderFrames::VideoRenderFrames(uint32_t render_delay_ms)
: render_delay_ms_(EnsureValidRenderDelay(render_delay_ms)) {}
+VideoRenderFrames::~VideoRenderFrames() = default;
+
int32_t VideoRenderFrames::AddFrame(VideoFrame&& new_frame) {
const int64_t time_now = rtc::TimeMillis();
diff --git a/common_video/video_render_frames.h b/common_video/video_render_frames.h
index 31a4634..0b47e0a 100644
--- a/common_video/video_render_frames.h
+++ b/common_video/video_render_frames.h
@@ -25,6 +25,7 @@
public:
explicit VideoRenderFrames(uint32_t render_delay_ms);
VideoRenderFrames(const VideoRenderFrames&) = delete;
+ ~VideoRenderFrames();
// Add a frame to the render queue
int32_t AddFrame(VideoFrame&& new_frame);
diff --git a/media/engine/simulcast_encoder_adapter_unittest.cc b/media/engine/simulcast_encoder_adapter_unittest.cc
index cce32d5..a352887 100644
--- a/media/engine/simulcast_encoder_adapter_unittest.cc
+++ b/media/engine/simulcast_encoder_adapter_unittest.cc
@@ -793,9 +793,10 @@
}
// TODO(nisse): Reuse definition in webrtc/test/fake_texture_handle.h.
-class FakeNativeBuffer : public VideoFrameBuffer {
+class FakeNativeBufferNoI420 : public VideoFrameBuffer {
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; }
int width() const override { return width_; }
@@ -827,7 +828,7 @@
EXPECT_TRUE(adapter_->SupportsNativeHandle());
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);
// Expect calls with the given video frame verbatim, since it's a texture
// frame and can't otherwise be modified/resized.
diff --git a/test/fake_texture_frame.cc b/test/fake_texture_frame.cc
index 4c4ea94..c6f186e 100644
--- a/test/fake_texture_frame.cc
+++ b/test/fake_texture_frame.cc
@@ -21,5 +21,24 @@
return VideoFrame(new rtc::RefCountedObject<FakeNativeBuffer>(width, height),
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 webrtc
diff --git a/test/fake_texture_frame.h b/test/fake_texture_frame.h
index 17261ff..1b25112 100644
--- a/test/fake_texture_frame.h
+++ b/test/fake_texture_frame.h
@@ -28,16 +28,12 @@
FakeNativeBuffer(int width, int height) : width_(width), height_(height) {}
- Type type() const override { return Type::kNative; }
- int width() const override { return width_; }
- int height() const override { return height_; }
+ Type type() const override;
+ int width() const override;
+ int height() const override;
private:
- rtc::scoped_refptr<I420BufferInterface> ToI420() override {
- rtc::scoped_refptr<I420Buffer> buffer = I420Buffer::Create(width_, height_);
- I420Buffer::SetBlack(buffer);
- return buffer;
- }
+ rtc::scoped_refptr<I420BufferInterface> ToI420() override;
const int width_;
const int height_;