Skip to content

Commit

Permalink
Merge pull request #19580 from hrydgard/error-on-missing-return
Browse files Browse the repository at this point in the history
GCC/llvm: Enable a lot more warnings, error on missing return value
  • Loading branch information
hrydgard authored Nov 4, 2024
2 parents ca94c02 + cd6d4db commit 6bbb0bc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion GPU/Common/PresentationCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions ios/main.mm
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ bool System_MakeRequest(SystemRequestType type, int requestId, const std::string
dispatch_async(dispatch_get_main_queue(), ^{
[(AppDelegate *)[[UIApplication sharedApplication] delegate] restart:param1.c_str()];
});
break;
return true;

case SystemRequestType::EXIT_APP:
// NOTE: on iOS, this is considered a crash and not a valid way to exit.
Expand Down Expand Up @@ -508,8 +508,9 @@ bool System_MakeRequest(SystemRequestType type, int requestId, const std::string
});
return true;
default:
return false;
break;
}
return false;
}

void System_Toast(std::string_view text) {}
Expand Down

0 comments on commit 6bbb0bc

Please sign in to comment.