summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar comex2023-08-20 13:05:49 -0700
committerGravatar Liam2023-08-25 19:22:31 -0400
commit91eb5afd0b7c75213763d379638bac6d53548557 (patch)
tree3574c1aa4075518bbf3b0f96c262f16ae0f5a0c5
parentMerge pull request #11377 from BenjaminHalko/reverse-slider-input (diff)
downloadyuzu-91eb5afd0b7c75213763d379638bac6d53548557.tar.gz
yuzu-91eb5afd0b7c75213763d379638bac6d53548557.tar.xz
yuzu-91eb5afd0b7c75213763d379638bac6d53548557.zip
Warnings cleanup for GCC 13 and Clang 16
Note: For GCC there are still a huge number of `-Warray-bounds` warnings coming from `externals/dynarmic`. I could have added a workaround in `externals/CMakeLists.txt` similar to what this PR does for other externals, but given Dynarmic's close affiliation with Yuzu, it would be better to fix it upstream. Besides that, on my machine, this makes the build warning-free except for some warnings from glslangValidator and AutoMoc. Details: - Disable some warnings in externals. - Disable `-Wnullability-completeness`, which is a Clang warning triggered by the Vulkan SDK where if any pointers in the header are marked _Nullable, it wants all pointers to be marked _Nullable or _Nonnull. Most of them are, but some aren't. Who knows why. - `src/web_service/verify_user_jwt.cpp`: Disable another warning when including `jwt.hpp`. - `src/input_common/input_poller.cpp`: Add missing `override` specifiers. - src/common/swap.h: Remove redundant `operator&`. In general, this file declares three overloads of each operator. Using `+` as an example, the overloads are: - a member function for `swapped_t + integer` - a member function for `swapped_t + swapped_t` - a free function for `integer + swapped_t` But for `operator&`, there was an additional free function for `swapped_t + integer`, which was redundant with the member function. This caused a GCC warning saying "ISO C++ says that these are ambiguous".
-rw-r--r--externals/CMakeLists.txt10
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/common/swap.h5
-rw-r--r--src/input_common/input_poller.cpp10
-rw-r--r--src/web_service/verify_user_jwt.cpp1
5 files changed, 17 insertions, 10 deletions
diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt
index 1f7cd598e..3a389485b 100644
--- a/externals/CMakeLists.txt
+++ b/externals/CMakeLists.txt
@@ -42,6 +42,9 @@ endif()
42# mbedtls 42# mbedtls
43add_subdirectory(mbedtls) 43add_subdirectory(mbedtls)
44target_include_directories(mbedtls PUBLIC ./mbedtls/include) 44target_include_directories(mbedtls PUBLIC ./mbedtls/include)
45target_compile_options(mbedcrypto PRIVATE
46 $<$<CXX_COMPILER_ID:Clang>:-Wno-unused-but-set-variable>
47 $<$<CXX_COMPILER_ID:Clang>:-Wno-string-concatenation>)
45 48
46# MicroProfile 49# MicroProfile
47add_library(microprofile INTERFACE) 50add_library(microprofile INTERFACE)
@@ -94,6 +97,10 @@ if (ENABLE_CUBEB AND NOT TARGET cubeb::cubeb)
94 set(BUILD_TOOLS OFF) 97 set(BUILD_TOOLS OFF)
95 add_subdirectory(cubeb) 98 add_subdirectory(cubeb)
96 add_library(cubeb::cubeb ALIAS cubeb) 99 add_library(cubeb::cubeb ALIAS cubeb)
100 if (NOT MSVC)
101 target_compile_options(speex PRIVATE -Wno-sign-compare)
102 target_compile_options(cubeb PRIVATE -Wno-implicit-const-int-float-conversion)
103 endif()
97endif() 104endif()
98 105
99# DiscordRPC 106# DiscordRPC
@@ -151,6 +158,9 @@ endif()
151if (NOT TARGET LLVM::Demangle) 158if (NOT TARGET LLVM::Demangle)
152 add_library(demangle demangle/ItaniumDemangle.cpp) 159 add_library(demangle demangle/ItaniumDemangle.cpp)
153 target_include_directories(demangle PUBLIC ./demangle) 160 target_include_directories(demangle PUBLIC ./demangle)
161 if (NOT MSVC)
162 target_compile_options(demangle PRIVATE -Wno-deprecated-declarations) # std::is_pod
163 endif()
154 add_library(LLVM::Demangle ALIAS demangle) 164 add_library(LLVM::Demangle ALIAS demangle)
155endif() 165endif()
156 166
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 7bb88c8ea..015b98d60 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -117,6 +117,7 @@ else()
117 117
118 $<$<CXX_COMPILER_ID:Clang>:-Wno-braced-scalar-init> 118 $<$<CXX_COMPILER_ID:Clang>:-Wno-braced-scalar-init>
119 $<$<CXX_COMPILER_ID:Clang>:-Wno-unused-private-field> 119 $<$<CXX_COMPILER_ID:Clang>:-Wno-unused-private-field>
120 $<$<CXX_COMPILER_ID:Clang>:-Wno-nullability-completeness>
120 $<$<CXX_COMPILER_ID:Clang>:-Werror=shadow-uncaptured-local> 121 $<$<CXX_COMPILER_ID:Clang>:-Werror=shadow-uncaptured-local>
121 $<$<CXX_COMPILER_ID:Clang>:-Werror=implicit-fallthrough> 122 $<$<CXX_COMPILER_ID:Clang>:-Werror=implicit-fallthrough>
122 $<$<CXX_COMPILER_ID:Clang>:-Werror=type-limits> 123 $<$<CXX_COMPILER_ID:Clang>:-Werror=type-limits>
diff --git a/src/common/swap.h b/src/common/swap.h
index 085baaf9a..fde343e45 100644
--- a/src/common/swap.h
+++ b/src/common/swap.h
@@ -460,11 +460,6 @@ S operator&(const S& i, const swap_struct_t<T, F> v) {
460 return i & v.swap(); 460 return i & v.swap();
461} 461}
462 462
463template <typename S, typename T, typename F>
464S operator&(const swap_struct_t<T, F> v, const S& i) {
465 return static_cast<S>(v.swap() & i);
466}
467
468// Comparison 463// Comparison
469template <typename S, typename T, typename F> 464template <typename S, typename T, typename F>
470bool operator<(const S& p, const swap_struct_t<T, F> v) { 465bool operator<(const S& p, const swap_struct_t<T, F> v) {
diff --git a/src/input_common/input_poller.cpp b/src/input_common/input_poller.cpp
index 870e76ab0..188e862d7 100644
--- a/src/input_common/input_poller.cpp
+++ b/src/input_common/input_poller.cpp
@@ -835,15 +835,15 @@ public:
835 return input_engine->SupportsNfc(identifier); 835 return input_engine->SupportsNfc(identifier);
836 } 836 }
837 837
838 Common::Input::NfcState StartNfcPolling() { 838 Common::Input::NfcState StartNfcPolling() override {
839 return input_engine->StartNfcPolling(identifier); 839 return input_engine->StartNfcPolling(identifier);
840 } 840 }
841 841
842 Common::Input::NfcState StopNfcPolling() { 842 Common::Input::NfcState StopNfcPolling() override {
843 return input_engine->StopNfcPolling(identifier); 843 return input_engine->StopNfcPolling(identifier);
844 } 844 }
845 845
846 Common::Input::NfcState ReadAmiiboData(std::vector<u8>& out_data) { 846 Common::Input::NfcState ReadAmiiboData(std::vector<u8>& out_data) override {
847 return input_engine->ReadAmiiboData(identifier, out_data); 847 return input_engine->ReadAmiiboData(identifier, out_data);
848 } 848 }
849 849
@@ -852,11 +852,11 @@ public:
852 } 852 }
853 853
854 Common::Input::NfcState ReadMifareData(const Common::Input::MifareRequest& request, 854 Common::Input::NfcState ReadMifareData(const Common::Input::MifareRequest& request,
855 Common::Input::MifareRequest& out_data) { 855 Common::Input::MifareRequest& out_data) override {
856 return input_engine->ReadMifareData(identifier, request, out_data); 856 return input_engine->ReadMifareData(identifier, request, out_data);
857 } 857 }
858 858
859 Common::Input::NfcState WriteMifareData(const Common::Input::MifareRequest& request) { 859 Common::Input::NfcState WriteMifareData(const Common::Input::MifareRequest& request) override {
860 return input_engine->WriteMifareData(identifier, request); 860 return input_engine->WriteMifareData(identifier, request);
861 } 861 }
862 862
diff --git a/src/web_service/verify_user_jwt.cpp b/src/web_service/verify_user_jwt.cpp
index 129eb1968..f88f67620 100644
--- a/src/web_service/verify_user_jwt.cpp
+++ b/src/web_service/verify_user_jwt.cpp
@@ -4,6 +4,7 @@
4#if defined(__GNUC__) || defined(__clang__) 4#if defined(__GNUC__) || defined(__clang__)
5#pragma GCC diagnostic push 5#pragma GCC diagnostic push
6#pragma GCC diagnostic ignored "-Wimplicit-fallthrough" 6#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
7#pragma GCC diagnostic ignored "-Wdeprecated-declarations" // for deprecated OpenSSL functions
7#endif 8#endif
8#include <jwt/jwt.hpp> 9#include <jwt/jwt.hpp>
9#if defined(__GNUC__) || defined(__clang__) 10#if defined(__GNUC__) || defined(__clang__)