[tests] Disable clang optimization on the infinite recursion function.

In the recent llvm upstream change, https://reviews.llvm.org/D148269,
clang becomes smarter and will remove the infinite recursion function.
Use the clang attribute __attribute__((optnone)) to disable optimization
for it.

Bug: chromium:1435016
Change-Id: I74e823bf64d0b03d81c0bda7a8338e2fa67033aa
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4456156
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Zequan Wu <zequanwu@google.com>
This commit is contained in:
Zequan Wu 2023-04-21 13:26:17 -04:00 committed by Crashpad LUCI CQ
parent 0e3758bef6
commit 3a6bc8c527

View File

@ -225,6 +225,9 @@ void ValidateDump(const StartHandlerForSelfTestOptions& options,
#if defined(COMPILER_GCC)
__attribute__((noinline))
#endif
#if defined(__clang__)
__attribute__((optnone))
#endif
int RecurseInfinitely(int* ptr) {
int buf[1 << 20];
return *ptr + RecurseInfinitely(buf);