aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-11-01 07:21:32 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-02-17 18:38:50 +0100
commitf45b7c7caeb21d9d6baec8a4b9ef1b9821efaa95 (patch)
tree0733cb084a9c7bc49b2375d393b214eb105850d5
parent6794d824a8d69981cdfa2ffb97debd8ec50e090c (diff)
downloadsparse-dev-f45b7c7caeb21d9d6baec8a4b9ef1b9821efaa95.tar.gz
builtin: add ctype for const {void,char} *
These types are needed to declare builtin functions without passing by the add_pre_buffer()-tokenization-parsing phases. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--symbol.c7
-rw-r--r--symbol.h2
2 files changed, 9 insertions, 0 deletions
diff --git a/symbol.c b/symbol.c
index 7e46ba9c..6cfaf2c8 100644
--- a/symbol.c
+++ b/symbol.c
@@ -696,6 +696,8 @@ struct symbol bool_ctype, void_ctype, type_ctype,
string_ctype, ptr_ctype, lazy_ptr_ctype,
incomplete_ctype, label_ctype, bad_ctype,
null_ctype;
+struct symbol const_void_ctype, const_char_ctype;
+struct symbol const_ptr_ctype, const_string_ctype;
struct symbol zero_int;
@@ -762,6 +764,11 @@ static const struct ctype_declare {
{ &null_ctype, SYM_PTR, 0, &bits_in_pointer, &pointer_alignment, &void_ctype },
{ &label_ctype, SYM_PTR, 0, &bits_in_pointer, &pointer_alignment, &void_ctype },
{ &lazy_ptr_ctype, SYM_PTR, 0, &bits_in_pointer, &pointer_alignment, &void_ctype },
+
+ { &const_void_ctype, SYM_NODE, MOD_CONST, NULL, NULL, &void_ctype },
+ { &const_char_ctype, SYM_NODE, MOD_CONST, &bits_in_char, &max_int_alignment, &char_ctype },
+ { &const_ptr_ctype, SYM_PTR, 0, &bits_in_pointer, &pointer_alignment, &const_void_ctype },
+ { &const_string_ctype,SYM_PTR, 0, &bits_in_pointer, &pointer_alignment, &const_char_ctype },
{ NULL, }
};
#undef MOD_LLL
diff --git a/symbol.h b/symbol.h
index b4d1c2ac..382f6f05 100644
--- a/symbol.h
+++ b/symbol.h
@@ -267,6 +267,8 @@ extern struct symbol bool_ctype, void_ctype, type_ctype,
string_ctype, ptr_ctype, lazy_ptr_ctype,
incomplete_ctype, label_ctype, bad_ctype,
null_ctype;
+extern struct symbol const_void_ctype, const_char_ctype;
+extern struct symbol const_ptr_ctype, const_string_ctype;
/* Special internal symbols */
extern struct symbol zero_int;