[libc-commits] [PATCH] D152323: [libc] Silence warning about returning from noreturn function

Joseph Huber via Phabricator via libc-commits libc-commits at lists.llvm.org
Tue Jun 6 17:29:05 PDT 2023


jhuber6 created this revision.
jhuber6 added reviewers: sivachandra, lntue, michaelrj.
Herald added subscribers: libc-commits, tschuett.
Herald added projects: libc-project, All.
jhuber6 requested review of this revision.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D152323

Files:
  libc/src/stdlib/exit.cpp


Index: libc/src/stdlib/exit.cpp
===================================================================
--- libc/src/stdlib/exit.cpp
+++ libc/src/stdlib/exit.cpp
@@ -19,6 +19,7 @@
 LLVM_LIBC_FUNCTION(void, exit, (int status)) {
   internal::call_exit_callbacks();
   quick_exit(status);
+  __builtin_unreachable();
 }
 
 } // namespace __llvm_libc


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152323.529106.patch
Type: text/x-patch
Size: 344 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230607/3480c484/attachment-0001.bin>


More information about the libc-commits mailing list