kernel: ignore overflow warnings in teams.cpp and threads.cpp

GCC's overflow checker gives a warning about the potential that the atomic
functions called in teams.cpp and threads.cpp will write to a null-pointer.
In this case, it is safe to assume that the values will never be null,
therefore these warnings can be safely ignored.

Relates to/fixes #17734

Change-Id: I777ff96f2812ed7d3ba57a46cad89ef6994cb08f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6643
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
This commit is contained in:
Niels Sascha Reedijk 2023-06-24 18:26:18 +01:00 committed by Adrien Destugues
parent 4ed150bdc3
commit 1f2e9ca260
2 changed files with 12 additions and 0 deletions

View File

@ -4363,8 +4363,14 @@ _user_exit_team(status_t returnValue)
// Stop the thread, if the team is being debugged and that has been
// requested.
// Note: GCC 13 marks the following call as potentially overflowing, since it thinks team may
// be `nullptr`. This cannot be the case in reality, therefore ignore this specific
// error.
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstringop-overflow"
if ((atomic_get(&team->debug_info.flags) & B_TEAM_DEBUG_PREVENT_EXIT) != 0)
user_debug_stop_thread();
#pragma GCC diagnostic pop
// Send this thread a SIGKILL. This makes sure the thread will not return to
// userland. The signal handling code forwards the signal to the main

View File

@ -3796,7 +3796,13 @@ _user_block_thread(uint32 flags, bigtime_t timeout)
return waitStatus;
// nope, so wait
// Note: GCC 13 marks the following call as potentially overflowing, since it thinks `thread`
// may be `nullptr`. This cannot be the case in reality, therefore ignore this specific
// error.
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstringop-overflow"
thread_prepare_to_block(thread, flags, THREAD_BLOCK_TYPE_USER, NULL);
#pragma GCC diagnostic pop
threadLocker.Unlock();