1 /*
2  * (C) Copyright 2002-2016 Diomidis Spinellis
3  *
4  * This file is part of CScout.
5  *
6  * CScout is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * CScout is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with CScout.  If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 /*
21  * Generic gcc workarounds.
22  * Note that CScout has builtin support for __atribute__.
23  */
24 #ifdef __cplusplus
25 #define __EXCEPTIONS
26 #endif
27 
28 /* GCC __builtin_* funtions and misc */
29 #define asm __asm__
30 #define __alignof__(x) (sizeof(x) & 0xf)
31 #define _Alignof(x) (sizeof(x) & 0xf)
32 #define __attribute__(x)
33 #define __builtin_add_overflow(x,y,z) ((x), (y), (z), 1)
34 #define __builtin_alloca_with_align_and_max (x,y,z) ((x), (y), (z), 1)
35 #define __builtin_alloca_with_align (x,y) ((x), (y), 1)
36 #define __builtin_alloca(x) ((x), 1)
37 #define __builtin_assume_aligned(x,y,...) ((x), (y), 1)
38 #define __builtin_bswap16(x) (x)
39 #define __builtin_bswap32(x) (x)
40 #define __builtin_bswap64(x) (x)
41 #define __builtin_call_with_static_chain(x,y) ((x), (y), 0)
42 #define __builtin_choose_expr(a,v,c) ((a) ? (v) : (c))
43 #define __builtin___clear_cache(x,y) ((x), (y))
44 #define __builtin_clrsbll(x) (x)
45 #define __builtin_clrsbl(x) (x)
46 #define __builtin_clrsb(x) (x)
47 #define __builtin_clz(z) (z)
48 #define __builtin_complex(x,y) ((x), (y))
49 #define __builtin_constant_p(_x) ((_x), 0)
50 #define __builtin_constant(x) ((x), 0)
51 #define __builtin_ctzll(x) ((x),1)
52 #define __builtin_ctzl(x) ((x),1)
53 #define __builtin_ctz(z) ((z),1)
54 #define __builtin_expect_with_probability(x,y) 1
55 #define __builtin_expect(_x, _v) ((_v), (_x))
56 #define __builtin_extend_pointer(x) ((x), 1)
57 #define __builtin_fabsf(_x) (float)(_x)
58 #define __builtin_fabsl(_x) (long double)(_x)
59 #define __builtin_fabs( _x) (double)(_x)
60 #define __builtin_ffsll(x) (x)
61 #define __builtin_ffsl(x) (x)
62 #define __builtin_ffs(x) (x)
63 #define __builtin_FILE() 1
64 #define __builtin_fpclassify(x,y,z,w,r, ...)  ((x), (y), (z), (w), (r), 1)
65 #define __builtin___fprintf_chk(x,y,z,...) ((x), (y), (z), 1)
66 #define __builtin_frame_address(_x) (_x, (void *)0)
67 #define __builtin_FUNCTION() 1
68 #define __builtin_goacc_parlevel_id(x) (x)
69 #define __builtin_goacc_parlevel_size(x) (x)
70 #define __builtin_huge_val() 1
71 #define __builtin_huge_valf() 1
72 #define __builtin_huge_valfn() 1
73 #define __builtin_huge_valfnx() 1
74 #define __builtin_huge_vall() 1
75 #define __builtin_infd32() 1
76 #define __builtin_infd64() 1
77 #define __builtin_inf()     (double)0
78 #define __builtin_inff()    (float)0
79 #define __builtin_inffnx() 1
80 #define __builtin_infl()    (long double)0
81 #define __builtin_isinf_sign(...) 1
82 #define __builtin_LINE() 1
83 #define __builtin___memcpy_chk(x,y,z,w) ((x), (y), (z), (w), 0)
84 #define __builtin_memcpy(_d, _s, _n) (_s, _n, _d)
85 #define __builtin___memmove_chk(x,y,z,w) ((x), (y), (z), (w), 1)
86 #define __builtin___mempcpy_chk(x,y,z,w) ((x), (y), (z), (w), 0)
87 #define __builtin_memset(x,y,z) ((x), (y), (z), 1)
88 #define __builtin___memset_chk(x,y,z,w) ((x), (y), (z), (w), 0)
89 #define __builtin_mul_overflow(x,y,z) ((x), (y), (z), 1)
90 #define __builtin_nand128(x) ((x), 1.)
91 #define __builtin_nand32(x) ((x), 1f)
92 #define __builtin_nand64(x) ((x), 1.)
93 #define __builtin_nanfn(x) ((x), 1.)
94 #define __builtin_nanfnx(x) ((x), 1.)
95 #define __builtin_nanf(x)  ((x), 1.)
96 #define __builtin_nanl(x) ((x), 1)
97 #define __builtin_nansfn(x) ((x), 1f)
98 #define __builtin_nansfnx(x) ((x), 1)
99 #define __builtin_nansl(x) ((x), 1)
100 #define __builtin_nans(x) ((x), 1)
101 #define __builtin_nan(x) ((x), 1)
102 #define __builtin_next_arg(_x) (_x, 0)
103 #define __builtin_object_size(x,y)  ((x), (y), 1)
104 #define __builtin_offsetof(_t, _m) (((size_t) &((_t *)0)->_m))
105 #define __builtin_parityll(x) ((x), 1ll)
106 #define __builtin_parityl(x) ((x), 1l)
107 #define __builtin_parity(x) ((x), 1)
108 #define __builtin_popcountll(x) ((x), 1ll)
109 #define __builtin_popcountl(x) ((x), 1l)
110 #define __builtin_popcount(x) ((x), 1)
111 #define __builtin_powi(x) ((x), 1)
112 #define __builtin_powl(x) ((x), 1l)
113 #define __builtin_prefetch(x,...) ((x), 0)
114 #define __builtin___printf_chk(x,y,...) ((x), (y), 1)
115 #define __builtin_return_address(x) ((x), 0)
116 #define __builtin___snprintf_chk(x,y,z,w)  ((x), (y), (z), (w), 1)
117 #define __builtin_speculation_safe_value(x,y) ((x), (y), 1)
118 #define __builtin___sprintf_chk(x,y,z,w,...) ((x), (y), (z), (w), 1)
119 #define __builtin_stdarg_start
120 #define __builtin___stpcpy_chk(x,y,z) ((x), (y), (z), 0)
121 #define __builtin___strcat_chk(x,y,z) ((x), (y), (z), 0)
122 #define __builtin_strchr(x,y) ((x), (y), 0)
123 #define __builtin_strcmp(x,y) ((x), (y), 0)
124 #define __builtin___strcpy_chk(x,y,z) ((x), (y), (z), 0)
125 #define __builtin_strcspn(x,y) ((x), (y), 0)
126 #define __builtin_strlen(x) ((x), 1)
127 #define __builtin___strncat_chk(x,y,z,w) ((x), (y), (z), (w), 1)
128 #define __builtin___strncpy_chk(x,y,z,w) ((x), (y), (z), (w), 1)
129 #define __builtin_tgmath(x, y) ((x), (y), 0)
130 #define __builtin_trap() 1
131 #define __builtin_types_compatible_p(x,y) (1)
132 #define __builtin_unreachable() 1
133 #define __builtin_va_arg(_ap, _type) (*(_type *)(_ap))
134 #define __builtin_va_arg_pack() 1
135 #define __builtin_va_arg_pack_len() 1
136 #define __builtin_va_copy(_a, _b) ((_a), (_b), 0)
137 #define __builtin_va_end(_v) ((void)(_v))
138 #define __builtin_va_list void *
139 #define __builtin_va_start(_ap, _arg) ((void)(_ap),(void)(_arg))
140 #define __builtin___vprintf_chk(x,y,z) ((x), (y), (z), 1)
141 #define __builtin___vsnprintf_chk(x,y,z,w,r) ((x), (y), (z), (w), (r), 1)
142 #define __builtin___vsprintf_chk(x,y,z,w,r) ((x), (y), (z), (w), (r), 1)
143 #define __COUNTER__ 0
144 #define __extension
145 #pragma define_immutable __extension__
146 #define __int128 long
147 #define _Float32 float
148 #define _Float32x float
149 #define _Float64 double
150 #define _Float64x double
151 #define __float128 double
152 #define _Float128 double
153 #define __PRETTY_FUNCTION__ "UNKNOWN"
154 #define _Static_assert(x)
155 #define typeof __typeof__
156 #pragma define_immutable __restrict
157