Enable more warning needed for Skia to build with Dawn on Linux
The new warnings are:
- -Wdeprecated-copy
- -Winvalid-offsetof
- -Wpessimizing-move
And the list of warnings was sorted alphabetically.
Bug: chromium:1072449
Change-Id: I9f3eecae645455c481ecc2e0be4df350e1453907
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20381
Reviewed-by: Zhenyao Mo <zmo@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
diff --git a/generator/templates/dawn_wire/WireCmd.cpp b/generator/templates/dawn_wire/WireCmd.cpp
index 653d79b..46a3d31 100644
--- a/generator/templates/dawn_wire/WireCmd.cpp
+++ b/generator/templates/dawn_wire/WireCmd.cpp
@@ -425,9 +425,16 @@
ObjectHandle::ObjectHandle(ObjectId id, ObjectGeneration generation)
: id(id), generation(generation) {
}
+
ObjectHandle::ObjectHandle(const volatile ObjectHandle& rhs)
: id(rhs.id), generation(rhs.generation) {
}
+ ObjectHandle& ObjectHandle::operator=(const volatile ObjectHandle& rhs) {
+ id = rhs.id;
+ generation = rhs.generation;
+ return *this;
+ }
+
ObjectHandle& ObjectHandle::AssignFrom(const ObjectHandle& rhs) {
id = rhs.id;
generation = rhs.generation;
diff --git a/generator/templates/dawn_wire/WireCmd.h b/generator/templates/dawn_wire/WireCmd.h
index b54f5de..cdc146a 100644
--- a/generator/templates/dawn_wire/WireCmd.h
+++ b/generator/templates/dawn_wire/WireCmd.h
@@ -27,7 +27,9 @@
ObjectHandle();
ObjectHandle(ObjectId id, ObjectGeneration generation);
+
ObjectHandle(const volatile ObjectHandle& rhs);
+ ObjectHandle& operator=(const volatile ObjectHandle& rhs);
// MSVC has a bug where it thinks the volatile copy assignment is a duplicate.
// Workaround this by forwarding to a different function AssignFrom.
diff --git a/src/common/BUILD.gn b/src/common/BUILD.gn
index 61cadaa..cbf27c5 100644
--- a/src/common/BUILD.gn
+++ b/src/common/BUILD.gn
@@ -90,16 +90,19 @@
# Enable more warnings that were found when using Dawn in other projects
if (is_clang) {
cflags = [
- "-Wstrict-prototypes",
- "-Winconsistent-missing-destructor-override",
- "-Wshadow-field",
- "-Wmissing-field-initializers",
- "-Wcstring-format-directive",
- "-Wtautological-unsigned-zero-compare",
- "-Wreturn-std-move-in-c++11",
"-Wconditional-uninitialized",
+ "-Wcstring-format-directive",
"-Wc++11-narrowing",
+ "-Wdeprecated-copy",
"-Wextra-semi-stmt",
+ "-Winconsistent-missing-destructor-override",
+ "-Winvalid-offsetof",
+ "-Wmissing-field-initializers",
+ "-Wpessimizing-move",
+ "-Wreturn-std-move-in-c++11",
+ "-Wshadow-field",
+ "-Wstrict-prototypes",
+ "-Wtautological-unsigned-zero-compare",
]
}
}
diff --git a/src/utils/WGPUHelpers.cpp b/src/utils/WGPUHelpers.cpp
index b2bf223..ef8d977 100644
--- a/src/utils/WGPUHelpers.cpp
+++ b/src/utils/WGPUHelpers.cpp
@@ -176,6 +176,10 @@
}
}
+ ComboRenderPassDescriptor::ComboRenderPassDescriptor(const ComboRenderPassDescriptor& other) {
+ *this = other;
+ }
+
const ComboRenderPassDescriptor& ComboRenderPassDescriptor::operator=(
const ComboRenderPassDescriptor& otherRenderPass) {
cDepthStencilAttachmentInfo = otherRenderPass.cDepthStencilAttachmentInfo;
diff --git a/src/utils/WGPUHelpers.h b/src/utils/WGPUHelpers.h
index b8c48fb..ccebc77 100644
--- a/src/utils/WGPUHelpers.h
+++ b/src/utils/WGPUHelpers.h
@@ -59,6 +59,8 @@
public:
ComboRenderPassDescriptor(std::initializer_list<wgpu::TextureView> colorAttachmentInfo,
wgpu::TextureView depthStencil = wgpu::TextureView());
+
+ ComboRenderPassDescriptor(const ComboRenderPassDescriptor& otherRenderPass);
const ComboRenderPassDescriptor& operator=(
const ComboRenderPassDescriptor& otherRenderPass);