[PATCH 1/3] add testcase for restricted enum

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

 



Asked-by: Matthew Wilcox <willy@xxxxxxxxxxxxx>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 validation/enum-restricted.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 validation/enum-restricted.c

diff --git a/validation/enum-restricted.c b/validation/enum-restricted.c
new file mode 100644
index 000000000..b58964172
--- /dev/null
+++ b/validation/enum-restricted.c
@@ -0,0 +1,22 @@
+#ifdef __CHECKER__
+#define __bitwise	__attribute__((bitwise))
+#define __force		__attribute__((force))
+#else
+#define __bitwise
+#define __force
+#endif
+
+typedef enum __bitwise foobar {
+        FOO = 0,
+        BAR = 1,
+} fb_t;
+
+static void foo(void)
+{
+	fb_t v = BAR;
+}
+
+/*
+ * check-name: enum-restricted
+ * check-known-to-fail
+ */
-- 
2.16.0

--
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