From 4d7405712abfa5b1b197bfbd509c721993bb42d3 Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Thu, 24 Dec 2020 21:01:09 -0300 Subject: [PATCH 1/2] vk_shader_decompiler: Silence warning when compiling without asserts --- src/video_core/renderer_vulkan/vk_shader_decompiler.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp index ca12b37936..72954d0e34 100644 --- a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp +++ b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp @@ -2094,6 +2094,7 @@ private: return OpFOrdGreaterThanEqual(t_bool, operand_1, operand_2); default: UNREACHABLE(); + return v_true; } } From 472e86da85decfa307ef06e3a429d4655466032e Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Thu, 24 Dec 2020 21:01:23 -0300 Subject: [PATCH 2/2] video_core: Enforce C4715 (not all control paths return a value) Most of the time people write code that always returns a value, terminates execution, throws an exception, or uses an unconventional jump primitive. This is not always true when we build without asserts on mainline builds. To avoid introducing undefined behavior on our most used builds, enforce this warning signalling an error and stopping the build from shipping. --- src/video_core/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt index a021d61f5e..90f533730d 100644 --- a/src/video_core/CMakeLists.txt +++ b/src/video_core/CMakeLists.txt @@ -303,6 +303,7 @@ if (MSVC) /we4457 # Declaration of 'identifier' hides function parameter /we4458 # Declaration of 'identifier' hides class member /we4459 # Declaration of 'identifier' hides global declaration + /we4715 # 'function' : not all control paths return a value ) else() target_compile_options(video_core PRIVATE