aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-10-02 02:13:25 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-10-04 13:42:10 +0200
commit0f50030dccb29b70f15b5b8ddcd7375aef625c98 (patch)
treecf53bfb012cc705dee42afcfb65270873b822388
parent24bdaac6682c36f5f7878321e8f9eb02c0993572 (diff)
downloadsparse-0f50030dccb29b70f15b5b8ddcd7375aef625c98.tar.gz
add builtin type for wide strings
This is needed for printf format checking of "%Ls". Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--symbol.c8
-rw-r--r--symbol.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/symbol.c b/symbol.c
index 7f0c8558..9065bd52 100644
--- a/symbol.c
+++ b/symbol.c
@@ -790,6 +790,7 @@ struct symbol float64_ctype, float64x_ctype;
struct symbol float128_ctype;
struct symbol const_void_ctype, const_char_ctype;
struct symbol const_ptr_ctype, const_string_ctype;
+struct symbol const_wchar_ctype, const_wstring_ctype;
struct symbol zero_int;
@@ -884,9 +885,11 @@ static const struct ctype_declare {
{ &ullong_ptr_ctype, T_PTR(&ullong_ctype) },
{ &const_ptr_ctype, T_PTR(&const_void_ctype) },
{ &const_string_ctype, T_PTR(&const_char_ctype) },
+ { &const_wstring_ctype,T_PTR(&const_wchar_ctype) },
{ &const_void_ctype, T_CONST(&void_ctype, NULL, NULL) },
{ &const_char_ctype, T_CONST(&char_ctype, &bits_in_char, &max_int_alignment)},
+ { &const_wchar_ctype, T_CONST(&int_ctype, NULL, NULL) },
{ NULL, }
};
@@ -931,4 +934,9 @@ void init_ctype(void)
intptr_ctype = ssize_t_ctype;
if (!uintptr_ctype)
uintptr_ctype = size_t_ctype;
+
+ const_wchar_ctype.ctype.base_type = wchar_ctype;
+ const_wchar_ctype.rank = wchar_ctype->rank;
+ const_wchar_ctype.ctype.alignment = wchar_ctype->ctype.alignment;
+ const_wchar_ctype.bit_size = wchar_ctype->bit_size;
}
diff --git a/symbol.h b/symbol.h
index a3ed9567..f82484f5 100644
--- a/symbol.h
+++ b/symbol.h
@@ -306,6 +306,7 @@ extern struct symbol float64_ctype, float64x_ctype;
extern struct symbol float128_ctype;
extern struct symbol const_void_ctype, const_char_ctype;
extern struct symbol const_ptr_ctype, const_string_ctype;
+extern struct symbol const_wchar_ctype, const_wstring_ctype;
/* Special internal symbols */
extern struct symbol zero_int;