From 294584c608dd98796644a9a3ff69a076c1da460b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Mon, 4 Nov 2024 11:45:47 +0100 Subject: [PATCH] GCC/llvm: Enable a lot more warnings, error on missing return value --- CMakeLists.txt | 4 ++++ GPU/Common/PresentationCommon.cpp | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e538d4e2b7..a3553172dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -382,6 +382,10 @@ if(NOT MSVC) # NEON optimizations in libpng17 seem to cause PNG load errors, see #14485. add_definitions(-DPNG_ARM_NEON_OPT=0) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror=return-type -Wno-unused-function -Wno-sign-compare -Wno-unused-but-set-variable -Wno-reorder -Wno-unknown-pragmas -Wno-unused-value -Wno-unused-variable") + # This one is very useful but has many false positives. + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-class-memaccess") + if(ANDROID) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++17") endif() diff --git a/GPU/Common/PresentationCommon.cpp b/GPU/Common/PresentationCommon.cpp index 178b2b10ea..f41686511b 100644 --- a/GPU/Common/PresentationCommon.cpp +++ b/GPU/Common/PresentationCommon.cpp @@ -91,7 +91,7 @@ void CalculateDisplayOutputRect(FRect *rc, float origW, float origH, const FRect // Automatically set aspect ratio to match the display, IF the rotation matches the output display ratio! Otherwise, just // sets standard aspect ratio because actually stretching will just look silly. bool globalRotated = g_display.rotation == DisplayRotation::ROTATE_90 || g_display.rotation == DisplayRotation::ROTATE_270; - if (rotated == g_display.dp_yres > g_display.dp_xres) { + if (rotated == (g_display.dp_yres > g_display.dp_xres)) { origRatio = frameRatio; } else { origRatio *= aspectRatioAdjust;