summaryrefslogtreecommitdiff
path: root/Tests
diff options
context:
space:
mode:
authorDaniel Bertalan <dani@danielbertalan.dev>2022-05-07 17:49:44 +0200
committerAndreas Kling <kling@serenityos.org>2022-05-12 13:12:37 +0200
commit699bd9afc6bd5e441caf08a188d5ed25656bde3c (patch)
tree637b2c7fa8c27b5c0e1f1ffb7320dac236346196 /Tests
parentcccc001dedc32c1f377b7093b79c6b19b667e7e9 (diff)
downloadserenity-699bd9afc6bd5e441caf08a188d5ed25656bde3c.zip
Tests: Fix new GCC 12 warnings
Diffstat (limited to 'Tests')
-rw-r--r--Tests/Kernel/TestSigAltStack.cpp10
-rw-r--r--Tests/Kernel/crash.cpp6
-rw-r--r--Tests/Kernel/siginfo-example.cpp3
3 files changed, 10 insertions, 9 deletions
diff --git a/Tests/Kernel/TestSigAltStack.cpp b/Tests/Kernel/TestSigAltStack.cpp
index 0bcc64d191..1c4aa66901 100644
--- a/Tests/Kernel/TestSigAltStack.cpp
+++ b/Tests/Kernel/TestSigAltStack.cpp
@@ -22,17 +22,13 @@ static void signal_handler(int)
_exit(0);
}
-#ifdef __clang__
-# pragma clang diagnostic push
-# pragma clang diagnostic ignored "-Winfinite-recursion"
-#endif
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Winfinite-recursion"
static size_t infinite_recursion(size_t input)
{
return infinite_recursion(input) + 1;
}
-#ifdef __clang__
-# pragma clang diagnostic pop
-#endif
+#pragma GCC diagnostic pop
// 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)
diff --git a/Tests/Kernel/crash.cpp b/Tests/Kernel/crash.cpp
index 0372e164fe..d245e44a4e 100644
--- a/Tests/Kernel/crash.cpp
+++ b/Tests/Kernel/crash.cpp
@@ -139,7 +139,10 @@ int main(int argc, char** argv)
return Crash::Failure::UnexpectedError;
free(uninitialized_memory);
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wuse-after-free"
[[maybe_unused]] volatile auto x = uninitialized_memory[4][0];
+#pragma GCC diagnostic pop
return Crash::Failure::DidNotCrash;
}).run(run_type);
}
@@ -161,8 +164,11 @@ int main(int argc, char** argv)
if (!uninitialized_memory)
return Crash::Failure::UnexpectedError;
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wuse-after-free"
free(uninitialized_memory);
uninitialized_memory[4][0] = 1;
+#pragma GCC diagnostic pop
return Crash::Failure::DidNotCrash;
}).run(run_type);
}
diff --git a/Tests/Kernel/siginfo-example.cpp b/Tests/Kernel/siginfo-example.cpp
index 6495570eca..9a96e64a8d 100644
--- a/Tests/Kernel/siginfo-example.cpp
+++ b/Tests/Kernel/siginfo-example.cpp
@@ -21,8 +21,7 @@ bool volatile signal_was_delivered = false;
static void signal_handler(int sig, siginfo_t* sig_info, void* u_context)
{
- int x;
- stack_ptr = &x;
+ stack_ptr = __builtin_frame_address(0);
signal_was_delivered = true;
saved_signal = sig;