diff options
| author | 2023-09-06 09:12:58 -0400 | |
|---|---|---|
| committer | 2023-09-06 09:12:58 -0400 | |
| commit | 5e424d791bd98c18a81a36405a419237abcc8116 (patch) | |
| tree | dd83795955a607612d27f324bdb1bfab63de2c38 /src | |
| parent | Merge pull request #11437 from liamwhite/dump-shenanigans (diff) | |
| parent | msvc: set warning level to /W4 globally (diff) | |
| download | yuzu-5e424d791bd98c18a81a36405a419237abcc8116.tar.gz yuzu-5e424d791bd98c18a81a36405a419237abcc8116.tar.xz yuzu-5e424d791bd98c18a81a36405a419237abcc8116.zip | |
Merge pull request #11434 from danilaml/fix-warnings
msvc: set warning level to /W4 globally
Diffstat (limited to 'src')
| -rw-r--r-- | src/CMakeLists.txt | 8 | ||||
| -rw-r--r-- | src/audio_core/audio_event.cpp | 1 | ||||
| -rw-r--r-- | src/common/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/core/hle/kernel/k_capabilities.cpp | 1 | ||||
| -rw-r--r-- | src/core/hle/service/nvdrv/core/nvmap.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/service/ssl/ssl_backend_schannel.cpp | 3 | ||||
| -rw-r--r-- | src/dedicated_room/yuzu_room.cpp | 6 | ||||
| -rw-r--r-- | src/input_common/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/network/room.cpp | 2 | ||||
| -rw-r--r-- | src/shader_recompiler/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/tests/common/ring_buffer.cpp | 2 | ||||
| -rw-r--r-- | src/yuzu/configuration/shared_widget.cpp | 2 | ||||
| -rw-r--r-- | src/yuzu_cmd/yuzu.cpp | 2 |
13 files changed, 17 insertions, 20 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a9f68a8f2..95d54dadc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt | |||
| @@ -24,7 +24,7 @@ if (MSVC) | |||
| 24 | # Ensure that projects build with Unicode support. | 24 | # Ensure that projects build with Unicode support. |
| 25 | add_definitions(-DUNICODE -D_UNICODE) | 25 | add_definitions(-DUNICODE -D_UNICODE) |
| 26 | 26 | ||
| 27 | # /W3 - Level 3 warnings | 27 | # /W4 - Level 4 warnings |
| 28 | # /MP - Multi-threaded compilation | 28 | # /MP - Multi-threaded compilation |
| 29 | # /Zi - Output debugging information | 29 | # /Zi - Output debugging information |
| 30 | # /Zm - Specifies the precompiled header memory allocation limit | 30 | # /Zm - Specifies the precompiled header memory allocation limit |
| @@ -61,7 +61,7 @@ if (MSVC) | |||
| 61 | /external:W0 # Sets the default warning level to 0 for external headers, effectively turning off warnings for external headers | 61 | /external:W0 # Sets the default warning level to 0 for external headers, effectively turning off warnings for external headers |
| 62 | 62 | ||
| 63 | # Warnings | 63 | # Warnings |
| 64 | /W3 | 64 | /W4 |
| 65 | /WX | 65 | /WX |
| 66 | 66 | ||
| 67 | /we4062 # Enumerator 'identifier' in a switch of enum 'enumeration' is not handled | 67 | /we4062 # Enumerator 'identifier' in a switch of enum 'enumeration' is not handled |
| @@ -84,12 +84,16 @@ if (MSVC) | |||
| 84 | 84 | ||
| 85 | /wd4100 # 'identifier': unreferenced formal parameter | 85 | /wd4100 # 'identifier': unreferenced formal parameter |
| 86 | /wd4324 # 'struct_name': structure was padded due to __declspec(align()) | 86 | /wd4324 # 'struct_name': structure was padded due to __declspec(align()) |
| 87 | /wd4201 # nonstandard extension used : nameless struct/union | ||
| 87 | ) | 88 | ) |
| 88 | 89 | ||
| 89 | if (USE_CCACHE OR YUZU_USE_PRECOMPILED_HEADERS) | 90 | if (USE_CCACHE OR YUZU_USE_PRECOMPILED_HEADERS) |
| 90 | # when caching, we need to use /Z7 to downgrade debug info to use an older but more cacheable format | 91 | # when caching, we need to use /Z7 to downgrade debug info to use an older but more cacheable format |
| 91 | # Precompiled headers are deleted if not using /Z7. See https://github.com/nanoant/CMakePCHCompiler/issues/21 | 92 | # Precompiled headers are deleted if not using /Z7. See https://github.com/nanoant/CMakePCHCompiler/issues/21 |
| 92 | add_compile_options(/Z7) | 93 | add_compile_options(/Z7) |
| 94 | # Avoid D9025 warning | ||
| 95 | string(REPLACE "/Zi" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") | ||
| 96 | string(REPLACE "/Zi" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") | ||
| 93 | else() | 97 | else() |
| 94 | add_compile_options(/Zi) | 98 | add_compile_options(/Zi) |
| 95 | endif() | 99 | endif() |
diff --git a/src/audio_core/audio_event.cpp b/src/audio_core/audio_event.cpp index d15568e1f..c23ef0990 100644 --- a/src/audio_core/audio_event.cpp +++ b/src/audio_core/audio_event.cpp | |||
| @@ -20,7 +20,6 @@ size_t Event::GetManagerIndex(const Type type) const { | |||
| 20 | default: | 20 | default: |
| 21 | UNREACHABLE(); | 21 | UNREACHABLE(); |
| 22 | } | 22 | } |
| 23 | return 3; | ||
| 24 | } | 23 | } |
| 25 | 24 | ||
| 26 | void Event::SetAudioEvent(const Type type, const bool signalled) { | 25 | void Event::SetAudioEvent(const Type type, const bool signalled) { |
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index bf97d9ba2..6d2badf76 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt | |||
| @@ -191,8 +191,6 @@ if (MSVC) | |||
| 191 | _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING | 191 | _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING |
| 192 | ) | 192 | ) |
| 193 | target_compile_options(common PRIVATE | 193 | target_compile_options(common PRIVATE |
| 194 | /W4 | ||
| 195 | |||
| 196 | /we4242 # 'identifier': conversion from 'type1' to 'type2', possible loss of data | 194 | /we4242 # 'identifier': conversion from 'type1' to 'type2', possible loss of data |
| 197 | /we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data | 195 | /we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data |
| 198 | /we4800 # Implicit conversion from 'type' to bool. Possible information loss | 196 | /we4800 # Implicit conversion from 'type' to bool. Possible information loss |
diff --git a/src/core/hle/kernel/k_capabilities.cpp b/src/core/hle/kernel/k_capabilities.cpp index 90e4e8fb0..e7da7a21d 100644 --- a/src/core/hle/kernel/k_capabilities.cpp +++ b/src/core/hle/kernel/k_capabilities.cpp | |||
| @@ -156,7 +156,6 @@ Result KCapabilities::MapIoPage_(const u32 cap, KPageTable* page_table) { | |||
| 156 | const u64 phys_addr = MapIoPage{cap}.address.Value() * PageSize; | 156 | const u64 phys_addr = MapIoPage{cap}.address.Value() * PageSize; |
| 157 | const size_t num_pages = 1; | 157 | const size_t num_pages = 1; |
| 158 | const size_t size = num_pages * PageSize; | 158 | const size_t size = num_pages * PageSize; |
| 159 | R_UNLESS(num_pages != 0, ResultInvalidSize); | ||
| 160 | R_UNLESS(phys_addr < phys_addr + size, ResultInvalidAddress); | 159 | R_UNLESS(phys_addr < phys_addr + size, ResultInvalidAddress); |
| 161 | R_UNLESS(((phys_addr + size - 1) & ~PhysicalMapAllowedMask) == 0, ResultInvalidAddress); | 160 | R_UNLESS(((phys_addr + size - 1) & ~PhysicalMapAllowedMask) == 0, ResultInvalidAddress); |
| 162 | 161 | ||
diff --git a/src/core/hle/service/nvdrv/core/nvmap.cpp b/src/core/hle/service/nvdrv/core/nvmap.cpp index a51ca5444..0ca05257e 100644 --- a/src/core/hle/service/nvdrv/core/nvmap.cpp +++ b/src/core/hle/service/nvdrv/core/nvmap.cpp | |||
| @@ -160,8 +160,8 @@ u32 NvMap::PinHandle(NvMap::Handle::Id handle) { | |||
| 160 | u32 address{}; | 160 | u32 address{}; |
| 161 | auto& smmu_allocator = host1x.Allocator(); | 161 | auto& smmu_allocator = host1x.Allocator(); |
| 162 | auto& smmu_memory_manager = host1x.MemoryManager(); | 162 | auto& smmu_memory_manager = host1x.MemoryManager(); |
| 163 | while (!(address = | 163 | while ((address = smmu_allocator.Allocate( |
| 164 | smmu_allocator.Allocate(static_cast<u32>(handle_description->aligned_size)))) { | 164 | static_cast<u32>(handle_description->aligned_size))) == 0) { |
| 165 | // Free handles until the allocation succeeds | 165 | // Free handles until the allocation succeeds |
| 166 | std::scoped_lock queueLock(unmap_queue_lock); | 166 | std::scoped_lock queueLock(unmap_queue_lock); |
| 167 | if (auto freeHandleDesc{unmap_queue.front()}) { | 167 | if (auto freeHandleDesc{unmap_queue.front()}) { |
diff --git a/src/core/hle/service/ssl/ssl_backend_schannel.cpp b/src/core/hle/service/ssl/ssl_backend_schannel.cpp index d834a0c1f..212057cfc 100644 --- a/src/core/hle/service/ssl/ssl_backend_schannel.cpp +++ b/src/core/hle/service/ssl/ssl_backend_schannel.cpp | |||
| @@ -477,7 +477,8 @@ public: | |||
| 477 | return ResultInternalError; | 477 | return ResultInternalError; |
| 478 | } | 478 | } |
| 479 | PCCERT_CONTEXT some_cert = nullptr; | 479 | PCCERT_CONTEXT some_cert = nullptr; |
| 480 | while ((some_cert = CertEnumCertificatesInStore(returned_cert->hCertStore, some_cert))) { | 480 | while ((some_cert = CertEnumCertificatesInStore(returned_cert->hCertStore, some_cert)) != |
| 481 | nullptr) { | ||
| 481 | out_certs->emplace_back(static_cast<u8*>(some_cert->pbCertEncoded), | 482 | out_certs->emplace_back(static_cast<u8*>(some_cert->pbCertEncoded), |
| 482 | static_cast<u8*>(some_cert->pbCertEncoded) + | 483 | static_cast<u8*>(some_cert->pbCertEncoded) + |
| 483 | some_cert->cbCertEncoded); | 484 | some_cert->cbCertEncoded); |
diff --git a/src/dedicated_room/yuzu_room.cpp b/src/dedicated_room/yuzu_room.cpp index d707dabe2..93038f161 100644 --- a/src/dedicated_room/yuzu_room.cpp +++ b/src/dedicated_room/yuzu_room.cpp | |||
| @@ -368,9 +368,9 @@ int main(int argc, char** argv) { | |||
| 368 | if (auto room = network.GetRoom().lock()) { | 368 | if (auto room = network.GetRoom().lock()) { |
| 369 | AnnounceMultiplayerRoom::GameInfo preferred_game_info{.name = preferred_game, | 369 | AnnounceMultiplayerRoom::GameInfo preferred_game_info{.name = preferred_game, |
| 370 | .id = preferred_game_id}; | 370 | .id = preferred_game_id}; |
| 371 | if (!room->Create(room_name, room_description, bind_address, port, password, max_members, | 371 | if (!room->Create(room_name, room_description, bind_address, static_cast<u16>(port), |
| 372 | username, preferred_game_info, std::move(verify_backend), ban_list, | 372 | password, max_members, username, preferred_game_info, |
| 373 | enable_yuzu_mods)) { | 373 | std::move(verify_backend), ban_list, enable_yuzu_mods)) { |
| 374 | LOG_INFO(Network, "Failed to create room: "); | 374 | LOG_INFO(Network, "Failed to create room: "); |
| 375 | return -1; | 375 | return -1; |
| 376 | } | 376 | } |
diff --git a/src/input_common/CMakeLists.txt b/src/input_common/CMakeLists.txt index 322c29065..5c127c8ef 100644 --- a/src/input_common/CMakeLists.txt +++ b/src/input_common/CMakeLists.txt | |||
| @@ -37,8 +37,6 @@ add_library(input_common STATIC | |||
| 37 | 37 | ||
| 38 | if (MSVC) | 38 | if (MSVC) |
| 39 | target_compile_options(input_common PRIVATE | 39 | target_compile_options(input_common PRIVATE |
| 40 | /W4 | ||
| 41 | |||
| 42 | /we4242 # 'identifier': conversion from 'type1' to 'type2', possible loss of data | 40 | /we4242 # 'identifier': conversion from 'type1' to 'type2', possible loss of data |
| 43 | /we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data | 41 | /we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data |
| 44 | /we4800 # Implicit conversion from 'type' to bool. Possible information loss | 42 | /we4800 # Implicit conversion from 'type' to bool. Possible information loss |
diff --git a/src/network/room.cpp b/src/network/room.cpp index e456ea09c..d87db37de 100644 --- a/src/network/room.cpp +++ b/src/network/room.cpp | |||
| @@ -805,7 +805,7 @@ IPv4Address Room::RoomImpl::GenerateFakeIPAddress() { | |||
| 805 | std::uniform_int_distribution<> dis(0x01, 0xFE); // Random byte between 1 and 0xFE | 805 | std::uniform_int_distribution<> dis(0x01, 0xFE); // Random byte between 1 and 0xFE |
| 806 | do { | 806 | do { |
| 807 | for (std::size_t i = 2; i < result_ip.size(); ++i) { | 807 | for (std::size_t i = 2; i < result_ip.size(); ++i) { |
| 808 | result_ip[i] = dis(random_gen); | 808 | result_ip[i] = static_cast<u8>(dis(random_gen)); |
| 809 | } | 809 | } |
| 810 | } while (!IsValidFakeIPAddress(result_ip)); | 810 | } while (!IsValidFakeIPAddress(result_ip)); |
| 811 | 811 | ||
diff --git a/src/shader_recompiler/CMakeLists.txt b/src/shader_recompiler/CMakeLists.txt index 07e75f9d8..83b763447 100644 --- a/src/shader_recompiler/CMakeLists.txt +++ b/src/shader_recompiler/CMakeLists.txt | |||
| @@ -245,8 +245,6 @@ target_link_libraries(shader_recompiler PUBLIC common fmt::fmt sirit) | |||
| 245 | 245 | ||
| 246 | if (MSVC) | 246 | if (MSVC) |
| 247 | target_compile_options(shader_recompiler PRIVATE | 247 | target_compile_options(shader_recompiler PRIVATE |
| 248 | /W4 | ||
| 249 | |||
| 250 | /we4242 # 'identifier': conversion from 'type1' to 'type2', possible loss of data | 248 | /we4242 # 'identifier': conversion from 'type1' to 'type2', possible loss of data |
| 251 | /we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data | 249 | /we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data |
| 252 | /we4800 # Implicit conversion from 'type' to bool. Possible information loss | 250 | /we4800 # Implicit conversion from 'type' to bool. Possible information loss |
diff --git a/src/tests/common/ring_buffer.cpp b/src/tests/common/ring_buffer.cpp index e85f9977b..b6e3bc875 100644 --- a/src/tests/common/ring_buffer.cpp +++ b/src/tests/common/ring_buffer.cpp | |||
| @@ -55,7 +55,7 @@ TEST_CASE("RingBuffer: Basic Tests", "[common]") { | |||
| 55 | // Pushing more values than space available should partially succeed. | 55 | // Pushing more values than space available should partially succeed. |
| 56 | { | 56 | { |
| 57 | std::vector<char> to_push(6); | 57 | std::vector<char> to_push(6); |
| 58 | std::iota(to_push.begin(), to_push.end(), 88); | 58 | std::iota(to_push.begin(), to_push.end(), static_cast<char>(88)); |
| 59 | const std::size_t count = buf.Push(to_push); | 59 | const std::size_t count = buf.Push(to_push); |
| 60 | REQUIRE(count == 3U); | 60 | REQUIRE(count == 3U); |
| 61 | } | 61 | } |
diff --git a/src/yuzu/configuration/shared_widget.cpp b/src/yuzu/configuration/shared_widget.cpp index 7721e58f9..d63093985 100644 --- a/src/yuzu/configuration/shared_widget.cpp +++ b/src/yuzu/configuration/shared_widget.cpp | |||
| @@ -194,7 +194,7 @@ QWidget* Widget::CreateRadioGroup(std::function<std::string()>& serializer, | |||
| 194 | return group; | 194 | return group; |
| 195 | } | 195 | } |
| 196 | 196 | ||
| 197 | const auto get_selected = [=]() -> u32 { | 197 | const auto get_selected = [=]() -> int { |
| 198 | for (const auto& [id, button] : radio_buttons) { | 198 | for (const auto& [id, button] : radio_buttons) { |
| 199 | if (button->isChecked()) { | 199 | if (button->isChecked()) { |
| 200 | return id; | 200 | return id; |
diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp index d0433ffc6..c1695cc6e 100644 --- a/src/yuzu_cmd/yuzu.cpp +++ b/src/yuzu_cmd/yuzu.cpp | |||
| @@ -265,7 +265,7 @@ int main(int argc, char** argv) { | |||
| 265 | password = match[2]; | 265 | password = match[2]; |
| 266 | address = match[3]; | 266 | address = match[3]; |
| 267 | if (!match[4].str().empty()) | 267 | if (!match[4].str().empty()) |
| 268 | port = std::stoi(match[4]); | 268 | port = static_cast<u16>(std::stoi(match[4])); |
| 269 | std::regex nickname_re("^[a-zA-Z0-9._\\- ]+$"); | 269 | std::regex nickname_re("^[a-zA-Z0-9._\\- ]+$"); |
| 270 | if (!std::regex_match(nickname, nickname_re)) { | 270 | if (!std::regex_match(nickname, nickname_re)) { |
| 271 | std::cout | 271 | std::cout |