aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/preprocessor
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-06-04 12:41:20 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-06-04 23:24:42 +0200
commit432a43b02a9a159902093829a1301376bdece1b4 (patch)
tree9898e081ca5276beccb808c86689aee2314b287e /validation/preprocessor
parent2b2e96ab37568f68085be64ba8c2b9e7d71de088 (diff)
downloadsparse-dev-432a43b02a9a159902093829a1301376bdece1b4.tar.gz
dyn-macro: add support for __INCLUDE_LEVEL__
This macro, which is supported by GCC, wasn't yet by sparse. Add support for it. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation/preprocessor')
-rw-r--r--validation/preprocessor/dynamic.c4
-rw-r--r--validation/preprocessor/include-level.c14
-rw-r--r--validation/preprocessor/include-level.h1
3 files changed, 19 insertions, 0 deletions
diff --git a/validation/preprocessor/dynamic.c b/validation/preprocessor/dynamic.c
index a829542f..9d1dcc08 100644
--- a/validation/preprocessor/dynamic.c
+++ b/validation/preprocessor/dynamic.c
@@ -13,6 +13,9 @@ time
#if defined(__COUNTER__)
counter
#endif
+#if defined(__INCLUDE_LEVEL__)
+__INCLUDE_LEVEL__
+#endif
/*
* check-name: dynamic-macros
@@ -25,5 +28,6 @@ counter
date
time
counter
+0
* check-output-end
*/
diff --git a/validation/preprocessor/include-level.c b/validation/preprocessor/include-level.c
new file mode 100644
index 00000000..b5e5e603
--- /dev/null
+++ b/validation/preprocessor/include-level.c
@@ -0,0 +1,14 @@
+__FILE__: __INCLUDE_LEVEL__
+
+#include "include-level.h"
+
+/*
+ * check-name: include-level
+ * check-command: sparse -E $file
+ *
+ * check-output-start
+
+"preprocessor/include-level.c": 0
+"preprocessor/include-level.h": 1
+ * check-output-end
+ */
diff --git a/validation/preprocessor/include-level.h b/validation/preprocessor/include-level.h
new file mode 100644
index 00000000..cbc10182
--- /dev/null
+++ b/validation/preprocessor/include-level.h
@@ -0,0 +1 @@
+__FILE__: __INCLUDE_LEVEL__