Linux-Sparse Archive on lore.kernel.org
 help / color / 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 1/3] add builtin type for wide strings
Date: Sun,  4 Oct 2020 13:43:47 +0200
Message-ID: <20201004114349.81440-2-luc.vanoostenryck@gmail.com> (raw)
In-Reply-To: <20201004114349.81440-1-luc.vanoostenryck@gmail.com>

This is needed for printf format checking of "%Ls".

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 7f0c85580f06..9065bd527d60 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 a3ed95678ee5..f82484f5c978 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;
-- 
2.28.0


  reply index

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 ` Luc Van Oostenryck [this message]
2020-10-04 11:43 ` [PATCH 2/3] add builtin types for signed char* and short * Luc Van Oostenryck
2020-10-04 11:43 ` [PATCH 3/3] add builtin types for size_t*, intmax_t* & ptrdiff_t* Luc Van Oostenryck

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-2-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

Linux-Sparse Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-sparse/0 linux-sparse/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-sparse linux-sparse/ https://lore.kernel.org/linux-sparse \
		linux-sparse@vger.kernel.org
	public-inbox-index linux-sparse

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-sparse


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git