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: linux-sparse@vger.kernel.org
Subject: [PATCH 4/3] inlined call bugfix & test
Date: Fri, 11 Apr 2008 13:07:47 +0200	[thread overview]
Message-ID: <1207912067.13354.54.camel@johannes.berg> (raw)
In-Reply-To: <20080410132519.049821000@sipsolutions.net>

This patch fixes an oversight in my other patches, inlined
calls weren't checked for context properly. Also adds a test
case for this.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
I'll roll this into the other patches if wanted.

 sparse.c                   |    1 +
 validation/context-named.c |   12 ++++++++++++
 2 files changed, 13 insertions(+)

--- sparse.orig/sparse.c	2008-04-11 12:42:49.000000000 +0200
+++ sparse/sparse.c	2008-04-11 12:43:44.000000000 +0200
@@ -137,6 +137,7 @@ static int check_bb_context(struct entry
 		if (!insn->bb)
 			continue;
 		switch (insn->opcode) {
+		case OP_INLINED_CALL:
 		case OP_CALL:
 			if (!insn->func || !insn->func->sym || insn->func->type != PSEUDO_SYM)
 				break;
--- sparse.orig/validation/context-named.c	2008-04-11 12:42:49.000000000 +0200
+++ sparse/validation/context-named.c	2008-04-11 12:46:36.000000000 +0200
@@ -465,6 +465,17 @@ static void warn_exact_fn2(void)
     r2();
 }
 
+static inline void need_lock3(void) __attribute__((context(TEST,1,1)))
+{
+}
+
+static void warn_fn3(void)
+{
+    a2();
+    need_lock3();
+    r2();
+}
+
 #define __acquire(x)	__context__(x,1)
 #define __release(x)	__context__(x,-1)
 
@@ -513,5 +524,6 @@ context-named.c:434:14: warning: context
 context-named.c:441:15: warning: context problem in 'warn_fn2' - function 'need_lock2' expected different context
 context-named.c:456:20: warning: context problem in 'warn_exact_fn1' - function 'need_lock_exact' expected different context
 context-named.c:464:20: warning: context problem in 'warn_exact_fn2' - function 'need_lock_exact' expected different context
+context-named.c:475:15: warning: context problem in 'warn_fn3' - function 'need_lock3' expected different context
  * check-error-end
  */



  parent reply	other threads:[~2008-04-11 12:08 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-10 13:25 [PATCH 0/3] improve context handling Johannes Berg
2008-04-10 13:25 ` [PATCH 1/3] make sparse keep its promise about context tracking Johannes Berg
2008-04-10 15:24   ` Philipp Reisner
2008-04-10 15:30     ` Johannes Berg
2008-04-10 15:46       ` Philipp Reisner
2008-04-10 15:51         ` Johannes Berg
2008-04-10 16:05           ` Philipp Reisner
2008-04-10 16:12             ` Johannes Berg
2008-04-10 21:21               ` Philipp Reisner
2008-04-11 19:53                 ` Josh Triplett
2008-04-18 12:35                   ` Johannes Berg
2008-04-11 11:06             ` Johannes Berg
2008-04-21 19:34             ` Josh Triplett
2008-04-21 19:37               ` Johannes Berg
2008-04-10 15:54         ` Johannes Berg
2008-04-21 19:22       ` Josh Triplett
2008-04-21 18:04   ` Josh Triplett
2008-04-21 18:11     ` Johannes Berg
2008-04-21 18:26       ` Josh Triplett
2008-04-21 18:30         ` Johannes Berg
2008-04-21 18:51           ` Josh Triplett
2008-04-10 13:25 ` [PATCH 2/3] sparse test suite: add test mixing __context__ and __attribute__((context(...))) Johannes Berg
2008-04-10 13:25 ` [PATCH 3/3] sparse: simple conditional context tracking Johannes Berg
2008-04-11 11:07 ` Johannes Berg [this message]
2008-04-11 11:08 ` [PATCH 5/3] improve -Wcontext code and messages Johannes Berg
2008-04-21 18:37 ` [PATCH 0/3] improve context handling 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=1207912067.13354.54.camel@johannes.berg \
    --to=johannes@sipsolutions.net \
    --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).