1 #include <assert.h>
2 #include <stdlib.h>
3 #include <stdio.h>
4 
5 /*
6  * SPU specific assert: just directly call exit(6), and use fprintf. That
7  * way we do not pull in the abort, signal.o code, nor (the likely
8  * otherwise unused) fiprintf.
9  */
10 
11 /* func can be NULL, in which case no function information is given.  */
12 void
__assert_func(const char * file,int line,const char * func,const char * failedexpr)13 __assert_func (const char *file,
14 	int line,
15 	const char *func,
16 	const char *failedexpr)
17 {
18   fprintf(stderr,
19 	   "assertion \"%s\" failed: file \"%s\", line %d%s%s\n",
20 	   failedexpr, file, line,
21 	   func ? ", function: " : "", func ? func : "");
22   /*
23    * On the SPU, we do not have signaling. Previously, standard newlib
24    * abort code was used. That eventually leads to a kill(SIGABRT), and
25    * for SPU too an exit(SIGABRT). SIGABRT was 6, so just use that value
26    * here.
27    */
28   exit(6);
29   /* NOTREACHED */
30 }
31 
32 void
__assert(const char * file,int line,const char * failedexpr)33 __assert (const char *file,
34 	int line,
35 	const char *failedexpr)
36 {
37    __assert_func (file, line, NULL, failedexpr);
38   /* NOTREACHED */
39 }
40