public inbox for newlib-cvs@sourceware.org help / color / mirror / Atom feed
From: Richard Earnshaw <rearnsha@sourceware.org> To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] [ARM] Make _kill() a noreturn function. Date: Mon, 08 Oct 2018 13:36:00 -0000 [thread overview] Message-ID: <20181008133644.55383.qmail@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=8a7536e91d7dc361adf9b66c4e14e9596c0b0ccc commit 8a7536e91d7dc361adf9b66c4e14e9596c0b0ccc Author: Christophe Lyon <christophe.lyon@linaro.org> Date: Mon Oct 1 15:52:42 2018 +0000 [ARM] Make _kill() a noreturn function. AngelSWI_Reason_ReportException does not return accoring to the ARM documentation, so it is valid to mark _kill() as noreturn. This way, the compiler does not warn about _exit() returning a value despite being noreturn. 2018-10-01 Christophe Lyon <christophe.lyon@linaro.org> * libgloss/arm/_exit.c (_exit): Declare _kill() as noreturn. * libgloss/arm/_exit.c (_kill): Likewise. Remove the return statements. * newlib/libc/sys/arm/syscalls.c (_kill): Likewise.. Diff: --- libgloss/arm/_exit.c | 2 +- libgloss/arm/_kill.c | 8 +++++--- newlib/libc/sys/arm/syscalls.c | 13 ++++++++----- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/libgloss/arm/_exit.c b/libgloss/arm/_exit.c index ca2d21c..4a071df 100644 --- a/libgloss/arm/_exit.c +++ b/libgloss/arm/_exit.c @@ -1,6 +1,6 @@ #include <_ansi.h> -int _kill (int, int); +int _kill (int, int) __attribute__((__noreturn__)); void _exit (int); void diff --git a/libgloss/arm/_kill.c b/libgloss/arm/_kill.c index 278ded7..34a6ffd 100644 --- a/libgloss/arm/_kill.c +++ b/libgloss/arm/_kill.c @@ -2,7 +2,7 @@ #include <signal.h> #include "swi.h" -int _kill (int, int); +int _kill (int, int) __attribute__((__noreturn__)); int _kill (int pid, int sig) @@ -41,12 +41,14 @@ _kill (int pid, int sig) #if SEMIHOST_V2 if (_has_ext_exit_extended ()) - return do_AngelSWI (insn, block); + do_AngelSWI (insn, block); else #endif - return do_AngelSWI (insn, (void*)block[0]); + do_AngelSWI (insn, (void*)block[0]); #else asm ("swi %a0" :: "i" (SWI_Exit)); #endif + + __builtin_unreachable(); } diff --git a/newlib/libc/sys/arm/syscalls.c b/newlib/libc/sys/arm/syscalls.c index d2a65cb..87ddca7 100644 --- a/newlib/libc/sys/arm/syscalls.c +++ b/newlib/libc/sys/arm/syscalls.c @@ -30,7 +30,7 @@ int _stat (const char *, struct stat *); int _fstat (int, struct stat *); void * _sbrk (ptrdiff_t); pid_t _getpid (void); -int _kill (int, int); +int _kill (int, int) __attribute__((__noreturn__)); void _exit (int); int _close (int); int _swiclose (int); @@ -432,15 +432,18 @@ _kill (int pid, int sig) /* Note: The pid argument is thrown away. */ switch (sig) { case SIGABRT: - return do_AngelSWI (AngelSWI_Reason_ReportException, - (void *) ADP_Stopped_RunTimeError); + do_AngelSWI (AngelSWI_Reason_ReportException, + (void *) ADP_Stopped_RunTimeError); + __builtin_unreachable(); default: - return do_AngelSWI (AngelSWI_Reason_ReportException, - (void *) ADP_Stopped_ApplicationExit); + do_AngelSWI (AngelSWI_Reason_ReportException, + (void *) ADP_Stopped_ApplicationExit); } #else asm ("swi %a0" :: "i" (SWI_Exit)); #endif + + __builtin_unreachable(); } void
reply other threads:[~2018-10-08 13:36 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20181008133644.55383.qmail@sourceware.org \ --to=rearnsha@sourceware.org \ --cc=newlib-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).