Preliminary fixes for upgrading the MSVC toolchain

Fixes / suppresses a couple warnings raised by the updated MSVC and
silences all C++17 deprecation warnings since we can only fix them after
we update to use C++17.

Bug: dawn:824
Change-Id: I047985f26244ed3a42c73740617aee15546ca9dd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/75072
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>
This commit is contained in:
Corentin Wallez 2022-01-04 16:32:06 +00:00 committed by Dawn LUCI CQ
parent eb3b9ce2e8
commit e19e8356c1
4 changed files with 16 additions and 5 deletions

View File

@ -146,6 +146,17 @@ config("dawn_internal") {
# Dawn extends wgpu enums with internal enums.
# MSVC considers these invalid switch values. crbug.com/dawn/397.
cflags += [ "/wd4063" ]
# MSVC things that a switch over all the enum values of an enum class is
# not sufficient to cover all control paths. Turn off this warning so that
# the respective clang warning tells us where to add switch cases
# (otherwise we have to add default: UNREACHABLE() that silences clang too)
cflags += [ "/wd4715" ]
# MSVC emits warnings when using constructs deprecated in C++17. Silence
# them until they are fixed.
# TODO(dawn:824): Fix all uses of C++ features deprecated in C++17.
defines += [ "_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS" ]
if (dawn_is_winuwp) {
# /ZW makes sure we don't add calls that are forbidden in UWP.
# and /EHsc is required to be used in combination with it,

View File

@ -193,7 +193,7 @@ namespace {
for (wgpu::FeatureName feature : fakeFeatures) {
*(features++) = static_cast<WGPUFeatureName>(feature);
}
return fakeFeatures.size();
return static_cast<uint32_t>(fakeFeatures.size());
})));
api.CallAdapterRequestDeviceCallback(apiAdapter, WGPURequestDeviceStatus_Success,
@ -259,7 +259,7 @@ namespace {
for (wgpu::FeatureName feature : fakeFeatures) {
*(features++) = static_cast<WGPUFeatureName>(feature);
}
return fakeFeatures.size();
return static_cast<uint32_t>(fakeFeatures.size());
})));
// The device was actually created, but the wire didn't support its features.

View File

@ -138,7 +138,7 @@ namespace {
for (wgpu::FeatureName feature : fakeFeatures) {
*(features++) = static_cast<WGPUFeatureName>(feature);
}
return fakeFeatures.size();
return static_cast<uint32_t>(fakeFeatures.size());
})));
api.CallInstanceRequestAdapterCallback(
apiInstance, WGPURequestAdapterStatus_Success, apiAdapter, nullptr);
@ -217,7 +217,7 @@ namespace {
for (wgpu::FeatureName feature : fakeFeatures) {
*(features++) = static_cast<WGPUFeatureName>(feature);
}
return fakeFeatures.size();
return static_cast<uint32_t>(fakeFeatures.size());
})));
api.CallInstanceRequestAdapterCallback(
apiInstance, WGPURequestAdapterStatus_Success, apiAdapter, nullptr);

View File

@ -135,7 +135,7 @@ class EGLImageTestBase : public DawnTest {
gl.BindTexture(GL_TEXTURE_2D, tex);
gl.TexImage2D(GL_TEXTURE_2D, 0, internalFormat, width, height, 0, format, type, data);
EGLAttrib attribs[1] = {EGL_NONE};
EGLClientBuffer buffer = reinterpret_cast<EGLClientBuffer>(tex);
EGLClientBuffer buffer = reinterpret_cast<EGLClientBuffer>(static_cast<intptr_t>(tex));
EGLDisplay dpy = egl.GetCurrentDisplay();
EGLContext ctx = egl.GetCurrentContext();
EGLImage eglImage = egl.CreateImage(dpy, ctx, EGL_GL_TEXTURE_2D, buffer, attribs);