diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2008-04-10 15:25:21 +0200 |
---|---|---|
committer | Josh Triplett <josh@freedesktop.org> | 2008-04-21 11:06:22 -0700 |
commit | 7f91144d2de97bcbf26d980830646cac25e2b7df (patch) | |
tree | 29c12ddfb6c970ca601d8765cdf9fa4990de255d | |
parent | c5b808c9964d62fc026d9398a4a62c3ce7bacac8 (diff) | |
download | sparse-7f91144d2de97bcbf26d980830646cac25e2b7df.tar.gz |
sparse test suite: add test mixing __context__ and __attribute__((context(...)))
An earlier version of the next patch had a bug that this test catches.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
-rw-r--r-- | validation/context-named.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/validation/context-named.c b/validation/context-named.c index c65b2022..d5573f4a 100644 --- a/validation/context-named.c +++ b/validation/context-named.c @@ -465,6 +465,27 @@ static void warn_exact_fn2(void) r2(); } +#define __acquire(x) __context__(x,1) +#define __release(x) __context__(x,-1) + +#define rl() \ + do { __acquire(RCU); } while (0) + +#define ru() \ + do { __release(RCU); } while (0) + +static void good_mixed_with_if(void) +{ + rl(); + + if (condition) { + a(); + r(); + } + + ru(); +} + /* * check-name: Check -Wcontext with lock names * |