Add -Wdeprecated-copy.
Prevent new cases of this warning. Also fix remaining cases in targets
that Chromium may not be building, and fix a nit in
cpdf_transparency.cpp.
Bug: chromium:1213098
Change-Id: Iaec93cb9e6dc0595f67c11eb7a9933a56fcd08fd
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/81979
Reviewed-by: Peter Kasting <pkasting@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
diff --git a/BUILD.gn b/BUILD.gn
index 4e69f0b..3c2f84d 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -49,6 +49,9 @@
# Override -Wno-c++11-narrowing.
cflags += [ "-Wc++11-narrowing" ]
+ # TODO(crbug.com/1213098): Remove once this is in //build.
+ cflags += [ "-Wdeprecated-copy" ]
+
# Catch misuse of cppgc in XFA.
if (pdf_enable_xfa && clang_use_chrome_plugins) {
cflags += [
diff --git a/core/fpdfapi/page/cpdf_transparency.cpp b/core/fpdfapi/page/cpdf_transparency.cpp
index b5498ec..ec3379d 100644
--- a/core/fpdfapi/page/cpdf_transparency.cpp
+++ b/core/fpdfapi/page/cpdf_transparency.cpp
@@ -7,5 +7,6 @@
CPDF_Transparency::CPDF_Transparency() = default;
CPDF_Transparency::CPDF_Transparency(const CPDF_Transparency& other) = default;
+
CPDF_Transparency& CPDF_Transparency::operator=(
const CPDF_Transparency& other) = default;
diff --git a/testing/image_diff/image_diff.cpp b/testing/image_diff/image_diff.cpp
index 23109af..e7c5681 100644
--- a/testing/image_diff/image_diff.cpp
+++ b/testing/image_diff/image_diff.cpp
@@ -38,7 +38,8 @@
class Image {
public:
Image() = default;
- Image(const Image& image) : w_(image.w_), h_(image.h_), data_(image.data_) {}
+ Image(const Image& image) = default;
+ Image& operator=(const Image& other) = default;
bool has_image() const { return w_ > 0 && h_ > 0; }
int w() const { return w_; }