aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-10-04 13:24:05 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-10-04 13:42:10 +0200
commitb9453d0493bc672af908f83483e708880617ba8e (patch)
tree7a8ddcb0e5dd780ac1ecbf720f67dadab3013519
parenta6d459c6677324826e4ce858bf0c043b78b90756 (diff)
downloadsparse-b9453d0493bc672af908f83483e708880617ba8e.tar.gz
add builtin types for size_t*, intmax_t* & ptrdiff_t*
This is needed for printf format checking of "%zn", "%jn" & "%tn". 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 a29e0b14..130071ab 100644
--- a/symbol.c
+++ b/symbol.c
@@ -786,6 +786,7 @@ struct symbol schar_ptr_ctype, short_ptr_ctype;
struct symbol int_ptr_ctype, uint_ptr_ctype;
struct symbol long_ptr_ctype, ulong_ptr_ctype;
struct symbol llong_ptr_ctype, ullong_ptr_ctype;
+struct symbol size_t_ptr_ctype, intmax_ptr_ctype, ptrdiff_ptr_ctype;
struct symbol float32_ctype, float32x_ctype;
struct symbol float64_ctype, float64x_ctype;
struct symbol float128_ctype;
@@ -886,6 +887,9 @@ static const struct ctype_declare {
{ &ulong_ptr_ctype, T_PTR(&ulong_ctype) },
{ &llong_ptr_ctype, T_PTR(&llong_ctype) },
{ &ullong_ptr_ctype, T_PTR(&ullong_ctype) },
+ { &size_t_ptr_ctype, T_PTR(&void_ctype) }, // will be adjusted
+ { &intmax_ptr_ctype, T_PTR(&void_ctype) }, // will be adjusted
+ { &ptrdiff_ptr_ctype, T_PTR(&void_ctype) }, // will be adjusted
{ &const_ptr_ctype, T_PTR(&const_void_ctype) },
{ &const_string_ctype, T_PTR(&const_char_ctype) },
{ &const_wstring_ctype,T_PTR(&const_wchar_ctype) },
@@ -938,6 +942,10 @@ void init_ctype(void)
if (!uintptr_ctype)
uintptr_ctype = size_t_ctype;
+ size_t_ptr_ctype.ctype.base_type = size_t_ctype;
+ intmax_ptr_ctype.ctype.base_type = intmax_ctype;
+ ptrdiff_ptr_ctype.ctype.base_type = ptrdiff_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;
diff --git a/symbol.h b/symbol.h
index d39048cb..6d25e7fc 100644
--- a/symbol.h
+++ b/symbol.h
@@ -302,6 +302,7 @@ extern struct symbol schar_ptr_ctype, short_ptr_ctype;
extern struct symbol int_ptr_ctype, uint_ptr_ctype;
extern struct symbol long_ptr_ctype, ulong_ptr_ctype;
extern struct symbol llong_ptr_ctype, ullong_ptr_ctype;
+extern struct symbol size_t_ptr_ctype, intmax_ptr_ctype, ptrdiff_ptr_ctype;
extern struct symbol float32_ctype, float32x_ctype;
extern struct symbol float64_ctype, float64x_ctype;
extern struct symbol float128_ctype;