From a91f197a26d38b0219241b722a8c3e1c39dabbad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Liz=C3=A9?= Date: Thu, 10 Nov 2022 19:39:08 +0100 Subject: [PATCH] [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 Commit-Queue: Benoit Lize --- client/crashpad_client_linux_test.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/client/crashpad_client_linux_test.cc b/client/crashpad_client_linux_test.cc index 813d31e6..0d47ed0b 100644 --- a/client/crashpad_client_linux_test.cc +++ b/client/crashpad_client_linux_test.cc @@ -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);