diff options
| author | 2021-07-05 17:09:23 -0700 | |
|---|---|---|
| committer | 2021-07-05 17:09:23 -0700 | |
| commit | bf50345d4c13e34e69af0070632400b3472a1a11 (patch) | |
| tree | 1af5586d2d416c1a347ea0bfabed30a3a56d51e0 /src | |
| parent | Merge pull request #6556 from Morph1984/default-mii (diff) | |
| parent | CMakeLists: Disable all warnings for external headers (diff) | |
| download | yuzu-bf50345d4c13e34e69af0070632400b3472a1a11.tar.gz yuzu-bf50345d4c13e34e69af0070632400b3472a1a11.tar.xz yuzu-bf50345d4c13e34e69af0070632400b3472a1a11.zip | |
Merge pull request #6537 from Morph1984/warnings
general: Enforce multiple warnings in MSVC
Diffstat (limited to '')
| -rw-r--r-- | src/CMakeLists.txt | 15 | ||||
| -rw-r--r-- | src/core/CMakeLists.txt | 9 | ||||
| -rw-r--r-- | src/input_common/CMakeLists.txt | 16 | ||||
| -rw-r--r-- | src/input_common/gcadapter/gc_adapter.cpp | 7 | ||||
| -rw-r--r-- | src/input_common/udp/protocol.h | 7 | ||||
| -rw-r--r-- | src/video_core/CMakeLists.txt | 5 | ||||
| -rw-r--r-- | src/video_core/command_classes/codecs/codec.h | 8 | ||||
| -rw-r--r-- | src/video_core/command_classes/vic.cpp | 7 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_texture_cache.cpp | 3 | ||||
| -rw-r--r-- | src/video_core/texture_cache/image_base.cpp | 2 | ||||
| -rw-r--r-- | src/video_core/texture_cache/util.cpp | 2 | ||||
| -rw-r--r-- | src/video_core/textures/astc.cpp | 4 |
12 files changed, 27 insertions, 58 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1c3dde31d..65a4922ea 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt | |||
| @@ -45,14 +45,23 @@ if (MSVC) | |||
| 45 | /Zc:inline | 45 | /Zc:inline |
| 46 | /Zc:throwingNew | 46 | /Zc:throwingNew |
| 47 | 47 | ||
| 48 | # External headers diagnostics | ||
| 49 | /experimental:external # Enables the external headers options. This option isn't required in Visual Studio 2019 version 16.10 and later | ||
| 50 | /external:anglebrackets # Treats all headers included by #include <header>, where the header file is enclosed in angle brackets (< >), as external headers | ||
| 51 | /external:W0 # Sets the default warning level to 0 for external headers, effectively turning off warnings for external headers | ||
| 52 | |||
| 48 | # Warnings | 53 | # Warnings |
| 49 | /W3 | 54 | /W3 |
| 50 | /we4062 # enumerator 'identifier' in a switch of enum 'enumeration' is not handled | 55 | /we4018 # 'expression': signed/unsigned mismatch |
| 56 | /we4062 # Enumerator 'identifier' in a switch of enum 'enumeration' is not handled | ||
| 51 | /we4101 # 'identifier': unreferenced local variable | 57 | /we4101 # 'identifier': unreferenced local variable |
| 52 | /we4189 # 'identifier': local variable is initialized but not referenced | 58 | /we4189 # 'identifier': local variable is initialized but not referenced |
| 53 | /we4265 # 'class': class has virtual functions, but destructor is not virtual | 59 | /we4265 # 'class': class has virtual functions, but destructor is not virtual |
| 54 | /we4388 # signed/unsigned mismatch | 60 | /we4267 # 'var': conversion from 'size_t' to 'type', possible loss of data |
| 55 | /we4547 # 'operator' : operator before comma has no effect; expected operator with side-effect | 61 | /we4305 # 'context': truncation from 'type1' to 'type2' |
| 62 | /we4388 # 'expression': signed/unsigned mismatch | ||
| 63 | /we4389 # 'operator': signed/unsigned mismatch | ||
| 64 | /we4547 # 'operator': operator before comma has no effect; expected operator with side-effect | ||
| 56 | /we4549 # 'operator1': operator before comma has no effect; did you intend 'operator2'? | 65 | /we4549 # 'operator1': operator before comma has no effect; did you intend 'operator2'? |
| 57 | /we4555 # Expression has no effect; expected expression with side-effect | 66 | /we4555 # Expression has no effect; expected expression with side-effect |
| 58 | /we4715 # 'function': not all control paths return a value | 67 | /we4715 # 'function': not all control paths return a value |
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 83b5b7676..19b970981 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -654,17 +654,14 @@ endif() | |||
| 654 | 654 | ||
| 655 | if (MSVC) | 655 | if (MSVC) |
| 656 | target_compile_options(core PRIVATE | 656 | target_compile_options(core PRIVATE |
| 657 | /we4018 # 'expression' : signed/unsigned mismatch | 657 | /we4242 # 'identifier': conversion from 'type1' to 'type2', possible loss of data |
| 658 | /we4244 # 'argument' : conversion from 'type1' to 'type2', possible loss of data (floating-point) | 658 | /we4244 # 'conversion': conversion from 'type1' to 'type2', possible loss of data |
| 659 | /we4245 # 'conversion' : conversion from 'type1' to 'type2', signed/unsigned mismatch | 659 | /we4245 # 'conversion': conversion from 'type1' to 'type2', signed/unsigned mismatch |
| 660 | /we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data | 660 | /we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data |
| 661 | /we4267 # 'var' : conversion from 'size_t' to 'type', possible loss of data | ||
| 662 | /we4305 # 'context' : truncation from 'type1' to 'type2' | ||
| 663 | /we4456 # Declaration of 'identifier' hides previous local declaration | 661 | /we4456 # Declaration of 'identifier' hides previous local declaration |
| 664 | /we4457 # Declaration of 'identifier' hides function parameter | 662 | /we4457 # Declaration of 'identifier' hides function parameter |
| 665 | /we4458 # Declaration of 'identifier' hides class member | 663 | /we4458 # Declaration of 'identifier' hides class member |
| 666 | /we4459 # Declaration of 'identifier' hides global declaration | 664 | /we4459 # Declaration of 'identifier' hides global declaration |
| 667 | /we4715 # 'function' : not all control paths return a value | ||
| 668 | ) | 665 | ) |
| 669 | else() | 666 | else() |
| 670 | target_compile_options(core PRIVATE | 667 | target_compile_options(core PRIVATE |
diff --git a/src/input_common/CMakeLists.txt b/src/input_common/CMakeLists.txt index 7c5763f9c..c3423c815 100644 --- a/src/input_common/CMakeLists.txt +++ b/src/input_common/CMakeLists.txt | |||
| @@ -34,18 +34,10 @@ if (MSVC) | |||
| 34 | /W4 | 34 | /W4 |
| 35 | /WX | 35 | /WX |
| 36 | 36 | ||
| 37 | # 'expression' : signed/unsigned mismatch | 37 | /we4242 # 'identifier': conversion from 'type1' to 'type2', possible loss of data |
| 38 | /we4018 | 38 | /we4244 # 'conversion': conversion from 'type1' to 'type2', possible loss of data |
| 39 | # 'argument' : conversion from 'type1' to 'type2', possible loss of data (floating-point) | 39 | /we4245 # 'conversion': conversion from 'type1' to 'type2', signed/unsigned mismatch |
| 40 | /we4244 | 40 | /we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data |
| 41 | # 'conversion' : conversion from 'type1' to 'type2', signed/unsigned mismatch | ||
| 42 | /we4245 | ||
| 43 | # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data | ||
| 44 | /we4254 | ||
| 45 | # 'var' : conversion from 'size_t' to 'type', possible loss of data | ||
| 46 | /we4267 | ||
| 47 | # 'context' : truncation from 'type1' to 'type2' | ||
| 48 | /we4305 | ||
| 49 | ) | 41 | ) |
| 50 | else() | 42 | else() |
| 51 | target_compile_options(input_common PRIVATE | 43 | target_compile_options(input_common PRIVATE |
diff --git a/src/input_common/gcadapter/gc_adapter.cpp b/src/input_common/gcadapter/gc_adapter.cpp index 320f51ee6..a2f1bb67c 100644 --- a/src/input_common/gcadapter/gc_adapter.cpp +++ b/src/input_common/gcadapter/gc_adapter.cpp | |||
| @@ -5,14 +5,7 @@ | |||
| 5 | #include <chrono> | 5 | #include <chrono> |
| 6 | #include <thread> | 6 | #include <thread> |
| 7 | 7 | ||
| 8 | #ifdef _MSC_VER | ||
| 9 | #pragma warning(push) | ||
| 10 | #pragma warning(disable : 4200) // nonstandard extension used : zero-sized array in struct/union | ||
| 11 | #endif | ||
| 12 | #include <libusb.h> | 8 | #include <libusb.h> |
| 13 | #ifdef _MSC_VER | ||
| 14 | #pragma warning(pop) | ||
| 15 | #endif | ||
| 16 | 9 | ||
| 17 | #include "common/logging/log.h" | 10 | #include "common/logging/log.h" |
| 18 | #include "common/param_package.h" | 11 | #include "common/param_package.h" |
diff --git a/src/input_common/udp/protocol.h b/src/input_common/udp/protocol.h index a3d276697..1bdc9209e 100644 --- a/src/input_common/udp/protocol.h +++ b/src/input_common/udp/protocol.h | |||
| @@ -8,14 +8,7 @@ | |||
| 8 | #include <optional> | 8 | #include <optional> |
| 9 | #include <type_traits> | 9 | #include <type_traits> |
| 10 | 10 | ||
| 11 | #ifdef _MSC_VER | ||
| 12 | #pragma warning(push) | ||
| 13 | #pragma warning(disable : 4701) | ||
| 14 | #endif | ||
| 15 | #include <boost/crc.hpp> | 11 | #include <boost/crc.hpp> |
| 16 | #ifdef _MSC_VER | ||
| 17 | #pragma warning(pop) | ||
| 18 | #endif | ||
| 19 | 12 | ||
| 20 | #include "common/bit_field.h" | 13 | #include "common/bit_field.h" |
| 21 | #include "common/swap.h" | 14 | #include "common/swap.h" |
diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt index e31eb30c0..e4de55f4d 100644 --- a/src/video_core/CMakeLists.txt +++ b/src/video_core/CMakeLists.txt | |||
| @@ -292,13 +292,12 @@ endif() | |||
| 292 | 292 | ||
| 293 | if (MSVC) | 293 | if (MSVC) |
| 294 | target_compile_options(video_core PRIVATE | 294 | target_compile_options(video_core PRIVATE |
| 295 | /we4267 # 'var' : conversion from 'size_t' to 'type', possible loss of data | 295 | /we4242 # 'identifier': conversion from 'type1' to 'type2', possible loss of data |
| 296 | /we4244 # 'var' : conversion from integer to 'type', possible loss of data | 296 | /we4244 # 'conversion': conversion from 'type1' to 'type2', possible loss of data |
| 297 | /we4456 # Declaration of 'identifier' hides previous local declaration | 297 | /we4456 # Declaration of 'identifier' hides previous local declaration |
| 298 | /we4457 # Declaration of 'identifier' hides function parameter | 298 | /we4457 # Declaration of 'identifier' hides function parameter |
| 299 | /we4458 # Declaration of 'identifier' hides class member | 299 | /we4458 # Declaration of 'identifier' hides class member |
| 300 | /we4459 # Declaration of 'identifier' hides global declaration | 300 | /we4459 # Declaration of 'identifier' hides global declaration |
| 301 | /we4715 # 'function' : not all control paths return a value | ||
| 302 | ) | 301 | ) |
| 303 | else() | 302 | else() |
| 304 | target_compile_options(video_core PRIVATE | 303 | target_compile_options(video_core PRIVATE |
diff --git a/src/video_core/command_classes/codecs/codec.h b/src/video_core/command_classes/codecs/codec.h index f2aef1699..96c823c76 100644 --- a/src/video_core/command_classes/codecs/codec.h +++ b/src/video_core/command_classes/codecs/codec.h | |||
| @@ -14,18 +14,10 @@ extern "C" { | |||
| 14 | #pragma GCC diagnostic push | 14 | #pragma GCC diagnostic push |
| 15 | #pragma GCC diagnostic ignored "-Wconversion" | 15 | #pragma GCC diagnostic ignored "-Wconversion" |
| 16 | #endif | 16 | #endif |
| 17 | #ifdef _MSC_VER | ||
| 18 | #pragma warning(push) | ||
| 19 | #pragma warning(disable : 4242) // conversion from 'type' to 'type', possible loss of data | ||
| 20 | #pragma warning(disable : 4244) // conversion from 'type' to 'type', possible loss of data | ||
| 21 | #endif | ||
| 22 | #include <libavcodec/avcodec.h> | 17 | #include <libavcodec/avcodec.h> |
| 23 | #if defined(__GNUC__) || defined(__clang__) | 18 | #if defined(__GNUC__) || defined(__clang__) |
| 24 | #pragma GCC diagnostic pop | 19 | #pragma GCC diagnostic pop |
| 25 | #endif | 20 | #endif |
| 26 | #ifdef _MSC_VER | ||
| 27 | #pragma warning(pop) | ||
| 28 | #endif | ||
| 29 | } | 21 | } |
| 30 | 22 | ||
| 31 | namespace Tegra { | 23 | namespace Tegra { |
diff --git a/src/video_core/command_classes/vic.cpp b/src/video_core/command_classes/vic.cpp index 5faf8c0f1..ff3db0aee 100644 --- a/src/video_core/command_classes/vic.cpp +++ b/src/video_core/command_classes/vic.cpp | |||
| @@ -9,17 +9,10 @@ extern "C" { | |||
| 9 | #pragma GCC diagnostic push | 9 | #pragma GCC diagnostic push |
| 10 | #pragma GCC diagnostic ignored "-Wconversion" | 10 | #pragma GCC diagnostic ignored "-Wconversion" |
| 11 | #endif | 11 | #endif |
| 12 | #ifdef _MSC_VER | ||
| 13 | #pragma warning(disable : 4244) // conversion from 'type' to 'type', possible loss of data | ||
| 14 | #pragma warning(push) | ||
| 15 | #endif | ||
| 16 | #include <libswscale/swscale.h> | 12 | #include <libswscale/swscale.h> |
| 17 | #if defined(__GNUC__) || defined(__clang__) | 13 | #if defined(__GNUC__) || defined(__clang__) |
| 18 | #pragma GCC diagnostic pop | 14 | #pragma GCC diagnostic pop |
| 19 | #endif | 15 | #endif |
| 20 | #ifdef _MSC_VER | ||
| 21 | #pragma warning(pop) | ||
| 22 | #endif | ||
| 23 | } | 16 | } |
| 24 | 17 | ||
| 25 | #include "common/assert.h" | 18 | #include "common/assert.h" |
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp index a2c1599f7..ff0f03e99 100644 --- a/src/video_core/renderer_opengl/gl_texture_cache.cpp +++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp | |||
| @@ -327,7 +327,8 @@ void ApplySwizzle(GLuint handle, PixelFormat format, std::array<SwizzleSource, 4 | |||
| 327 | if (format_info.is_compressed) { | 327 | if (format_info.is_compressed) { |
| 328 | return false; | 328 | return false; |
| 329 | } | 329 | } |
| 330 | if (std::ranges::find(ACCELERATED_FORMATS, internal_format) == ACCELERATED_FORMATS.end()) { | 330 | if (std::ranges::find(ACCELERATED_FORMATS, static_cast<int>(internal_format)) == |
| 331 | ACCELERATED_FORMATS.end()) { | ||
| 331 | return false; | 332 | return false; |
| 332 | } | 333 | } |
| 333 | if (format_info.compatibility_by_size) { | 334 | if (format_info.compatibility_by_size) { |
diff --git a/src/video_core/texture_cache/image_base.cpp b/src/video_core/texture_cache/image_base.cpp index ad69d32d1..f22358c90 100644 --- a/src/video_core/texture_cache/image_base.cpp +++ b/src/video_core/texture_cache/image_base.cpp | |||
| @@ -82,7 +82,7 @@ std::optional<SubresourceBase> ImageBase::TryFindBase(GPUVAddr other_addr) const | |||
| 82 | if (info.type != ImageType::e3D) { | 82 | if (info.type != ImageType::e3D) { |
| 83 | const auto [layer, mip_offset] = LayerMipOffset(diff, info.layer_stride); | 83 | const auto [layer, mip_offset] = LayerMipOffset(diff, info.layer_stride); |
| 84 | const auto end = mip_level_offsets.begin() + info.resources.levels; | 84 | const auto end = mip_level_offsets.begin() + info.resources.levels; |
| 85 | const auto it = std::find(mip_level_offsets.begin(), end, mip_offset); | 85 | const auto it = std::find(mip_level_offsets.begin(), end, static_cast<u32>(mip_offset)); |
| 86 | if (layer > info.resources.layers || it == end) { | 86 | if (layer > info.resources.layers || it == end) { |
| 87 | return std::nullopt; | 87 | return std::nullopt; |
| 88 | } | 88 | } |
diff --git a/src/video_core/texture_cache/util.cpp b/src/video_core/texture_cache/util.cpp index 4efe042b6..20794fa32 100644 --- a/src/video_core/texture_cache/util.cpp +++ b/src/video_core/texture_cache/util.cpp | |||
| @@ -394,7 +394,7 @@ template <u32 GOB_EXTENT> | |||
| 394 | const s32 mip_offset = diff % layer_stride; | 394 | const s32 mip_offset = diff % layer_stride; |
| 395 | const std::array offsets = CalculateMipLevelOffsets(new_info); | 395 | const std::array offsets = CalculateMipLevelOffsets(new_info); |
| 396 | const auto end = offsets.begin() + new_info.resources.levels; | 396 | const auto end = offsets.begin() + new_info.resources.levels; |
| 397 | const auto it = std::find(offsets.begin(), end, mip_offset); | 397 | const auto it = std::find(offsets.begin(), end, static_cast<u32>(mip_offset)); |
| 398 | if (it == end) { | 398 | if (it == end) { |
| 399 | // Mipmap is not aligned to any valid size | 399 | // Mipmap is not aligned to any valid size |
| 400 | return std::nullopt; | 400 | return std::nullopt; |
diff --git a/src/video_core/textures/astc.cpp b/src/video_core/textures/astc.cpp index 7b756ba41..3ab500760 100644 --- a/src/video_core/textures/astc.cpp +++ b/src/video_core/textures/astc.cpp | |||
| @@ -1365,8 +1365,8 @@ static void DecompressBlock(std::span<const u8, 16> inBuf, const u32 blockWidth, | |||
| 1365 | // each partition. | 1365 | // each partition. |
| 1366 | 1366 | ||
| 1367 | // Determine partitions, partition index, and color endpoint modes | 1367 | // Determine partitions, partition index, and color endpoint modes |
| 1368 | s32 planeIdx = -1; | 1368 | u32 planeIdx{UINT32_MAX}; |
| 1369 | u32 partitionIndex; | 1369 | u32 partitionIndex{}; |
| 1370 | u32 colorEndpointMode[4] = {0, 0, 0, 0}; | 1370 | u32 colorEndpointMode[4] = {0, 0, 0, 0}; |
| 1371 | 1371 | ||
| 1372 | // Define color data. | 1372 | // Define color data. |