summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Lioncash2019-11-12 03:01:29 -0500
committerGravatar Lioncash2019-11-12 07:06:25 -0500
commit96d677bef04c1a3c7a06d475686302287115351c (patch)
treee3dd330897d55a29d26674cb1fb19ebe43c24bac /src
parentMerge pull request #3085 from bunnei/web-token-b64 (diff)
downloadyuzu-96d677bef04c1a3c7a06d475686302287115351c.tar.gz
yuzu-96d677bef04c1a3c7a06d475686302287115351c.tar.xz
yuzu-96d677bef04c1a3c7a06d475686302287115351c.zip
CMakeLists: Make most implicit type conversion warnings errors on MSVC
Quite frequently there have been cases where code has been merged into the core that produces warning. In order to prevent this from occurring, we can make the compiler flag these cases and allow our CI to flag down any code that would generate these warnings. This is beneficial given silent conversions from signed/unsigned can result in logic bugs. This forces one writing changes to be explicit about when signedness conversions are desirable, rather than leaving it up to readers' interpretation. Currently the codebase isn't in a state where it will build successfully with this change applied, but this will be addressed in subsequent follow-up changes. This set of changes will focus on making it build properly with these changes for MSVC as a starting point for basic coverage.
Diffstat (limited to 'src')
-rw-r--r--src/core/CMakeLists.txt17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 4f6a87b0a..f2e774a6b 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -522,6 +522,23 @@ add_library(core STATIC
522 tools/freezer.h 522 tools/freezer.h
523) 523)
524 524
525if (MSVC)
526 target_compile_options(core PRIVATE
527 # 'expression' : signed/unsigned mismatch
528 /we4018
529 # 'argument' : conversion from 'type1' to 'type2', possible loss of data (floating-point)
530 /we4244
531 # 'conversion' : conversion from 'type1' to 'type2', signed/unsigned mismatch
532 /we4245
533 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data
534 /we4254
535 # 'var' : conversion from 'size_t' to 'type', possible loss of data
536 /we4267
537 # 'context' : truncation from 'type1' to 'type2'
538 /we4305
539 )
540endif()
541
525create_target_directory_groups(core) 542create_target_directory_groups(core)
526 543
527target_link_libraries(core PUBLIC common PRIVATE audio_core video_core) 544target_link_libraries(core PUBLIC common PRIVATE audio_core video_core)