check_deref: use add_dereference_hook()
[smatch.git] / validation / backend / cast.c
blob9dfa6da53412a2e8c6f7b241ae102c5956327956
1 typedef _Bool bool;
2 typedef signed char schar;
3 typedef unsigned char uchar;
4 typedef unsigned short ushort;
5 typedef unsigned int uint;
6 typedef unsigned long ulong;
7 typedef long long longlong;
8 typedef unsigned long long ulonglong;
9 typedef void *vptr;
10 typedef int *iptr;
12 #define DEFINE_CAST(from, to) \
13 static to from##2##to(from x) { \
14 return (to)x; \
17 #define DEFINE_CASTS(from) \
18 DEFINE_CAST(from, bool) \
19 DEFINE_CAST(from, char) \
20 DEFINE_CAST(from, schar) \
21 DEFINE_CAST(from, uchar) \
22 DEFINE_CAST(from, short) \
23 DEFINE_CAST(from, ushort) \
24 DEFINE_CAST(from, int) \
25 DEFINE_CAST(from, uint) \
26 DEFINE_CAST(from, long) \
27 DEFINE_CAST(from, ulong) \
28 DEFINE_CAST(from, longlong) \
29 DEFINE_CAST(from, ulonglong) \
30 DEFINE_CAST(from, float) \
31 DEFINE_CAST(from, double)
33 DEFINE_CASTS(bool)
34 DEFINE_CASTS(char)
35 DEFINE_CASTS(schar)
36 DEFINE_CASTS(uchar)
37 DEFINE_CASTS(short)
38 DEFINE_CASTS(ushort)
39 DEFINE_CASTS(int)
40 DEFINE_CASTS(uint)
41 DEFINE_CASTS(long)
42 DEFINE_CASTS(ulong)
43 DEFINE_CASTS(longlong)
44 DEFINE_CASTS(ulonglong)
45 DEFINE_CASTS(float)
46 DEFINE_CASTS(double)
48 DEFINE_CAST(long, vptr)
49 DEFINE_CAST(long, iptr)
50 DEFINE_CAST(vptr, long)
51 DEFINE_CAST(iptr, long)
52 DEFINE_CAST(int, vptr)
53 DEFINE_CAST(vptr, int)
56 * check-name: Cast code generation
57 * check-command: sparsec -c $file -o tmp.o