[libc-commits] [libc] b05c63f - [libc] Silence warning about returning from noreturn function
Joseph Huber via libc-commits
libc-commits at lists.llvm.org
Wed Jun 7 04:23:15 PDT 2023
Author: Joseph Huber
Date: 2023-06-07T06:23:00-05:00
New Revision: b05c63fba66dbb4dbed51797b4aca4706f75803b
URL: https://github.com/llvm/llvm-project/commit/b05c63fba66dbb4dbed51797b4aca4706f75803b
DIFF: https://github.com/llvm/llvm-project/commit/b05c63fba66dbb4dbed51797b4aca4706f75803b.diff
LOG: [libc] Silence warning about returning from noreturn function
The `exit` entrypoint calls into `quick_exit` which is marked noreturn
in some cases. This will cause errors because we then have control flow
externally. This warning can be silenced by using a
`__builtin_unreachable` instruction accordingly.
Reviewed By: sivachandra, lntue
Differential Revision: https://reviews.llvm.org/D152323
Added:
Modified:
libc/src/stdlib/exit.cpp
Removed:
################################################################################
diff --git a/libc/src/stdlib/exit.cpp b/libc/src/stdlib/exit.cpp
index 71f5b1ecbf2c9..6e2f1042738cf 100644
--- a/libc/src/stdlib/exit.cpp
+++ b/libc/src/stdlib/exit.cpp
@@ -19,6 +19,7 @@ void call_exit_callbacks();
LLVM_LIBC_FUNCTION(void, exit, (int status)) {
internal::call_exit_callbacks();
quick_exit(status);
+ __builtin_unreachable();
}
} // namespace __llvm_libc
More information about the libc-commits
mailing list