@@ -383,6 +383,8 @@ struct symbol_list *sparse_initialize(int argc, char **argv, struct string_list
char **args;
struct symbol_list *list;
+ base_filename = "command-line";
+
// Initialize symbol stream first, so that we can add defines etc
init_symbols();
new file mode 100644
@@ -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
+ */
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> --- lib.c | 2 ++ validation/preprocessor/bad-cmdline-include.c | 11 +++++++++++ 2 files changed, 13 insertions(+) create mode 100644 validation/preprocessor/bad-cmdline-include.c