aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-07-30 00:02:44 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-07-30 04:20:26 +0200
commit2f255a14665d9b584a3de528242bb948ff63f977 (patch)
tree3c8f333e93553a9ba87bf7cae96d1e34073491e5 /validation
parent3b54ee2f16c6118db4e7164d81a77be4fc3300e6 (diff)
downloadsparse-dev-2f255a14665d9b584a3de528242bb948ff63f977.tar.gz
fix diagnostic source path from command line
Now, diagnostic messages are prepended with the source path. But if the problem comes from a file included directly from the command line like: sparse -include some-buggy-file.c the prepended message will be: (null): note: in included file ... because there isn't a source path yet. So, initialize the source path to "command-line". Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation')
-rw-r--r--validation/preprocessor/bad-cmdline-include.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/validation/preprocessor/bad-cmdline-include.c b/validation/preprocessor/bad-cmdline-include.c
new file mode 100644
index 00000000..e4ee03f4
--- /dev/null
+++ b/validation/preprocessor/bad-cmdline-include.c
@@ -0,0 +1,11 @@
+#error some random error
+
+/*
+ * check-name: bad-cmdline-include
+ * check-command: sparse -include $file
+ *
+ * check-error-start
+command-line: note: in included file (through builtin):
+preprocessor/bad-cmdline-include.c:1:2: error: some random error
+ * check-error-end
+ */