rosenberg: handle bit fields better
[smatch.git] / smatch_constants.h
blob5230d243bf98c598dc63d91cd9b596ccc85fc490
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 ptr_err_min = { .type = &ptr_ctype, .value = -4095 };
13 static const sval_t ptr_err_max = { .type = &ptr_ctype, .value = -1 };
14 static const sval_t ptr_null = { .type = &ptr_ctype, .value = 0 };
16 static const sval_t ulong_one = { .type = &ulong_ctype, .value = 1 };
17 static const sval_t ulong_INT_MAX = { .type = &ulong_ctype, .value = INT_MAX };
19 #define MTAG_ALIAS_BIT (1ULL << 63)
20 #define MTAG_OFFSET_MASK 0xfffULL
21 #define MTAG_SEED 0xdead << 12
23 const extern unsigned long valid_ptr_min;
24 extern unsigned long valid_ptr_max;
25 extern const sval_t valid_ptr_min_sval;
26 extern sval_t valid_ptr_max_sval;
27 extern struct range_list *valid_ptr_rl;
28 void alloc_valid_ptr_rl(void);
30 static const sval_t array_min_sval = {
31 .type = &ptr_ctype,
32 {.value = 100000},
34 static const sval_t array_max_sval = {
35 .type = &ptr_ctype,
36 {.value = ULONG_MAX - 4095},
38 static const sval_t text_seg_min = {
39 .type = &ptr_ctype,
40 {.value = 4096},
42 static const sval_t text_seg_max = {
43 .type = &ptr_ctype,
44 {.value = ULONG_MAX - 4095},
46 static const sval_t data_seg_min = {
47 .type = &ptr_ctype,
48 {.value = 4096},
50 static const sval_t data_seg_max = {
51 .type = &ptr_ctype,
52 {.value = ULONG_MAX - 4095},
54 static const sval_t bss_seg_min = {
55 .type = &ptr_ctype,
56 {.value = 4096},
58 static const sval_t bss_seg_max = {
59 .type = &ptr_ctype,
60 {.value = ULONG_MAX - 4095},
62 static const sval_t stack_seg_min = {
63 .type = &ptr_ctype,
64 {.value = 4096},
66 static const sval_t stack_seg_max = {
67 .type = &ptr_ctype,
68 {.value = ULONG_MAX - 4095},
70 static const sval_t kmalloc_seg_min = {
71 .type = &ptr_ctype,
72 {.value = 4096},
74 static const sval_t kmalloc_seg_max = {
75 .type = &ptr_ctype,
76 {.value = ULONG_MAX - 4095},
78 static const sval_t vmalloc_seg_min = {
79 .type = &ptr_ctype,
80 {.value = 4096},
82 static const sval_t vmalloc_seg_max = {
83 .type = &ptr_ctype,
84 {.value = ULONG_MAX - 4095},
86 static const sval_t fn_ptr_min = {
87 .type = &ptr_ctype,
88 {.value = 4096},
90 static const sval_t fn_ptr_max = {
91 .type = &ptr_ctype,
92 {.value = ULONG_MAX - 4095},
95 #endif