From a5ade51363f93311b673aad5173930845e7b4e46 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 11 Jul 2015 14:45:57 +0200 Subject: [PATCH] Fix most clang warnings - member initializing order in some constructors - missing default branches in switch-case - uninitialized variable if switch-case default (uncritical because program would exit) - && and || brace warnings in if() --- SPIRV/SpvBuilder.cpp | 2 +- SPIRV/doc.h | 6 +++--- glslang/MachineIndependent/Initialize.cpp | 2 +- glslang/MachineIndependent/Scan.cpp | 2 +- glslang/MachineIndependent/Versions.cpp | 2 ++ glslang/MachineIndependent/preprocessor/PpContext.h | 2 +- 6 files changed, 9 insertions(+), 7 deletions(-) diff --git a/SPIRV/SpvBuilder.cpp b/SPIRV/SpvBuilder.cpp index f90dd70..73e9d01 100644 --- a/SPIRV/SpvBuilder.cpp +++ b/SPIRV/SpvBuilder.cpp @@ -1175,7 +1175,7 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool proj, co Id Builder::createTextureQueryCall(Op opCode, const TextureParameters& parameters) { // Figure out the result type - Id resultType; + Id resultType = NoType; switch (opCode) { case OpTextureQuerySize: case OpTextureQuerySizeLod: diff --git a/SPIRV/doc.h b/SPIRV/doc.h index ce4d972..9295af0 100644 --- a/SPIRV/doc.h +++ b/SPIRV/doc.h @@ -213,10 +213,10 @@ public: class InstructionParameters { public: InstructionParameters() : - typePresent(true), // most normal, only exceptions have to be spelled out - resultPresent(true), // most normal, only exceptions have to be spelled out opDesc(0), - opClass(OpClassMisc) + opClass(OpClassMisc), + typePresent(true), // most normal, only exceptions have to be spelled out + resultPresent(true) // most normal, only exceptions have to be spelled out { } void setResultAndType(bool r, bool t) diff --git a/glslang/MachineIndependent/Initialize.cpp b/glslang/MachineIndependent/Initialize.cpp index 396a9f6..52e1989 100644 --- a/glslang/MachineIndependent/Initialize.cpp +++ b/glslang/MachineIndependent/Initialize.cpp @@ -1054,7 +1054,7 @@ void TBuiltIns::initialize(int version, EProfile profile) // //============================================================================ bool esBarrier = (profile == EEsProfile && version >= 310); - if (profile != EEsProfile && version >= 150 || esBarrier) + if ((profile != EEsProfile && version >= 150) || esBarrier) stageBuiltins[EShLangTessControl].append( "void barrier();" ); diff --git a/glslang/MachineIndependent/Scan.cpp b/glslang/MachineIndependent/Scan.cpp index bccd8ad..32afd71 100644 --- a/glslang/MachineIndependent/Scan.cpp +++ b/glslang/MachineIndependent/Scan.cpp @@ -685,7 +685,7 @@ int TScanContext::tokenizeIdentifier() return keyword; case ATOMIC_UINT: - if (parseContext.profile == EEsProfile && parseContext.version >= 310 || + if ((parseContext.profile == EEsProfile && parseContext.version >= 310) || parseContext.extensionsTurnedOn(1, &E_GL_ARB_shader_atomic_counters)) return keyword; return es30ReservedFromGLSL(420); diff --git a/glslang/MachineIndependent/Versions.cpp b/glslang/MachineIndependent/Versions.cpp index 19ec575..24184f6 100644 --- a/glslang/MachineIndependent/Versions.cpp +++ b/glslang/MachineIndependent/Versions.cpp @@ -457,6 +457,8 @@ bool TParseContext::extensionsTurnedOn(int numExtensions, const char* const exte case EBhRequire: case EBhWarn: return true; + default: + break; } } diff --git a/glslang/MachineIndependent/preprocessor/PpContext.h b/glslang/MachineIndependent/preprocessor/PpContext.h index 2fc5369..b0086ff 100644 --- a/glslang/MachineIndependent/preprocessor/PpContext.h +++ b/glslang/MachineIndependent/preprocessor/PpContext.h @@ -86,7 +86,7 @@ namespace glslang { class TPpToken { public: - TPpToken() : token(0), ival(0), space(false), dval(0.0), atom(0) + TPpToken() : token(0), space(false), ival(0), dval(0.0), atom(0) { loc.init(); name[0] = 0; -- 2.7.4