[1/3] add testcase for restricted enum
diff mbox

Message ID 20180221223908.38904-2-luc.vanoostenryck@gmail.com
State Under Review
Headers show

Commit Message

Luc Van Oostenryck Feb. 21, 2018, 10:39 p.m. UTC
Asked-by: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 validation/enum-restricted.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 validation/enum-restricted.c

Patch
diff mbox

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
+ */