Skip to content

Commit

Permalink
Enable implicit fallthrough warning and fix examples of (google#747)
Browse files Browse the repository at this point in the history
Looking at the changes that were needed, I am pretty sure this warning
caught a real bug in the code.

Fixes google#746
  • Loading branch information
zoddicus committed Jun 28, 2019
1 parent 7781794 commit 30d8262
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
10 changes: 9 additions & 1 deletion CMakeLists.txt
Expand Up @@ -33,7 +33,15 @@ option(SHADERC_ENABLE_NV_EXTENSIONS "Enables support of Nvidia-specific extensio
include(GNUInstallDirs)
include(cmake/setup_build.cmake)
include(cmake/utils.cmake)

include(CheckCXXCompilerFlag)

# This flag is not supported on Windows and some older version of GCC
# that our bots use.
unset(COMPILER_SUPPORTS_FALLTHROUGH_WARNING CACHE)
check_cxx_compiler_flag(-Wimplicit-fallthrough COMPILER_SUPPORTS_FALLTHROUGH_WARNING)
if (COMPILER_SUPPORTS_FALLTHROUGH_WARNING)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wimplicit-fallthrough")
endif()

if(SHADERC_ENABLE_NV_EXTENSIONS)
add_definitions(-DNV_EXTENSIONS)
Expand Down
2 changes: 2 additions & 0 deletions libshaderc_spvc/src/spvc.cc
Expand Up @@ -173,8 +173,10 @@ void shaderc_spvc_compile_options_set_msl_platform(
switch (platform) {
case shaderc_spvc_msl_platform_ios:
options->msl.platform = spirv_cross::CompilerMSL::Options::iOS;
break;
case shaderc_spvc_msl_platform_macos:
options->msl.platform = spirv_cross::CompilerMSL::Options::macOS;
break;
}
}

Expand Down
8 changes: 0 additions & 8 deletions spvc/test/known_failures
Expand Up @@ -29,20 +29,12 @@ shaders-msl/frag/image-query-lod.msl22.frag,False
shaders-msl/frag/image-query-lod.msl22.frag,True
shaders-msl/frag/nonuniform-qualifier.msl2.frag,False
shaders-msl/frag/nonuniform-qualifier.msl2.frag,True
shaders-msl/frag/sampler-compare-cascade-gradient.ios.frag,False
shaders-msl/frag/sampler-compare-cascade-gradient.ios.frag,True
shaders-msl/frag/shadow-compare-global-alias.invalid.frag,False
shaders-msl/frag/shadow-compare-global-alias.invalid.frag,True
shaders-msl/frag/subgroup-builtins.msl22.frag,False
shaders-msl/frag/subgroup-builtins.msl22.frag,True
shaders-msl/vert/resource-arrays-leaf.ios.vert,False
shaders-msl/vert/resource-arrays-leaf.ios.vert,True
shaders-msl/vert/resource-arrays.ios.vert,False
shaders-msl/vert/resource-arrays.ios.vert,True
shaders-msl/vert/texture_buffer.texture-buffer-native.msl21.vert,False
shaders-msl/vert/texture_buffer.texture-buffer-native.msl21.vert,True
shaders-msl/vulkan/comp/subgroups.nocompat.invalid.vk.msl21.ios.comp,False
shaders-msl/vulkan/comp/subgroups.nocompat.invalid.vk.msl21.ios.comp,True
shaders-reflection/asm/aliased-entry-point-names.asm.multi,False
shaders-reflection/asm/op-source-glsl-ssbo-1.asm.comp,False
shaders-reflection/asm/op-source-glsl-ssbo-2.asm.comp,False
Expand Down

0 comments on commit 30d8262

Please sign in to comment.