linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: linux-sparse@vger.kernel.org
Cc: Ben Dooks <ben.dooks@codethink.co.uk>,
	Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Subject: [PATCH 3/3] add builtin types for size_t*, intmax_t* & ptrdiff_t*
Date: Sun,  4 Oct 2020 13:43:49 +0200	[thread overview]
Message-ID: <20201004114349.81440-4-luc.vanoostenryck@gmail.com> (raw)
In-Reply-To: <20201004114349.81440-1-luc.vanoostenryck@gmail.com>

This is needed for printf format checking of "%zn", "%jn" & "%tn".

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 symbol.c | 8 ++++++++
 symbol.h | 1 +
 2 files changed, 9 insertions(+)

diff --git a/symbol.c b/symbol.c
index a29e0b140d16..130071ab0381 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 d39048cb478d..6d25e7fc8bad 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;
-- 
2.28.0


      parent reply	other threads:[~2020-10-04 11:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-04 11:43 [PATCH 0/3] add some builtin types for printf format checking Luc Van Oostenryck
2020-10-04 11:43 ` [PATCH 1/3] add builtin type for wide strings Luc Van Oostenryck
2020-10-04 11:43 ` [PATCH 2/3] add builtin types for signed char* and short * Luc Van Oostenryck
2020-10-04 11:43 ` Luc Van Oostenryck [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201004114349.81440-4-luc.vanoostenryck@gmail.com \
    --to=luc.vanoostenryck@gmail.com \
    --cc=ben.dooks@codethink.co.uk \
    --cc=linux-sparse@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).