From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: linux-sparse@vger.kernel.org, Oleg Nesterov <oleg@redhat.com>
Cc: Alexey Gladkov <gladkov.alexey@gmail.com>,
Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Subject: [PATCH] dissect: use struct symbol::visited/inspected instead of ::examined/evaluated
Date: Wed, 29 Jul 2020 16:51:32 +0200 [thread overview]
Message-ID: <20200729145132.81479-1-luc.vanoostenryck@gmail.com> (raw)
The dissect client uses struct symbol's fields 'examined' & 'evaluated'
to avoid reprocessing the same symbols. But these fields are used
internally by sparse for type examination & evaluation and despite
dissect not doing these operations explicitly, they can be done
implicitly (for example to handle static assertions or when the
value of a constant expression is needed).
So, add a new field to struct symbol: 'inspected' and use it, as
well as the existing 'visited', instead of 'evaluated' & 'examined'.
Note: when used on the kernel, this patch avoids a lot of warnings:
"warning: r_member bad sym type=7 kind=0"
"warning: r_member bad mem->kind = 0"
and creates substantially more normal output.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
dissect.c | 8 ++++----
symbol.h | 1 +
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/dissect.c b/dissect.c
index fd09707dbf67..582e8fc32e46 100644
--- a/dissect.c
+++ b/dissect.c
@@ -204,9 +204,9 @@ static void examine_sym_node(struct symbol *node, struct symbol *parent)
struct ident *name = node->ident;
struct symbol *base, *dctx;
- if (node->examined)
+ if (node->visited)
return;
- node->examined = 1;
+ node->visited = 1;
node->kind = 'v';
while ((base = node->ctype.base_type) != NULL)
@@ -228,9 +228,9 @@ static void examine_sym_node(struct symbol *node, struct symbol *parent)
break;
case SYM_STRUCT: case SYM_UNION: //case SYM_ENUM:
- if (base->evaluated)
+ if (base->inspected)
return;
- base->evaluated = 1;
+ base->inspected = 1;
base->kind = 's';
if (!base->symbol_list)
diff --git a/symbol.h b/symbol.h
index c2b60ce91c27..08d1134a7d82 100644
--- a/symbol.h
+++ b/symbol.h
@@ -209,6 +209,7 @@ struct symbol {
struct { /* sparse ctags */
char kind;
unsigned char visited:1;
+ unsigned char inspected:1;
};
};
pseudo_t pseudo;
--
2.28.0
next reply other threads:[~2020-07-29 14:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-29 14:51 Luc Van Oostenryck [this message]
2020-07-29 15:34 ` [PATCH] dissect: use struct symbol::visited/inspected instead of ::examined/evaluated Oleg Nesterov
2020-07-29 15:48 ` 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=20200729145132.81479-1-luc.vanoostenryck@gmail.com \
--to=luc.vanoostenryck@gmail.com \
--cc=gladkov.alexey@gmail.com \
--cc=linux-sparse@vger.kernel.org \
--cc=oleg@redhat.com \
/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