[tests] Make the infinite recursion actually recurse with clang

On gLinux, tests don't pass in the default configuration (empty GN
args), because the infinite recursion test doesn't crash
anymore. Locally, forcing the function to stay out of line is sufficient
to fix it. This is inherently brittle, and may need to be revisited at a
later point.

Change-Id: Ica88a0b3a2151af95c64c490b5afcdc05cf3be4e
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4020321
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Benoit Lize <lizeb@chromium.org>
This commit is contained in:
Benoît Lizé 2022-11-10 19:39:08 +01:00 committed by Crashpad LUCI CQ
parent 9ca1fb932e
commit a91f197a26

View File

@ -213,6 +213,12 @@ void ValidateDump(const StartHandlerForSelfTestOptions& options,
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winfinite-recursion"
// Clang (masquerading as gcc) is too smart, and removes the recursion
// otherwise. May need to change if either clang or another compiler becomes
// smarter.
#if defined(COMPILER_GCC)
__attribute__((noinline))
#endif
int RecurseInfinitely(int* ptr) {
int buf[1 << 20];
return *ptr + RecurseInfinitely(buf);