GCC/llvm: Enable a lot more warnings, error on missing return value

This commit is contained in:
Henrik Rydgård 2024-11-04 11:45:47 +01:00
parent ca94c0215f
commit 294584c608
2 changed files with 5 additions and 1 deletions

View File

@ -382,6 +382,10 @@ if(NOT MSVC)
# NEON optimizations in libpng17 seem to cause PNG load errors, see #14485. # NEON optimizations in libpng17 seem to cause PNG load errors, see #14485.
add_definitions(-DPNG_ARM_NEON_OPT=0) 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) if(ANDROID)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++17") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++17")
endif() endif()

View File

@ -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 // 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. // 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; 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; origRatio = frameRatio;
} else { } else {
origRatio *= aspectRatioAdjust; origRatio *= aspectRatioAdjust;