units: store what sort of units a variable is in
[smatch.git] / smatch_constants.h
blob69ea4c3eb5c9dcae752650863a1abb23e25a2b62
1 #include "expression.h"
3 #ifndef SMATCH_CONSTANTS_H_
4 #define SMATCH_CONSTANTS_H_
6 static const sval_t int_zero = { .type = &int_ctype, .value = 0 };
7 static const sval_t int_one = { .type = &int_ctype, .value = 1 };
8 static const sval_t err_min = { .type = &int_ctype, .value = -4095 };
9 static const sval_t err_max = { .type = &int_ctype, .value = -1 };
10 static const sval_t int_max = { .type = &int_ctype, .value = INT_MAX };
12 static const sval_t bool_false = { .type = &bool_ctype, .value = 0 };
13 static const sval_t bool_true = { .type = &bool_ctype, .value = 1 };
15 static const sval_t ptr_err_min = { .type = &ptr_ctype, .value = -4095 };
16 static const sval_t ptr_err_max = { .type = &ptr_ctype, .value = -1 };
17 static const sval_t ptr_null = { .type = &ptr_ctype, .value = 0 };
19 static const sval_t ulong_zero = { .type = &ulong_ctype, .value = 0 };
20 static const sval_t ulong_one = { .type = &ulong_ctype, .value = 1 };
21 static const sval_t ulong_INT_MAX = { .type = &ulong_ctype, .value = INT_MAX };
22 static const sval_t ulong_ULONG_MAX = { .type = &ulong_ctype, .uvalue = ULONG_MAX };
24 #define MTAG_ALIAS_BIT (1ULL << 63)
25 #define MTAG_OFFSET_MASK 0xfffULL
26 #define MTAG_SEED 0xdead << 12
28 const extern unsigned long valid_ptr_min;
29 extern unsigned long valid_ptr_max;
30 extern const sval_t valid_ptr_min_sval;
31 extern sval_t valid_ptr_max_sval;
32 extern struct range_list *valid_ptr_rl;
33 void alloc_valid_ptr_rl(void);
35 static const sval_t array_min_sval = {
36 .type = &ptr_ctype,
37 {.value = 100000},
39 static const sval_t array_max_sval = {
40 .type = &ptr_ctype,
41 {.value = ULONG_MAX - 4095},
43 static const sval_t text_seg_min = {
44 .type = &ptr_ctype,
45 {.value = 4096},
47 static const sval_t text_seg_max = {
48 .type = &ptr_ctype,
49 {.value = ULONG_MAX - 4095},
51 static const sval_t data_seg_min = {
52 .type = &ptr_ctype,
53 {.value = 4096},
55 static const sval_t data_seg_max = {
56 .type = &ptr_ctype,
57 {.value = ULONG_MAX - 4095},
59 static const sval_t bss_seg_min = {
60 .type = &ptr_ctype,
61 {.value = 4096},
63 static const sval_t bss_seg_max = {
64 .type = &ptr_ctype,
65 {.value = ULONG_MAX - 4095},
67 static const sval_t stack_seg_min = {
68 .type = &ptr_ctype,
69 {.value = 4096},
71 static const sval_t stack_seg_max = {
72 .type = &ptr_ctype,
73 {.value = ULONG_MAX - 4095},
75 static const sval_t kmalloc_seg_min = {
76 .type = &ptr_ctype,
77 {.value = 4096},
79 static const sval_t kmalloc_seg_max = {
80 .type = &ptr_ctype,
81 {.value = ULONG_MAX - 4095},
83 static const sval_t vmalloc_seg_min = {
84 .type = &ptr_ctype,
85 {.value = 4096},
87 static const sval_t vmalloc_seg_max = {
88 .type = &ptr_ctype,
89 {.value = ULONG_MAX - 4095},
91 static const sval_t fn_ptr_min = {
92 .type = &ptr_ctype,
93 {.value = 4096},
95 static const sval_t fn_ptr_max = {
96 .type = &ptr_ctype,
97 {.value = ULONG_MAX - 4095},
100 #endif