Commit 5660321a authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

[platform] Mark OS::ExitProcess as [[noreturn]]

Just as OS::Abort, OS::ExitProcess never returns. This is a minor
cleanup which is not expected to reduce binary size considerably, since
we do not call this function often. It is just nice to annotate it
correctly.
On windows, the {TerminateProcess} call is known to not return if
called on the current process. Add an {UNREACHABLE} to enforce this.

R=mlippautz@chromium.org

Bug: v8:11074
Change-Id: I5c079fc459685c65f932404ce536ea28ad188073
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2536634Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71210}
parent f9af014b
......@@ -502,11 +502,15 @@ int OS::GetCurrentThreadId() {
}
void OS::ExitProcess(int exit_code) {
// Use TerminateProcess avoid races between isolate threads and
// Use TerminateProcess to avoid races between isolate threads and
// static destructors.
fflush(stdout);
fflush(stderr);
TerminateProcess(GetCurrentProcess(), exit_code);
// Termination the current process does not return. {TerminateProcess} is not
// marked [[noreturn]] though, since it can also be used to terminate another
// process.
UNREACHABLE();
}
// ----------------------------------------------------------------------------
......
......@@ -263,7 +263,7 @@ class V8_BASE_EXPORT OS {
static void AdjustSchedulingParams();
static void ExitProcess(int exit_code);
[[noreturn]] static void ExitProcess(int exit_code);
private:
// These classes use the private memory management API below.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment