From: Christopher Li <sparse@chrisli.org>
To: Josh Triplett <josh@freedesktop.org>
Cc: linux-sparse@vger.kernel.org
Subject: [PATCH] delay removing file scope
Date: Thu, 30 Nov 2006 02:16:08 -0800 [thread overview]
Message-ID: <20061130101608.GB27500@chrisli.org> (raw)
Sparse only returns the used symbol. By the time it return
the symbol, it already destroyed the file scope.
This patch preserve the file scope. The caller can
examine the unused symbols. e.g. If I want to generate
ctags base on sparse, it need those unused symbols.
Signed-off-by: Christopher Li <sparse@chrisli.org>
Index: sparse/lib.c
===================================================================
--- sparse.orig/lib.c 2006-11-30 01:55:06.000000000 -0800
+++ sparse/lib.c 2006-11-30 01:55:23.000000000 -0800
@@ -661,9 +661,8 @@
/* Clear previous symbol list */
translation_unit_used_list = NULL;
- start_file_scope();
+ new_file_scope();
res = sparse_file(filename);
- end_file_scope();
/* Drop the tokens for this file after parsing */
clear_token_alloc();
Index: sparse/scope.c
===================================================================
--- sparse.orig/scope.c 2006-11-30 01:54:23.000000000 -0800
+++ sparse/scope.c 2006-11-30 01:55:23.000000000 -0800
@@ -96,6 +96,13 @@
end_scope(&file_scope);
}
+void new_file_scope(void)
+{
+ if (file_scope != &builtin_scope)
+ end_file_scope();
+ start_file_scope();
+}
+
void end_symbol_scope(void)
{
end_scope(&block_scope);
Index: sparse/scope.h
===================================================================
--- sparse.orig/scope.h 2006-11-30 01:54:23.000000000 -0800
+++ sparse/scope.h 2006-11-30 01:55:23.000000000 -0800
@@ -28,6 +28,7 @@
extern void start_file_scope(void);
extern void end_file_scope(void);
+extern void new_file_scope(void);
extern void start_symbol_scope(void);
extern void end_symbol_scope(void);
next reply other threads:[~2006-11-30 10:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-30 10:16 Christopher Li [this message]
2006-12-05 2:04 ` [PATCH] delay removing file scope Josh Triplett
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=20061130101608.GB27500@chrisli.org \
--to=sparse@chrisli.org \
--cc=josh@freedesktop.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).