linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Josh Triplett <josh@freedesktop.org>
Cc: Philipp Reisner <philipp.reisner@linbit.com>,
	linux-sparse@vger.kernel.org,
	Harvey Harrison <harvey.harrison@gmail.com>,
	Pavel Roskin <proski@gnu.org>
Subject: [PATCH 9/9 v2] check inlines explicitly
Date: Fri, 30 May 2008 01:14:12 +0200	[thread overview]
Message-ID: <1212102852.10109.15.camel@johannes.berg> (raw)
In-Reply-To: <20080529085519.078206000@sipsolutions.net> (sfid-20080529_110105_170182_8D02CA8F)

An earlier patch disabled checking through inline functions because
inlining them clashes with the context tracking code, so this now
makes sparse check the inline functions as though they were really
functions.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
Maybe linearize_symbol() should do the check and return sym->ep if not
NULL?

 sparse.c |   24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

--- sparse.orig/sparse.c	2008-05-30 00:53:33.000000000 +0200
+++ sparse/sparse.c	2008-05-30 01:12:55.000000000 +0200
@@ -29,11 +29,12 @@ struct context_check {
 	const struct expression *expr;
 };
 
-DECLARE_ALLOCATOR(context_check);
 DECLARE_PTR_LIST(context_check_list, struct context_check);
 DECLARE_PTR_LIST(context_list_list, struct context_check_list);
 ALLOCATOR(context_check, "context check list");
 
+static struct symbol_list *inline_list = NULL;
+
 
 static void context_add(struct context_check_list **ccl,
 			const struct expression *expr,
@@ -277,6 +278,15 @@ static int check_bb_context(struct entry
 	 */
 	FOR_EACH_PTR(bb->insns, insn) {
 		switch (insn->opcode) {
+		case OP_INLINED_CALL: {
+			if (!insn->func->sym)
+				break;
+			if (insn->func->sym->visited)
+				break;
+			insn->func->sym->visited = 1;
+			add_ptr_list(&inline_list, insn->func->sym);
+			break;
+		}
 		case OP_CONTEXT:
 			if (handle_context(ep, bb, insn, &combined))
 				goto out;
@@ -526,7 +536,14 @@ static void check_symbols(struct symbol_
 		struct entrypoint *ep;
 
 		expand_symbol(sym);
-		ep = linearize_symbol(sym);
+		/*
+		 * If we're passing back an inline via the special code
+		 * that tests those, it might already be linearized, if
+		 * so just check it and don't linearize again.
+		 */
+		ep = sym->ep;
+		if (!ep)
+			ep = linearize_symbol(sym);
 		if (ep) {
 			if (dbg_entry)
 				show_entry(ep);
@@ -545,6 +562,9 @@ int main(int argc, char **argv)
 	check_symbols(sparse_initialize(argc, argv, &filelist));
 	FOR_EACH_PTR_NOTAG(filelist, file) {
 		check_symbols(sparse(file));
+		evaluate_symbol_list(inline_list);
+		check_symbols(inline_list);
+		free_ptr_list(&inline_list);
 	} END_FOR_EACH_PTR_NOTAG(file);
 	return 0;
 }



  reply	other threads:[~2008-05-29 23:15 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-29  8:54 [PATCH 0/9] context tracking updates Johannes Berg
2008-05-29  8:54 ` [PATCH 1/9] add test for acquire/release Johannes Berg
2008-05-29  8:54 ` [PATCH 2/9] add __exact_context__ Johannes Berg
2008-05-29  8:54 ` [PATCH 3/9] allow context() attribute on variables Johannes Berg
2008-05-29  8:54 ` [PATCH 4/9] evaluate/expand context expressions Johannes Berg
2008-05-29  8:54 ` [PATCH 5/9] revert the conditional_context patch Johannes Berg
2008-05-29  8:54 ` [PATCH 6/9] check context expressions as expressions Johannes Berg
2008-09-10  7:33   ` [PATCH 6/9 v2] " Johannes Berg
2008-09-10 19:21     ` Christopher Li
2008-09-10 21:34       ` Johannes Berg
2008-09-11  0:15         ` Christopher Li
2008-05-29  8:54 ` [PATCH 7/9] test conditional result locking Johannes Berg
2008-05-29  8:54 ` [PATCH 8/9] show required context in instruction output Johannes Berg
2008-05-29  8:54 ` [PATCH 9/9] check inlines explicitly Johannes Berg
2008-05-29 23:14   ` Johannes Berg [this message]
2008-05-29 23:20     ` [PATCH 9/9 v2] " Harvey Harrison
2008-05-29 22:12 ` [PATCH 0/9] context tracking updates Harvey Harrison
2008-05-29 22:35 ` Harvey Harrison
2008-05-29 22:45   ` Johannes Berg
2008-05-29 22:47     ` Harvey Harrison
2008-05-29 22:51     ` Harvey Harrison
2008-05-29 22:54       ` Johannes Berg
2008-05-29 23:03         ` Pavel Roskin
2008-05-29 23:06           ` Johannes Berg
2008-05-29 23:15             ` Johannes Berg
2008-05-29 23:04       ` Johannes Berg
2008-07-20 12:30 ` Johannes Berg

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=1212102852.10109.15.camel@johannes.berg \
    --to=johannes@sipsolutions.net \
    --cc=harvey.harrison@gmail.com \
    --cc=josh@freedesktop.org \
    --cc=linux-sparse@vger.kernel.org \
    --cc=philipp.reisner@linbit.com \
    --cc=proski@gnu.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).