Fix clang/GCC warnings

This commit is contained in:
Corentin Wallez
2017-07-07 14:39:38 -04:00
committed by Corentin Wallez
parent f30dffa75f
commit 98c90d4faa
18 changed files with 38 additions and 28 deletions

View File

@@ -280,6 +280,10 @@ namespace detail {
return type == MetalBackend;
#elif defined(_WIN32)
return type == D3D12Backend;
#elif __linux__
// Temporarily silence a warning while Linux doesn't have a backend that can be tested.
(void) type;
return false;
#else
return false;
#endif

View File

@@ -179,7 +179,7 @@ class InputStateTest : public NXTTest {
uint32_t location;
nxt::Buffer* buffer;
};
void DoTestDraw(const nxt::Pipeline& pipeline, int triangles, int instances, std::vector<DrawVertexBuffer> vertexBuffers) {
void DoTestDraw(const nxt::Pipeline& pipeline, unsigned int triangles, unsigned int instances, std::vector<DrawVertexBuffer> vertexBuffers) {
EXPECT_LE(triangles, 4);
EXPECT_LE(instances, 4);

View File

@@ -53,6 +53,7 @@ TEST_F(BitSetIteratorTest, EmptySet) {
// causing an unreachable code warning in MSVS
bool sawBit = false;
for (unsigned long bit : IterateBitSet(mStateBits)) {
(void) bit;
sawBit = true;
}
EXPECT_FALSE(sawBit);

View File

@@ -27,6 +27,7 @@ TEST(SerialQueue, BasicTest) {
// Iterating on empty queue 1) works 2) doesn't produce any values
for (int value : queue.IterateAll()) {
(void) value;
ASSERT_TRUE(false);
}
@@ -49,6 +50,7 @@ TEST(SerialQueue, BasicTest) {
ASSERT_TRUE(queue.Empty());
for (int value : queue.IterateAll()) {
(void) value;
ASSERT_TRUE(false);
}
}

View File

@@ -128,7 +128,7 @@ class WireTests : public WireTestsBase {
// One call gets forwarded correctly.
TEST_F(WireTests, CallForwarded) {
nxtCommandBufferBuilder builder = nxtDeviceCreateCommandBufferBuilder(device);
nxtDeviceCreateCommandBufferBuilder(device);
nxtCommandBufferBuilder apiCmdBufBuilder = api.GetNewCommandBufferBuilder();
EXPECT_CALL(api, DeviceCreateCommandBufferBuilder(apiDevice))
@@ -140,7 +140,7 @@ TEST_F(WireTests, CallForwarded) {
// Test that calling methods on a new object works as expected.
TEST_F(WireTests, CreateThenCall) {
nxtCommandBufferBuilder builder = nxtDeviceCreateCommandBufferBuilder(device);
nxtCommandBuffer cmdBuf = nxtCommandBufferBuilderGetResult(builder);
nxtCommandBufferBuilderGetResult(builder);
nxtCommandBufferBuilder apiCmdBufBuilder = api.GetNewCommandBufferBuilder();
EXPECT_CALL(api, DeviceCreateCommandBufferBuilder(apiDevice))
@@ -350,7 +350,7 @@ TEST_F(WireTests, CallsSkippedAfterBuilderError) {
// These calls will be skipped because of the error
nxtBufferTransitionUsage(buffer, NXT_BUFFER_USAGE_BIT_UNIFORM);
nxtCommandBufferBuilderTransitionBufferUsage(cmdBufBuilder, buffer, NXT_BUFFER_USAGE_BIT_UNIFORM);
nxtCommandBuffer cmdBuf = nxtCommandBufferBuilderGetResult(cmdBufBuilder);
nxtCommandBufferBuilderGetResult(cmdBufBuilder);
nxtCommandBufferBuilder apiCmdBufBuilder = api.GetNewCommandBufferBuilder();
EXPECT_CALL(api, DeviceCreateCommandBufferBuilder(apiDevice))
@@ -383,7 +383,7 @@ TEST_F(WireTests, CallsSkippedAfterBuilderError) {
TEST_F(WireTests, SuccessCallbackOnBuilderSuccess) {
nxtBufferBuilder bufferBuilder = nxtDeviceCreateBufferBuilder(device);
nxtBufferBuilderSetErrorCallback(bufferBuilder, ToMockBuilderErrorCallback, 1, 2);
nxtBuffer buffer = nxtBufferBuilderGetResult(bufferBuilder);
nxtBufferBuilderGetResult(bufferBuilder);
nxtBufferBuilder apiBufferBuilder = api.GetNewBufferBuilder();
EXPECT_CALL(api, DeviceCreateBufferBuilder(apiDevice))
@@ -420,7 +420,7 @@ TEST_F(WireTests, UnknownBuilderErrorStatusCallback) {
{
nxtBufferBuilder bufferBuilder = nxtDeviceCreateBufferBuilder(device);
nxtBufferBuilderSetErrorCallback(bufferBuilder, ToMockBuilderErrorCallback, 3, 4);
nxtBuffer buffer = nxtBufferBuilderGetResult(bufferBuilder);
nxtBufferBuilderGetResult(bufferBuilder);
EXPECT_CALL(*mockBuilderErrorCallback, Call(NXT_BUILDER_ERROR_STATUS_UNKNOWN, _ , 3, 4)).Times(0);
@@ -485,7 +485,7 @@ TEST_F(WireSetCallbackTests, BuilderErrorCallback) {
FlushClient();
// Create an object so that it is a valid case to call the error callback
nxtBuffer buffer = nxtBufferBuilderGetResult(bufferBuilder);
nxtBufferBuilderGetResult(bufferBuilder);
nxtBuffer apiBuffer = api.GetNewBuffer();
EXPECT_CALL(api, BufferBuilderGetResult(apiBufferBuilder))