| 1 |
extern int inside_main; |
| 2 |
extern void abort (void); |
| 3 |
#ifdef __OPTIMIZE__ |
| 4 |
#define ABORT_INSIDE_MAIN do { if (inside_main) abort (); } while (0) |
| 5 |
#else |
| 6 |
#define ABORT_INSIDE_MAIN do { } while (0) |
| 7 |
#endif |
| 8 |
|
| 9 |
typedef __INTMAX_TYPE__ intmax_t; |
| 10 |
typedef unsigned __INTMAX_TYPE__ uintmax_t; |
| 11 |
|
| 12 |
__attribute__ ((__noinline__)) |
| 13 |
int |
| 14 |
abs (int x) |
| 15 |
{ |
| 16 |
ABORT_INSIDE_MAIN; |
| 17 |
return x < 0 ? -x : x; |
| 18 |
} |
| 19 |
|
| 20 |
__attribute__ ((__noinline__)) |
| 21 |
long |
| 22 |
labs (long x) |
| 23 |
{ |
| 24 |
ABORT_INSIDE_MAIN; |
| 25 |
return x < 0 ? -x : x; |
| 26 |
} |
| 27 |
|
| 28 |
__attribute__ ((__noinline__)) |
| 29 |
long long |
| 30 |
llabs (long long x) |
| 31 |
{ |
| 32 |
ABORT_INSIDE_MAIN; |
| 33 |
return x < 0 ? -x : x; |
| 34 |
} |
| 35 |
|
| 36 |
__attribute__ ((__noinline__)) |
| 37 |
intmax_t |
| 38 |
imaxabs (intmax_t x) |
| 39 |
{ |
| 40 |
ABORT_INSIDE_MAIN; |
| 41 |
return x < 0 ? -x : x; |
| 42 |
} |
| 43 |
|
| 44 |
__attribute__ ((__noinline__)) |
| 45 |
unsigned int |
| 46 |
uabs (int x) |
| 47 |
{ |
| 48 |
ABORT_INSIDE_MAIN; |
| 49 |
return x < 0 ? -(unsigned int) x : x; |
| 50 |
} |
| 51 |
|
| 52 |
__attribute__ ((__noinline__)) |
| 53 |
unsigned long |
| 54 |
ulabs (long x) |
| 55 |
{ |
| 56 |
ABORT_INSIDE_MAIN; |
| 57 |
return x < 0 ? -(unsigned long) x : x; |
| 58 |
} |
| 59 |
|
| 60 |
__attribute__ ((__noinline__)) |
| 61 |
unsigned long long |
| 62 |
ullabs (long long x) |
| 63 |
{ |
| 64 |
ABORT_INSIDE_MAIN; |
| 65 |
return x < 0 ? -(unsigned long long) x : x; |
| 66 |
} |
| 67 |
|
| 68 |
__attribute__ ((__noinline__)) |
| 69 |
uintmax_t |
| 70 |
uimaxabs (intmax_t x) |
| 71 |
{ |
| 72 |
ABORT_INSIDE_MAIN; |
| 73 |
return x < 0 ? -(uintmax_t) x : x; |
| 74 |
} |