libc/libgloss/arm/_kill.c
Christophe Lyon 8a7536e91d [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..
2018-10-08 14:35:43 +01:00

55 lines
867 B
C

#include <_ansi.h>
#include <signal.h>
#include "swi.h"
int _kill (int, int) __attribute__((__noreturn__));
int
_kill (int pid, int sig)
{
(void) pid; (void) sig;
#ifdef ARM_RDI_MONITOR
/* Note: The pid argument is thrown away. */
int block[2];
block[1] = sig;
int insn;
#if SEMIHOST_V2
if (_has_ext_exit_extended ())
{
insn = AngelSWI_Reason_ReportExceptionExtended;
}
else
#endif
{
insn = AngelSWI_Reason_ReportException;
}
switch (sig)
{
case SIGABRT:
{
block[0] = ADP_Stopped_RunTimeError;
break;
}
default:
{
block[0] = ADP_Stopped_ApplicationExit;
break;
}
}
#if SEMIHOST_V2
if (_has_ext_exit_extended ())
do_AngelSWI (insn, block);
else
#endif
do_AngelSWI (insn, (void*)block[0]);
#else
asm ("swi %a0" :: "i" (SWI_Exit));
#endif
__builtin_unreachable();
}