Browse Source

[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..
sh3port
Christophe Lyon 3 years ago
committed by Richard Earnshaw
parent
commit
8a7536e91d
  1. 2
      libgloss/arm/_exit.c
  2. 8
      libgloss/arm/_kill.c
  3. 13
      newlib/libc/sys/arm/syscalls.c

2
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

8
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();
}

13
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

Loading…
Cancel
Save