Enable deprecated-copy-dtor warning.

In C++11 a user declared destructor still requires the compiler to
implicitly default the copy constructor and copy assignment operator,
but this is deprecated. Note that a user declared destructor suppresses
the move constructor and move assignment operator; a user declared
destructor exists if any '~Foo' method declaration appears inside
'class Foo' (even if defaulted); if the copy and move operations are the
same then copy operations that take 'const Foo&' will do fine double
duty as move operations.

Clang seems to have an issue with this warning, in that it does not
appear to distinguish between compiler defaulted and user defaulted
destructors. As a result, it does not always warn when it should.
There may yet be places in the code where a move operation is desired
but may be suppressed because the implicitly defaulted  moves are not
declared because a destructor has been declared.

This wraps dawn and shaderc configs in 'third_party' so that their
headers will be included through '-isystem' in order to avoid the
warnings generated by including their headers.

Change-Id: I681524cd890d86305aa99b6b765a52113b4dfa4b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/280406
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
This commit is contained in:
Ben Wagner 2020-03-27 17:10:35 -04:00 committed by Skia Commit-Bot
parent 982f546cc1
commit e990fcc4b0
13 changed files with 54 additions and 39 deletions

View File

@ -463,8 +463,8 @@ config("warnings") {
"-Wdeprecated-attributes",
"-Wdeprecated-comma-subscript",
"-Wdeprecated-copy",
"-Wdeprecated-copy-dtor",
#"-Wdeprecated-copy-dtor",
#"-Wdeprecated-declarations",
"-Wdeprecated-dynamic-exception-spec",
"-Wdeprecated-enum-compare",

View File

@ -26,25 +26,25 @@
enum GrDriverBugWorkaroundType {
#define GPU_OP(type, name) type,
GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP)
GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP)
#undef GPU_OP
NUMBER_OF_GPU_DRIVER_BUG_WORKAROUND_TYPES
NUMBER_OF_GPU_DRIVER_BUG_WORKAROUND_TYPES
};
class SK_API GrDriverBugWorkarounds {
public:
GrDriverBugWorkarounds();
explicit GrDriverBugWorkarounds(const std::vector<int32_t>& workarounds);
public:
GrDriverBugWorkarounds();
GrDriverBugWorkarounds(const GrDriverBugWorkarounds&);
GrDriverBugWorkarounds& operator=(const GrDriverBugWorkarounds&);
~GrDriverBugWorkarounds();
GrDriverBugWorkarounds& operator=(const GrDriverBugWorkarounds&) = default;
explicit GrDriverBugWorkarounds(const std::vector<int32_t>& workarounds);
// Turn on any workarounds listed in |workarounds| (but don't turn any off).
void applyOverrides(const GrDriverBugWorkarounds& workarounds);
~GrDriverBugWorkarounds();
// Turn on any workarounds listed in |workarounds| (but don't turn any off).
void applyOverrides(const GrDriverBugWorkarounds& workarounds);
#define GPU_OP(type, name) bool name = false;
GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP)
GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP)
#undef GPU_OP
};

View File

@ -284,6 +284,7 @@ LayerBuilder::LayerBuilder(const skjson::ObjectValue& jlayer)
}
}
LayerBuilder::LayerBuilder(LayerBuilder&&) = default;
LayerBuilder::~LayerBuilder() = default;
bool LayerBuilder::isCamera() const {

View File

@ -18,6 +18,10 @@ class CompositionBuilder;
class LayerBuilder final {
public:
explicit LayerBuilder(const skjson::ObjectValue& jlayer);
LayerBuilder(const LayerBuilder&) = delete;
LayerBuilder& operator=(const LayerBuilder&) = delete;
LayerBuilder(LayerBuilder&&);
LayerBuilder& operator=(LayerBuilder&&) = delete;
~LayerBuilder();
int index() const { return fIndex; }

View File

@ -42,14 +42,12 @@ struct RunShifts {
class InternalLineMetrics;
class Run {
public:
Run() = default;
Run(ParagraphImpl* master,
const SkShaper::RunHandler::RunInfo& info,
size_t firstChar,
SkScalar lineHeight,
size_t index,
SkScalar shiftX);
~Run() {}
void setMaster(ParagraphImpl* master) { fMaster = master; }

View File

@ -21,6 +21,11 @@ class GrContext;
*/
class GrClip {
public:
GrClip() = default;
GrClip(const GrClip&) = default;
GrClip& operator=(const GrClip&) = default;
virtual ~GrClip() = default;
virtual bool quickContains(const SkRect&) const = 0;
virtual bool quickContains(const SkRRect& rrect) const {
return this->quickContains(rrect.getBounds());
@ -38,8 +43,6 @@ public:
virtual bool apply(GrRecordingContext*, GrRenderTargetContext*, bool useHWAA,
bool hasUserStencilSettings, GrAppliedClip*, SkRect* bounds) const = 0;
virtual ~GrClip() {}
/**
* This method quickly and conservatively determines whether the entire clip is equivalent to
* intersection with a rrect. This will only return true if the rrect does not fully contain

View File

@ -10,6 +10,9 @@
#include "include/core/SkTypes.h"
GrDriverBugWorkarounds::GrDriverBugWorkarounds() = default;
GrDriverBugWorkarounds::GrDriverBugWorkarounds(const GrDriverBugWorkarounds&) = default;
GrDriverBugWorkarounds& GrDriverBugWorkarounds::operator=(const GrDriverBugWorkarounds&) = default;
GrDriverBugWorkarounds::~GrDriverBugWorkarounds() = default;
GrDriverBugWorkarounds::GrDriverBugWorkarounds(
const std::vector<int>& enabled_driver_bug_workarounds) {
@ -37,5 +40,3 @@ void GrDriverBugWorkarounds::applyOverrides(
GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP)
#undef GPU_OP
}
GrDriverBugWorkarounds::~GrDriverBugWorkarounds() = default;

View File

@ -18,10 +18,10 @@ namespace SkSL {
* version of the program (all types determined, everything validated), ready for code generation.
*/
struct IRNode {
IRNode(int offset)
: fOffset(offset) {}
virtual ~IRNode() {}
IRNode(int offset) : fOffset(offset) {}
IRNode(const IRNode&) = default;
IRNode& operator=(const IRNode&) = default;
virtual ~IRNode() = default;
#ifdef SK_DEBUG
virtual String description() const = 0;

View File

@ -26,11 +26,7 @@ struct Symbol : public IRNode {
};
Symbol(int offset, Kind kind, StringFragment name)
: INHERITED(offset)
, fKind(kind)
, fName(name) {}
virtual ~Symbol() {}
: INHERITED(offset), fKind(kind), fName(name) {}
Kind fKind;
StringFragment fName;

View File

@ -14,6 +14,7 @@
import("../externals/dawn/generator/dawn_generator.gni")
import("../externals/dawn/scripts/dawn_features.gni")
import("../third_party.gni")
###############################################################################
# dawn_platform
@ -533,7 +534,7 @@ static_library("libdawn_native") {
}
}
config("libdawn_public") {
third_party_config("libdawn_public") {
include_dirs = [
"$dawn_gen_root/src/include",
"$dawn_gen_root/src",

View File

@ -20,7 +20,7 @@ use_context_logging = !shaderc_spvc_disable_context_logging
is_msvc = is_win && !is_clang
config("shaderc_util_public") {
third_party_config("shaderc_util_public") {
include_dirs = [ "${shaderc_root}/libshaderc_util/include" ]
}
@ -62,7 +62,7 @@ source_set("shaderc_util_sources") {
]
}
config("shaderc_public") {
third_party_config("shaderc_public") {
include_dirs = [ "${shaderc_root}/libshaderc/include" ]
if (is_component_build) {
defines = [ "SHADERC_SHAREDLIB" ]

View File

@ -3,18 +3,16 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
template("third_party") {
template("third_party_config") {
enabled = !defined(invoker.enabled) || invoker.enabled
config(target_name + "_public") {
config(target_name) {
if (enabled) {
forward_variables_from(invoker, "*", [ "include_dirs" ])
cflags = []
if (defined(invoker.public_defines)) {
defines = invoker.public_defines
}
if (is_win) {
include_dirs = invoker.public_include_dirs
include_dirs = invoker.include_dirs
if (is_clang) {
foreach(dir, invoker.public_include_dirs) {
foreach(dir, invoker.include_dirs) {
cflags += [
"/imsvc",
rebase_path(dir),
@ -22,7 +20,7 @@ template("third_party") {
}
}
} else {
foreach(dir, invoker.public_include_dirs) {
foreach(dir, invoker.include_dirs) {
if (werror) {
cflags += [
"-isystem",
@ -40,6 +38,20 @@ template("third_party") {
not_needed(invoker, "*")
}
}
}
template("third_party") {
enabled = !defined(invoker.enabled) || invoker.enabled
third_party_config(target_name + "_public") {
if (enabled) {
if (defined(invoker.public_defines)) {
defines = invoker.public_defines
}
include_dirs = invoker.public_include_dirs
} else {
not_needed(invoker, "*")
}
}
# You can't make a static_library() without object files to archive,
# but we can treat targets without object files as a source_set().

View File

@ -139,7 +139,6 @@ private:
, fOriginalUniqueID(originalUniqueID)
, fImageInfo(ii) {
}
~PromiseImageInfo() {}
int index() const { return fIndex; }
uint32_t originalUniqueID() const { return fOriginalUniqueID; }