summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Morph2022-05-26 20:08:21 -0400
committerGravatar Morph2022-06-13 18:19:23 -0400
commitefc89c032b18d149308a1f8c1a371f503edb91d1 (patch)
treedafbdc3a20ad07f24ee92c4583e3e84ecf01ab02 /src
parentexternals: microprofile: Eliminate variable shadowing (diff)
downloadyuzu-efc89c032b18d149308a1f8c1a371f503edb91d1.tar.gz
yuzu-efc89c032b18d149308a1f8c1a371f503edb91d1.tar.xz
yuzu-efc89c032b18d149308a1f8c1a371f503edb91d1.zip
CMakeLists: Make variable shadowing a compile-time error
Now that the entire project is free of variable shadowing, we can enforce this as a compile time error to prevent any further introduction of this logic bug.
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt5
-rw-r--r--src/audio_core/CMakeLists.txt2
-rw-r--r--src/core/CMakeLists.txt5
-rw-r--r--src/input_common/CMakeLists.txt1
-rw-r--r--src/shader_recompiler/CMakeLists.txt3
-rw-r--r--src/video_core/CMakeLists.txt5
6 files changed, 5 insertions, 16 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 9182dbfd4..39d038493 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -65,6 +65,10 @@ if (MSVC)
65 /we4305 # 'context': truncation from 'type1' to 'type2' 65 /we4305 # 'context': truncation from 'type1' to 'type2'
66 /we4388 # 'expression': signed/unsigned mismatch 66 /we4388 # 'expression': signed/unsigned mismatch
67 /we4389 # 'operator': signed/unsigned mismatch 67 /we4389 # 'operator': signed/unsigned mismatch
68 /we4456 # Declaration of 'identifier' hides previous local declaration
69 /we4457 # Declaration of 'identifier' hides function parameter
70 /we4458 # Declaration of 'identifier' hides class member
71 /we4459 # Declaration of 'identifier' hides global declaration
68 /we4505 # 'function': unreferenced local function has been removed 72 /we4505 # 'function': unreferenced local function has been removed
69 /we4547 # 'operator': operator before comma has no effect; expected operator with side-effect 73 /we4547 # 'operator': operator before comma has no effect; expected operator with side-effect
70 /we4549 # 'operator1': operator before comma has no effect; did you intend 'operator2'? 74 /we4549 # 'operator1': operator before comma has no effect; did you intend 'operator2'?
@@ -92,6 +96,7 @@ else()
92 -Werror=missing-declarations 96 -Werror=missing-declarations
93 -Werror=missing-field-initializers 97 -Werror=missing-field-initializers
94 -Werror=reorder 98 -Werror=reorder
99 -Werror=shadow
95 -Werror=sign-compare 100 -Werror=sign-compare
96 -Werror=switch 101 -Werror=switch
97 -Werror=uninitialized 102 -Werror=uninitialized
diff --git a/src/audio_core/CMakeLists.txt b/src/audio_core/CMakeLists.txt
index e553b8203..75ae085ea 100644
--- a/src/audio_core/CMakeLists.txt
+++ b/src/audio_core/CMakeLists.txt
@@ -49,9 +49,7 @@ if (NOT MSVC)
49 target_compile_options(audio_core PRIVATE 49 target_compile_options(audio_core PRIVATE
50 -Werror=conversion 50 -Werror=conversion
51 -Werror=ignored-qualifiers 51 -Werror=ignored-qualifiers
52 -Werror=shadow
53 -Werror=unused-parameter 52 -Werror=unused-parameter
54 -Werror=unused-variable
55 53
56 $<$<CXX_COMPILER_ID:GNU>:-Werror=unused-but-set-parameter> 54 $<$<CXX_COMPILER_ID:GNU>:-Werror=unused-but-set-parameter>
57 $<$<CXX_COMPILER_ID:GNU>:-Werror=unused-but-set-variable> 55 $<$<CXX_COMPILER_ID:GNU>:-Werror=unused-but-set-variable>
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 2bd720f08..670410e75 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -743,16 +743,11 @@ if (MSVC)
743 /we4244 # 'conversion': conversion from 'type1' to 'type2', possible loss of data 743 /we4244 # 'conversion': conversion from 'type1' to 'type2', possible loss of data
744 /we4245 # 'conversion': conversion from 'type1' to 'type2', signed/unsigned mismatch 744 /we4245 # 'conversion': conversion from 'type1' to 'type2', signed/unsigned mismatch
745 /we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data 745 /we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data
746 /we4456 # Declaration of 'identifier' hides previous local declaration
747 /we4457 # Declaration of 'identifier' hides function parameter
748 /we4458 # Declaration of 'identifier' hides class member
749 /we4459 # Declaration of 'identifier' hides global declaration
750 ) 746 )
751else() 747else()
752 target_compile_options(core PRIVATE 748 target_compile_options(core PRIVATE
753 -Werror=conversion 749 -Werror=conversion
754 -Werror=ignored-qualifiers 750 -Werror=ignored-qualifiers
755 -Werror=shadow
756 751
757 $<$<CXX_COMPILER_ID:GNU>:-Werror=class-memaccess> 752 $<$<CXX_COMPILER_ID:GNU>:-Werror=class-memaccess>
758 $<$<CXX_COMPILER_ID:GNU>:-Werror=unused-but-set-parameter> 753 $<$<CXX_COMPILER_ID:GNU>:-Werror=unused-but-set-parameter>
diff --git a/src/input_common/CMakeLists.txt b/src/input_common/CMakeLists.txt
index d4fa69a77..48e799cf5 100644
--- a/src/input_common/CMakeLists.txt
+++ b/src/input_common/CMakeLists.txt
@@ -44,7 +44,6 @@ else()
44 -Werror 44 -Werror
45 -Werror=conversion 45 -Werror=conversion
46 -Werror=ignored-qualifiers 46 -Werror=ignored-qualifiers
47 -Werror=shadow
48 $<$<CXX_COMPILER_ID:GNU>:-Werror=unused-but-set-parameter> 47 $<$<CXX_COMPILER_ID:GNU>:-Werror=unused-but-set-parameter>
49 $<$<CXX_COMPILER_ID:GNU>:-Werror=unused-but-set-variable> 48 $<$<CXX_COMPILER_ID:GNU>:-Werror=unused-but-set-variable>
50 -Werror=unused-variable 49 -Werror=unused-variable
diff --git a/src/shader_recompiler/CMakeLists.txt b/src/shader_recompiler/CMakeLists.txt
index 4c76ce1ea..ae1dbe619 100644
--- a/src/shader_recompiler/CMakeLists.txt
+++ b/src/shader_recompiler/CMakeLists.txt
@@ -253,9 +253,6 @@ else()
253 -Werror 253 -Werror
254 -Werror=conversion 254 -Werror=conversion
255 -Werror=ignored-qualifiers 255 -Werror=ignored-qualifiers
256 -Werror=implicit-fallthrough
257 -Werror=shadow
258 -Werror=sign-compare
259 $<$<CXX_COMPILER_ID:GNU>:-Werror=unused-but-set-parameter> 256 $<$<CXX_COMPILER_ID:GNU>:-Werror=unused-but-set-parameter>
260 $<$<CXX_COMPILER_ID:GNU>:-Werror=unused-but-set-variable> 257 $<$<CXX_COMPILER_ID:GNU>:-Werror=unused-but-set-variable>
261 -Werror=unused-variable 258 -Werror=unused-variable
diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt
index 256695804..14de7bc89 100644
--- a/src/video_core/CMakeLists.txt
+++ b/src/video_core/CMakeLists.txt
@@ -258,10 +258,6 @@ if (MSVC)
258 target_compile_options(video_core PRIVATE 258 target_compile_options(video_core PRIVATE
259 /we4242 # 'identifier': conversion from 'type1' to 'type2', possible loss of data 259 /we4242 # 'identifier': conversion from 'type1' to 'type2', possible loss of data
260 /we4244 # 'conversion': conversion from 'type1' to 'type2', possible loss of data 260 /we4244 # 'conversion': conversion from 'type1' to 'type2', possible loss of data
261 /we4456 # Declaration of 'identifier' hides previous local declaration
262 /we4457 # Declaration of 'identifier' hides function parameter
263 /we4458 # Declaration of 'identifier' hides class member
264 /we4459 # Declaration of 'identifier' hides global declaration
265 ) 261 )
266else() 262else()
267 target_compile_options(video_core PRIVATE 263 target_compile_options(video_core PRIVATE
@@ -269,7 +265,6 @@ else()
269 -Wno-error=sign-conversion 265 -Wno-error=sign-conversion
270 -Werror=pessimizing-move 266 -Werror=pessimizing-move
271 -Werror=redundant-move 267 -Werror=redundant-move
272 -Werror=shadow
273 -Werror=type-limits 268 -Werror=type-limits
274 269
275 $<$<CXX_COMPILER_ID:GNU>:-Werror=class-memaccess> 270 $<$<CXX_COMPILER_ID:GNU>:-Werror=class-memaccess>