From c11e95f6e5c68d4e0ead61e71f9d358cacec4501 Mon Sep 17 00:00:00 2001 From: Mark Adams Date: Mon, 26 Oct 2015 12:38:46 -0400 Subject: [PATCH] Various build fixes when using newer GCC versions with warnings enabled Encountered with GCC-4.7.3 in a build environment where warnings are enabled and treated as errors. --- SPIRV/disassemble.cpp | 10 +++++----- glslang/MachineIndependent/SymbolTable.cpp | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/SPIRV/disassemble.cpp b/SPIRV/disassemble.cpp index da09120..9df69e9 100755 --- a/SPIRV/disassemble.cpp +++ b/SPIRV/disassemble.cpp @@ -316,7 +316,7 @@ void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode, nextNestedControl = 0; } } else if (opCode == OpExtInstImport) { - idDescriptor[resultId] = (char*)(&stream[word]); + idDescriptor[resultId] = (const char*)(&stream[word]); } else { if (idDescriptor[resultId].size() == 0) { @@ -391,7 +391,7 @@ void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode, disassembleIds(1); // Get names for printing "(XXX)" for readability, *after* this id if (opCode == OpName) - idDescriptor[stream[word - 1]] = (char*)(&stream[word]); + idDescriptor[stream[word - 1]] = (const char*)(&stream[word]); break; case OperandOptionalId: case OperandVariableIds: @@ -404,8 +404,8 @@ void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode, return; case OperandOptionalLiteral: case OperandVariableLiterals: - if (opCode == OpDecorate && stream[word - 1] == DecorationBuiltIn || - opCode == OpMemberDecorate && stream[word - 1] == DecorationBuiltIn) { + if ((opCode == OpDecorate && stream[word - 1] == DecorationBuiltIn) || + (opCode == OpMemberDecorate && stream[word - 1] == DecorationBuiltIn)) { out << BuiltInString(stream[word++]); --numOperands; ++op; @@ -442,7 +442,7 @@ void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode, disassembleImmediates(1); if (opCode == OpExtInst) { ExtInstSet extInstSet = GLSL450Inst; - if (0 == memcmp("OpenCL", (char*)(idDescriptor[stream[word-2]].c_str()), 6)) { + if (0 == memcmp("OpenCL", (const char*)(idDescriptor[stream[word-2]].c_str()), 6)) { extInstSet = OpenCLExtInst; } unsigned entrypoint = stream[word - 1]; diff --git a/glslang/MachineIndependent/SymbolTable.cpp b/glslang/MachineIndependent/SymbolTable.cpp index d389356..c0be925 100644 --- a/glslang/MachineIndependent/SymbolTable.cpp +++ b/glslang/MachineIndependent/SymbolTable.cpp @@ -242,7 +242,7 @@ TVariable::TVariable(const TVariable& copyOf) : TSymbol(copyOf) userType = copyOf.userType; numExtensions = 0; extensions = 0; - if (copyOf.numExtensions > 0) + if (copyOf.numExtensions != 0) setExtensions(copyOf.numExtensions, copyOf.extensions); if (! copyOf.unionArray.empty()) { -- 2.7.4