From 099a80dd762afd01d69fa0422f3ff21a06dcf111 Mon Sep 17 00:00:00 2001 From: Jamie Madill Date: Mon, 18 Mar 2019 11:38:53 -0400 Subject: [PATCH] Suppress MSVC warning about unused variable. One variable was only used in an 'assert' call. MSVC flagged this as unused in Release. Suppress the warning and also add a static cast to void so the variable becomes referenced. --- BUILD.gn | 1 + SPIRV/SpvPostProcess.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/BUILD.gn b/BUILD.gn index 3e061acb..c3e0670b 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -152,6 +152,7 @@ source_set("glslang_sources") { if (is_win && !is_clang) { cflags = [ "/wd4018", # signed/unsigned mismatch + "/wd4189", # local variable is initialized but not referenced ] } diff --git a/SPIRV/SpvPostProcess.cpp b/SPIRV/SpvPostProcess.cpp index 05f54558..80471cae 100644 --- a/SPIRV/SpvPostProcess.cpp +++ b/SPIRV/SpvPostProcess.cpp @@ -258,6 +258,7 @@ void Builder::postProcess(Instruction& inst) assert(inst.getNumOperands() >= 3); unsigned int memoryAccess = inst.getImmediateOperand((inst.getOpCode() == OpStore) ? 2 : 1); assert(memoryAccess & MemoryAccessAlignedMask); + static_cast(memoryAccess); // Compute the index of the alignment operand. int alignmentIdx = 2; if (inst.getOpCode() == OpStore)