From 8e9c3f663ccd270b8f047afe668e7cbc15e11bba Mon Sep 17 00:00:00 2001 From: Corentin Wallez Date: Sat, 23 Nov 2019 03:40:53 +0000 Subject: [PATCH] Fix compilation on MSVC BUG= Change-Id: I9f33a4c26cc2ca1e6d6cdbc245d929175867b1e5 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13961 Commit-Queue: Austin Eng Reviewed-by: Austin Eng Reviewed-by: Jiawei Shao --- src/tests/perf_tests/DrawCallPerf.cpp | 1 + src/tests/unittests/RefCountedTests.cpp | 14 +++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/tests/perf_tests/DrawCallPerf.cpp b/src/tests/perf_tests/DrawCallPerf.cpp index 662a3be227..50b54f1096 100644 --- a/src/tests/perf_tests/DrawCallPerf.cpp +++ b/src/tests/perf_tests/DrawCallPerf.cpp @@ -124,6 +124,7 @@ namespace { UniformData::Static, RenderBundle::No}; unsigned int unused[] = { + 0, // Avoid making a 0-sized array. AssignParam(std::get(paramTuple), args)..., }; DAWN_UNUSED(unused); diff --git a/src/tests/unittests/RefCountedTests.cpp b/src/tests/unittests/RefCountedTests.cpp index 03b2dff0f3..cbba420fe4 100644 --- a/src/tests/unittests/RefCountedTests.cpp +++ b/src/tests/unittests/RefCountedTests.cpp @@ -20,9 +20,13 @@ using namespace dawn_native; struct RCTest : public RefCounted { - using RefCounted::RefCounted; + RCTest() : RefCounted() { + } - RCTest(bool* deleted): deleted(deleted) { + RCTest(uint64_t payload) : RefCounted(payload) { + } + + RCTest(bool* deleted) : deleted(deleted) { } ~RCTest() override { @@ -213,18 +217,18 @@ TEST(Ref, InitialPayloadValue) { ASSERT_EQ(testDefaultConstructor->GetRefCountPayload(), 0u); testDefaultConstructor->Release(); - RCTest* testZero = new RCTest(0); + RCTest* testZero = new RCTest(uint64_t(0ull)); ASSERT_EQ(testZero->GetRefCountPayload(), 0u); testZero->Release(); - RCTest* testOne = new RCTest(1); + RCTest* testOne = new RCTest(1ull); ASSERT_EQ(testOne->GetRefCountPayload(), 1u); testOne->Release(); } // Test that the payload survives ref and release operations TEST(Ref, PayloadUnchangedByRefCounting) { - RCTest* test = new RCTest(1); + RCTest* test = new RCTest(1ull); ASSERT_EQ(test->GetRefCountPayload(), 1u); test->Reference();