Add the -Wdeprecated-copy-dtor warning.

This should fix the warning triggering when using Dawn in Skia.

Bug: None
Change-Id: I045ebc87f9e8dbff035920fc6eaa409c2b70d0f2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/30701
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez 2020-11-03 14:24:05 +00:00 committed by Commit Bot service account
parent 8d248300c4
commit 18c7b0e0b1
11 changed files with 92 additions and 13 deletions

View File

@ -100,6 +100,7 @@ config("dawn_internal") {
"-Wcstring-format-directive", "-Wcstring-format-directive",
"-Wc++11-narrowing", "-Wc++11-narrowing",
"-Wdeprecated-copy", "-Wdeprecated-copy",
"-Wdeprecated-copy-dtor",
"-Wduplicate-enum", "-Wduplicate-enum",
"-Wextra-semi-stmt", "-Wextra-semi-stmt",
"-Wimplicit-fallthrough", "-Wimplicit-fallthrough",
@ -121,9 +122,6 @@ config("dawn_internal") {
# if (myUint64 > std::numeric_limits<size_t>::max()) {...} # if (myUint64 > std::numeric_limits<size_t>::max()) {...}
cflags += [ "-Wno-tautological-type-limit-compare" ] cflags += [ "-Wno-tautological-type-limit-compare" ]
# Suppressions for warnings found in Skia that should really be fixed.
cflags += [ "-Wno-deprecated-copy-dtor" ]
if (is_win) { if (is_win) {
cflags += [ cflags += [
# clang-cl doesn't know -pedantic, pass it explicitly to the clang driver # clang-cl doesn't know -pedantic, pass it explicitly to the clang driver

View File

@ -45,6 +45,9 @@ namespace dawn_native {
mImpl = nullptr; mImpl = nullptr;
} }
Adapter::Adapter(const Adapter& other) = default;
Adapter& Adapter::operator=(const Adapter& other) = default;
void Adapter::GetProperties(wgpu::AdapterProperties* properties) const { void Adapter::GetProperties(wgpu::AdapterProperties* properties) const {
properties->backendType = mImpl->GetBackendType(); properties->backendType = mImpl->GetBackendType();
properties->adapterType = mImpl->GetAdapterType(); properties->adapterType = mImpl->GetAdapterType();

View File

@ -19,6 +19,7 @@ source_set("dawn_platform") {
sources = [ sources = [
"${dawn_root}/src/include/dawn_platform/DawnPlatform.h", "${dawn_root}/src/include/dawn_platform/DawnPlatform.h",
"DawnPlatform.cpp",
"tracing/EventTracer.cpp", "tracing/EventTracer.cpp",
"tracing/EventTracer.h", "tracing/EventTracer.h",
"tracing/TraceEvent.h", "tracing/TraceEvent.h",

View File

@ -15,6 +15,7 @@
add_library(dawn_platform STATIC ${DAWN_DUMMY_FILE}) add_library(dawn_platform STATIC ${DAWN_DUMMY_FILE})
target_sources(dawn_platform PRIVATE target_sources(dawn_platform PRIVATE
"${DAWN_INCLUDE_DIR}/dawn_platform/DawnPlatform.h" "${DAWN_INCLUDE_DIR}/dawn_platform/DawnPlatform.h"
"DawnPlatform.cpp"
"tracing/EventTracer.cpp" "tracing/EventTracer.cpp"
"tracing/EventTracer.h" "tracing/EventTracer.h"
"tracing/TraceEvent.h" "tracing/TraceEvent.h"

View File

@ -0,0 +1,23 @@
// Copyright 2020 The Dawn Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "dawn_platform/DawnPlatform.h"
namespace dawn_platform {
Platform::Platform() = default;
Platform::~Platform() = default;
} // namespace dawn_platform

View File

@ -42,6 +42,8 @@ namespace dawn_wire {
} }
namespace client { namespace client {
MemoryTransferService::MemoryTransferService() = default;
MemoryTransferService::~MemoryTransferService() = default; MemoryTransferService::~MemoryTransferService() = default;
MemoryTransferService::ReadHandle* MemoryTransferService::ReadHandle*
@ -54,8 +56,12 @@ namespace dawn_wire {
return CreateWriteHandle(size); return CreateWriteHandle(size);
} }
MemoryTransferService::ReadHandle::ReadHandle() = default;
MemoryTransferService::ReadHandle::~ReadHandle() = default; MemoryTransferService::ReadHandle::~ReadHandle() = default;
MemoryTransferService::WriteHandle::WriteHandle() = default;
MemoryTransferService::WriteHandle::~WriteHandle() = default; MemoryTransferService::WriteHandle::~WriteHandle() = default;
} // namespace client } // namespace client

View File

@ -37,10 +37,16 @@ namespace dawn_wire {
} }
namespace server { namespace server {
MemoryTransferService::MemoryTransferService() = default;
MemoryTransferService::~MemoryTransferService() = default; MemoryTransferService::~MemoryTransferService() = default;
MemoryTransferService::ReadHandle::ReadHandle() = default;
MemoryTransferService::ReadHandle::~ReadHandle() = default; MemoryTransferService::ReadHandle::~ReadHandle() = default;
MemoryTransferService::WriteHandle::WriteHandle() = default;
MemoryTransferService::WriteHandle::~WriteHandle() = default; MemoryTransferService::WriteHandle::~WriteHandle() = default;
void MemoryTransferService::WriteHandle::SetTarget(void* data, size_t dataLength) { void MemoryTransferService::WriteHandle::SetTarget(void* data, size_t dataLength) {

View File

@ -93,6 +93,9 @@ namespace dawn_native {
Adapter(AdapterBase* impl); Adapter(AdapterBase* impl);
~Adapter(); ~Adapter();
Adapter(const Adapter& other);
Adapter& operator=(const Adapter& other);
// DEPRECATED: use GetProperties instead. // DEPRECATED: use GetProperties instead.
BackendType GetBackendType() const; BackendType GetBackendType() const;
DeviceType GetDeviceType() const; DeviceType GetDeviceType() const;

View File

@ -30,8 +30,9 @@ namespace dawn_platform {
class DAWN_NATIVE_EXPORT Platform { class DAWN_NATIVE_EXPORT Platform {
public: public:
virtual ~Platform() { Platform();
} virtual ~Platform();
virtual const unsigned char* GetTraceCategoryEnabledFlag(TraceCategory category) = 0; virtual const unsigned char* GetTraceCategoryEnabledFlag(TraceCategory category) = 0;
virtual double MonotonicallyIncreasingTime() = 0; virtual double MonotonicallyIncreasingTime() = 0;
@ -46,6 +47,10 @@ namespace dawn_platform {
const unsigned char* argTypes, const unsigned char* argTypes,
const uint64_t* argValues, const uint64_t* argValues,
unsigned char flags) = 0; unsigned char flags) = 0;
private:
Platform(const Platform&) = delete;
Platform& operator=(const Platform&) = delete;
}; };
} // namespace dawn_platform } // namespace dawn_platform

View File

@ -63,11 +63,12 @@ namespace dawn_wire {
namespace client { namespace client {
class DAWN_WIRE_EXPORT MemoryTransferService { class DAWN_WIRE_EXPORT MemoryTransferService {
public: public:
MemoryTransferService();
virtual ~MemoryTransferService();
class ReadHandle; class ReadHandle;
class WriteHandle; class WriteHandle;
virtual ~MemoryTransferService();
// Create a handle for reading server data. // Create a handle for reading server data.
// This may fail and return nullptr. // This may fail and return nullptr.
virtual ReadHandle* CreateReadHandle(size_t) = 0; virtual ReadHandle* CreateReadHandle(size_t) = 0;
@ -84,6 +85,9 @@ namespace dawn_wire {
class DAWN_WIRE_EXPORT ReadHandle { class DAWN_WIRE_EXPORT ReadHandle {
public: public:
ReadHandle();
virtual ~ReadHandle();
// Get the required serialization size for SerializeCreate // Get the required serialization size for SerializeCreate
virtual size_t SerializeCreateSize() = 0; virtual size_t SerializeCreateSize() = 0;
@ -100,11 +104,17 @@ namespace dawn_wire {
size_t deserializeSize, size_t deserializeSize,
const void** data, const void** data,
size_t* dataLength) = 0; size_t* dataLength) = 0;
virtual ~ReadHandle();
private:
ReadHandle(const ReadHandle&) = delete;
ReadHandle& operator=(const ReadHandle&) = delete;
}; };
class DAWN_WIRE_EXPORT WriteHandle { class DAWN_WIRE_EXPORT WriteHandle {
public: public:
WriteHandle();
virtual ~WriteHandle();
// Get the required serialization size for SerializeCreate // Get the required serialization size for SerializeCreate
virtual size_t SerializeCreateSize() = 0; virtual size_t SerializeCreateSize() = 0;
@ -123,8 +133,14 @@ namespace dawn_wire {
// server. // server.
virtual void SerializeFlush(void* serializePointer) = 0; virtual void SerializeFlush(void* serializePointer) = 0;
virtual ~WriteHandle(); private:
WriteHandle(const WriteHandle&) = delete;
WriteHandle& operator=(const WriteHandle&) = delete;
}; };
private:
MemoryTransferService(const MemoryTransferService&) = delete;
MemoryTransferService& operator=(const MemoryTransferService&) = delete;
}; };
// Backdoor to get the order of the ProcMap for testing // Backdoor to get the order of the ProcMap for testing

View File

@ -52,11 +52,12 @@ namespace dawn_wire {
namespace server { namespace server {
class DAWN_WIRE_EXPORT MemoryTransferService { class DAWN_WIRE_EXPORT MemoryTransferService {
public: public:
MemoryTransferService();
virtual ~MemoryTransferService();
class ReadHandle; class ReadHandle;
class WriteHandle; class WriteHandle;
virtual ~MemoryTransferService();
// Deserialize data to create Read/Write handles. These handles are for the client // Deserialize data to create Read/Write handles. These handles are for the client
// to Read/Write data. // to Read/Write data.
virtual bool DeserializeReadHandle(const void* deserializePointer, virtual bool DeserializeReadHandle(const void* deserializePointer,
@ -68,6 +69,9 @@ namespace dawn_wire {
class DAWN_WIRE_EXPORT ReadHandle { class DAWN_WIRE_EXPORT ReadHandle {
public: public:
ReadHandle();
virtual ~ReadHandle();
// Get the required serialization size for SerializeInitialData // Get the required serialization size for SerializeInitialData
virtual size_t SerializeInitialDataSize(const void* data, size_t dataLength) = 0; virtual size_t SerializeInitialDataSize(const void* data, size_t dataLength) = 0;
@ -76,11 +80,17 @@ namespace dawn_wire {
virtual void SerializeInitialData(const void* data, virtual void SerializeInitialData(const void* data,
size_t dataLength, size_t dataLength,
void* serializePointer) = 0; void* serializePointer) = 0;
virtual ~ReadHandle();
private:
ReadHandle(const ReadHandle&) = delete;
ReadHandle& operator=(const ReadHandle&) = delete;
}; };
class DAWN_WIRE_EXPORT WriteHandle { class DAWN_WIRE_EXPORT WriteHandle {
public: public:
WriteHandle();
virtual ~WriteHandle();
// Set the target for writes from the client. DeserializeFlush should copy data // Set the target for writes from the client. DeserializeFlush should copy data
// into the target. // into the target.
void SetTarget(void* data, size_t dataLength); void SetTarget(void* data, size_t dataLength);
@ -89,12 +99,19 @@ namespace dawn_wire {
// client::MemoryTransferService::WriteHandle::SerializeFlush. // client::MemoryTransferService::WriteHandle::SerializeFlush.
virtual bool DeserializeFlush(const void* deserializePointer, virtual bool DeserializeFlush(const void* deserializePointer,
size_t deserializeSize) = 0; size_t deserializeSize) = 0;
virtual ~WriteHandle();
protected: protected:
void* mTargetData = nullptr; void* mTargetData = nullptr;
size_t mDataLength = 0; size_t mDataLength = 0;
private:
WriteHandle(const WriteHandle&) = delete;
WriteHandle& operator=(const WriteHandle&) = delete;
}; };
private:
MemoryTransferService(const MemoryTransferService&) = delete;
MemoryTransferService& operator=(const MemoryTransferService&) = delete;
}; };
} // namespace server } // namespace server