diff options
author | Hai Nguyen <379079+chaoticbob@users.noreply.github.com> | 2022-12-06 13:37:34 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-06 13:37:34 -0500 |
commit | d2a7ebb13afe3196799a32d0be24ca2f5e0b31f0 (patch) | |
tree | b3b09c69b12d54d366a0d8309ec9b3dac81d1051 | |
parent | 03b2a9d399ce2bdb6262313f9dcc453d7befd375 (diff) | |
parent | c2d7d35546a61cce76fc379cc57a05a6428779cd (diff) | |
download | SPIRV-Reflect-d2a7ebb13afe3196799a32d0be24ca2f5e0b31f0.tar.gz |
Merge pull request #161 from KhronosGroup/fix-warnings
Enable warnings and fix them
-rw-r--r-- | .gitignore | 8 | ||||
-rw-r--r-- | BUILD.bazel | 5 | ||||
-rw-r--r-- | common/output_stream.cpp | 14 | ||||
-rw-r--r-- | examples/main_hlsl_resource_types.cpp | 2 | ||||
-rw-r--r-- | examples/sample_spv.h | 2 |
5 files changed, 27 insertions, 4 deletions
@@ -1,2 +1,8 @@ /build* -/bin/*
\ No newline at end of file +/bin/* +bazel-bin +bazel-genfiles +bazel-out +bazel-spirv-reflect +bazel-SPIRV-Reflect +bazel-testlogs diff --git a/BUILD.bazel b/BUILD.bazel index c258aa2..7ac7417 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -17,6 +17,11 @@ exports_files([ COMMON_COPTS = [ "-ffunction-sections", "-fdata-sections", + + "-Werror", + "-Wswitch", + "-Wimplicit-fallthrough", + "-Wunused-variable", ] COMMON_CPPOPTS = COMMON_COPTS + [ diff --git a/common/output_stream.cpp b/common/output_stream.cpp index 0feb2c6..642dec9 100644 --- a/common/output_stream.cpp +++ b/common/output_stream.cpp @@ -101,10 +101,14 @@ std::string ToStringSpvExecutionModel(SpvExecutionModel model) { case SpvExecutionModelClosestHitKHR : return "ClosestHitKHR"; case SpvExecutionModelMissKHR : return "MissKHR"; case SpvExecutionModelCallableKHR : return "CallableKHR"; - + case SpvExecutionModelMax: break; + + default: + break; } + // unhandled SpvExecutionModel enum value return "???"; } @@ -126,7 +130,11 @@ std::string ToStringShaderStage(SpvReflectShaderStageFlagBits stage) { case SPV_REFLECT_SHADER_STAGE_MISS_BIT_KHR : return "MISS"; case SPV_REFLECT_SHADER_STAGE_INTERSECTION_BIT_KHR : return "INTERSECTION"; case SPV_REFLECT_SHADER_STAGE_CALLABLE_BIT_KHR : return "CALLABLE"; + + default: + break; } + // Unhandled SpvReflectShaderStageFlagBits enum value return "???"; } @@ -158,6 +166,9 @@ std::string ToStringSpvStorageClass(SpvStorageClass storage_class) { case SpvStorageClassHostOnlyINTEL : return "HostOnlyINTEL"; case SpvStorageClassMax: break; + + default: + break; } // Special case: this specific "unhandled" value does actually seem to show up. @@ -479,6 +490,7 @@ static std::string ToStringScalarType(const SpvReflectTypeDescription& type) default: break; } + break; } case SpvOpTypeStruct: { return "struct"; diff --git a/examples/main_hlsl_resource_types.cpp b/examples/main_hlsl_resource_types.cpp index 48b4a32..611621f 100644 --- a/examples/main_hlsl_resource_types.cpp +++ b/examples/main_hlsl_resource_types.cpp @@ -70,8 +70,6 @@ void StreamWrite(std::ostream& os, const spv_reflect::ShaderModule& obj) const char* t = " "; const char* tt = " "; const char* ttt = " "; - const char* tttt = " "; - const char* ttttt = " "; StreamWrite(os, obj.GetShaderModule(), ""); diff --git a/examples/sample_spv.h b/examples/sample_spv.h index 49295b3..6aeadb4 100644 --- a/examples/sample_spv.h +++ b/examples/sample_spv.h @@ -1,6 +1,8 @@ #ifndef SAMPLE_SPV_H #define SAMPLE_SPV_H +#include <stdint.h> + /* Source from sample.hlsl Texture2D MyTexture : register(t0, space0); |