From 6203e7b853a587fbd70cea2e58b63ae38a71a13e Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Fri, 30 May 2014 14:49:00 -0700 Subject: [PATCH] Add some missing __noreturn attributes. This is more honest, and lets us remove a hack. Change-Id: I309f064743ded5248573ccafc379f78d417db08d --- libc/bionic/clone.cpp | 2 +- libc/bionic/pthread_exit.cpp | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/libc/bionic/clone.cpp b/libc/bionic/clone.cpp index 2c507c4e3..d38a422ea 100644 --- a/libc/bionic/clone.cpp +++ b/libc/bionic/clone.cpp @@ -32,7 +32,7 @@ #include extern "C" pid_t __bionic_clone(uint32_t flags, void* child_stack, int* parent_tid, void* tls, int* child_tid, int (*fn)(void*), void* arg); -extern "C" void __exit(int status); +extern "C" __noreturn void __exit(int status); // Called from the __bionic_clone assembler to call the thread function then exit. extern "C" __LIBC_HIDDEN__ void __bionic_clone_entry(int (*fn)(void*), void* arg) { diff --git a/libc/bionic/pthread_exit.cpp b/libc/bionic/pthread_exit.cpp index de818cdb7..2470c9cb6 100644 --- a/libc/bionic/pthread_exit.cpp +++ b/libc/bionic/pthread_exit.cpp @@ -34,8 +34,8 @@ #include "pthread_internal.h" -extern "C" void _exit_with_stack_teardown(void*, size_t); -extern "C" void __exit(int); +extern "C" __noreturn void _exit_with_stack_teardown(void*, size_t); +extern "C" __noreturn void __exit(int); extern "C" int __set_tid_address(int*); /* CAVEAT: our implementation of pthread_cleanup_push/pop doesn't support C++ exceptions @@ -127,7 +127,4 @@ void pthread_exit(void* return_value) { _exit_with_stack_teardown(stack_base, stack_size); } - - // NOTREACHED, but we told the compiler this function is noreturn, and it doesn't believe us. - abort(); }