mirror of
https://github.com/RGBCube/serenity
synced 2025-05-19 23:35:08 +00:00
Tests: Fix new GCC 12 warnings
This commit is contained in:
parent
cccc001ded
commit
699bd9afc6
3 changed files with 10 additions and 9 deletions
|
@ -22,17 +22,13 @@ static void signal_handler(int)
|
||||||
_exit(0);
|
_exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __clang__
|
#pragma GCC diagnostic push
|
||||||
# pragma clang diagnostic push
|
#pragma GCC diagnostic ignored "-Winfinite-recursion"
|
||||||
# pragma clang diagnostic ignored "-Winfinite-recursion"
|
|
||||||
#endif
|
|
||||||
static size_t infinite_recursion(size_t input)
|
static size_t infinite_recursion(size_t input)
|
||||||
{
|
{
|
||||||
return infinite_recursion(input) + 1;
|
return infinite_recursion(input) + 1;
|
||||||
}
|
}
|
||||||
#ifdef __clang__
|
#pragma GCC diagnostic pop
|
||||||
# pragma clang diagnostic pop
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// This test can only pass with sigaltstack correctly enabled, as otherwise the SIGSEGV signal handler itself would also fault due to the overflown stack.
|
// This test can only pass with sigaltstack correctly enabled, as otherwise the SIGSEGV signal handler itself would also fault due to the overflown stack.
|
||||||
TEST_CASE(success_case)
|
TEST_CASE(success_case)
|
||||||
|
|
|
@ -139,7 +139,10 @@ int main(int argc, char** argv)
|
||||||
return Crash::Failure::UnexpectedError;
|
return Crash::Failure::UnexpectedError;
|
||||||
|
|
||||||
free(uninitialized_memory);
|
free(uninitialized_memory);
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wuse-after-free"
|
||||||
[[maybe_unused]] volatile auto x = uninitialized_memory[4][0];
|
[[maybe_unused]] volatile auto x = uninitialized_memory[4][0];
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
return Crash::Failure::DidNotCrash;
|
return Crash::Failure::DidNotCrash;
|
||||||
}).run(run_type);
|
}).run(run_type);
|
||||||
}
|
}
|
||||||
|
@ -161,8 +164,11 @@ int main(int argc, char** argv)
|
||||||
if (!uninitialized_memory)
|
if (!uninitialized_memory)
|
||||||
return Crash::Failure::UnexpectedError;
|
return Crash::Failure::UnexpectedError;
|
||||||
|
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wuse-after-free"
|
||||||
free(uninitialized_memory);
|
free(uninitialized_memory);
|
||||||
uninitialized_memory[4][0] = 1;
|
uninitialized_memory[4][0] = 1;
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
return Crash::Failure::DidNotCrash;
|
return Crash::Failure::DidNotCrash;
|
||||||
}).run(run_type);
|
}).run(run_type);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,8 +21,7 @@ bool volatile signal_was_delivered = false;
|
||||||
|
|
||||||
static void signal_handler(int sig, siginfo_t* sig_info, void* u_context)
|
static void signal_handler(int sig, siginfo_t* sig_info, void* u_context)
|
||||||
{
|
{
|
||||||
int x;
|
stack_ptr = __builtin_frame_address(0);
|
||||||
stack_ptr = &x;
|
|
||||||
signal_was_delivered = true;
|
signal_was_delivered = true;
|
||||||
|
|
||||||
saved_signal = sig;
|
saved_signal = sig;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue