From: Brett Nash <nash@nash.id.au>
To: linux-sparse@vger.kernel.org
Subject: Sparse doesn't seem to care about checking context? data
Date: Tue, 9 Sep 2014 20:51:01 +0000 [thread overview]
Message-ID: <20140909205101.GA18784@codekia.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 395 bytes --]
Hello,
I was just testing sparse on a large (non-linux) code base using the
__must_hold macro (eg __attribute__((context, 1, 1))).
However I don't seem to be able to trigger a warning from it.
I've attached a test case below, is there some magic I need to do get sparse
to trigger on this case. I also note there are currently no tests in
validation that check for this case.
Regards,
nash
[-- Attachment #2: sparse_context.c --]
[-- Type: text/x-csrc, Size: 359 bytes --]
static int must_hold(int x) __attribute__((context(1,1))) {
int z;
return x * 7;
}
static int release(int x) __attribute__((context(1, 0))) {
__context__(-1);
return 0;
}
static int acquiresilently(int x) {
__context__(1);
return 1;
}
int main(int argc, char **argv) {
must_hold(8);
__context__(1);
must_hold(0);
__context__(-1);
return 0;
}
reply other threads:[~2014-09-09 21:22 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=20140909205101.GA18784@codekia.com \
--to=nash@nash.id.au \
--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).