From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: linux-sparse@vger.kernel.org
Cc: Ilya Maximets <i.maximets@ovn.org>,
Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Subject: [PATCH] add helpers is_struct_type() & is_union_type()
Date: Thu, 8 Oct 2020 00:48:09 +0200 [thread overview]
Message-ID: <20201007224809.3289-1-luc.vanoostenryck@gmail.com> (raw)
From: Ilya Maximets <i.maximets@ovn.org>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
symbol.h | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/symbol.h b/symbol.h
index e1f5392600ef..e75ea3abfcd3 100644
--- a/symbol.h
+++ b/symbol.h
@@ -425,6 +425,20 @@ static inline int is_array_type(struct symbol *type)
return type->type == SYM_ARRAY;
}
+static inline int is_struct_type(struct symbol *type)
+{
+ if (type->type == SYM_NODE)
+ type = type->ctype.base_type;
+ return type->type == SYM_STRUCT;
+}
+
+static inline int is_union_type(struct symbol *type)
+{
+ if (type->type == SYM_NODE)
+ type = type->ctype.base_type;
+ return type->type == SYM_UNION;
+}
+
static inline int is_float_type(struct symbol *type)
{
if (type->type == SYM_NODE)
--
2.28.0
reply other threads:[~2020-10-07 22:48 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20201007224809.3289-1-luc.vanoostenryck@gmail.com \
--to=luc.vanoostenryck@gmail.com \
--cc=i.maximets@ovn.org \
--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).