aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2019-09-30 16:41:54 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-06-18 21:26:23 +0200
commit9b14d5925ab2fd17ea5de0b64aab545fdbdee516 (patch)
tree425403a9b0c8312b7b7cb7d7a094f9ce59f83c0a
parent42323db3955557b223268ec4196acb77308ab204 (diff)
downloadsparse-9b14d5925ab2fd17ea5de0b64aab545fdbdee516.tar.gz
pre-process: add testcases for __has_feature() & __has_extension()
The support for these builtin macros is incoming. So, add some testcases for them. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--validation/preprocessor/has-feature.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/validation/preprocessor/has-feature.c b/validation/preprocessor/has-feature.c
new file mode 100644
index 00000000..3ab7c3e0
--- /dev/null
+++ b/validation/preprocessor/has-feature.c
@@ -0,0 +1,21 @@
+#ifndef __has_feature
+__has_feature()??? Quesako?
+#define __has_feature(x) 0
+#else
+"has __has_feature(), yeah!"
+#endif
+
+#if __has_feature(not_a_feature)
+#error "not a feature!"
+#endif
+
+/*
+ * check-name: has-feature
+ * check-command: sparse -E $file
+ * check-known-to-fail
+ *
+ * check-output-start
+
+"has __has_feature(), yeah!"
+ * check-output-end
+ */