aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/preprocessor
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-04-04 16:00:23 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-06-04 23:24:42 +0200
commitfb1d00d35713111043391bdf4a0e182552d691ec (patch)
treec3d0303bd32270888e4f159512c7df2b8d122c23 /validation/preprocessor
parent432a43b02a9a159902093829a1301376bdece1b4 (diff)
downloadsparse-dev-fb1d00d35713111043391bdf4a0e182552d691ec.tar.gz
dyn-macro: add real support for __BASE_FILE__
There was some support for it but it was just a define that expanded to the fixed name "base_file.c". Implement the real thing by saving the input filename and replacing __BASE_FILE__ by it. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation/preprocessor')
-rw-r--r--validation/preprocessor/base-file.c17
-rw-r--r--validation/preprocessor/base-file.h2
-rw-r--r--validation/preprocessor/dynamic.c4
3 files changed, 23 insertions, 0 deletions
diff --git a/validation/preprocessor/base-file.c b/validation/preprocessor/base-file.c
new file mode 100644
index 00000000..61a290cb
--- /dev/null
+++ b/validation/preprocessor/base-file.c
@@ -0,0 +1,17 @@
+__FILE__
+__BASE_FILE__
+
+#include "base-file.h"
+
+/*
+ * check-name: base file
+ * check-command: sparse -E $file
+ *
+ * check-output-start
+
+"preprocessor/base-file.c"
+"preprocessor/base-file.c"
+"preprocessor/base-file.h"
+"preprocessor/base-file.c"
+ * check-output-end
+ */
diff --git a/validation/preprocessor/base-file.h b/validation/preprocessor/base-file.h
new file mode 100644
index 00000000..018b16c5
--- /dev/null
+++ b/validation/preprocessor/base-file.h
@@ -0,0 +1,2 @@
+__FILE__
+__BASE_FILE__
diff --git a/validation/preprocessor/dynamic.c b/validation/preprocessor/dynamic.c
index 9d1dcc08..f791ba39 100644
--- a/validation/preprocessor/dynamic.c
+++ b/validation/preprocessor/dynamic.c
@@ -4,6 +4,9 @@ __LINE__
#if defined(__FILE__)
__FILE__
#endif
+#if defined(__BASE_FILE__)
+__BASE_FILE__
+#endif
#if defined(__DATE__)
date
#endif
@@ -25,6 +28,7 @@ __INCLUDE_LEVEL__
2
"preprocessor/dynamic.c"
+"preprocessor/dynamic.c"
date
time
counter