From 9a07ed53ebe4e27ef1a14e0469037cab9fb7b1e7 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 16 May 2021 01:46:30 -0400 Subject: core: Make variable shadowing a compile-time error Now that we have most of core free of shadowing, we can enable the warning as an error to catch anything that may be remaining and also eliminate this class of logic bug entirely. --- src/core/CMakeLists.txt | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'src/core/CMakeLists.txt') diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 83da30418..efb851f5a 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -651,20 +651,17 @@ endif() if (MSVC) target_compile_options(core PRIVATE - # 'expression' : signed/unsigned mismatch - /we4018 - # 'argument' : conversion from 'type1' to 'type2', possible loss of data (floating-point) - /we4244 - # 'conversion' : conversion from 'type1' to 'type2', signed/unsigned mismatch - /we4245 - # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data - /we4254 - # 'var' : conversion from 'size_t' to 'type', possible loss of data - /we4267 - # 'context' : truncation from 'type1' to 'type2' - /we4305 - # 'function' : not all control paths return a value - /we4715 + /we4018 # 'expression' : signed/unsigned mismatch + /we4244 # 'argument' : conversion from 'type1' to 'type2', possible loss of data (floating-point) + /we4245 # 'conversion' : conversion from 'type1' to 'type2', signed/unsigned mismatch + /we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data + /we4267 # 'var' : conversion from 'size_t' to 'type', possible loss of data + /we4305 # 'context' : truncation from 'type1' to 'type2' + /we4456 # Declaration of 'identifier' hides previous local declaration + /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(core PRIVATE @@ -672,6 +669,7 @@ else() -Werror=ignored-qualifiers -Werror=implicit-fallthrough -Werror=sign-compare + -Werror=shadow $<$:-Werror=class-memaccess> $<$:-Werror=unused-but-set-parameter> -- cgit v1.2.3