[PATCH 2/3] sparse test suite: add test mixing __context__ and __attribute__((context(...)))

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



An earlier version of the next patch had a bug that this test catches.

Signed-off-by: Johannes Berg <johannes@xxxxxxxxxxxxxxxx>
---
 validation/context-named.c |   21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

--- sparse.orig/validation/context-named.c	2008-04-10 14:57:26.000000000 +0200
+++ sparse/validation/context-named.c	2008-04-10 15:23:16.000000000 +0200
@@ -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
  *

-- 

--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux