diff options
author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-08-08 18:40:39 +0200 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-08-08 18:40:39 +0200 |
commit | 77b4fdcada5f3cefdad3d5b6553763a504f06283 (patch) | |
tree | 18460d8907330cca3c6f1630ca9bf5b144e8126f | |
parent | e1578773182e8f69c3a0cd8add8dfbe7561a8240 (diff) | |
parent | 2f255a14665d9b584a3de528242bb948ff63f977 (diff) | |
download | sparse-77b4fdcada5f3cefdad3d5b6553763a504f06283.tar.gz |
Merge branch 'prev-stream' into next
* fix diagnostic source path from command line
* fix diagnostic source path for invalid streams
-rw-r--r-- | lib.c | 2 | ||||
-rw-r--r-- | tokenize.c | 5 | ||||
-rw-r--r-- | validation/preprocessor/bad-cmdline-include.c | 11 |
3 files changed, 17 insertions, 1 deletions
@@ -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(); @@ -66,7 +66,10 @@ int stream_prev(int stream) { if (stream < 0 || stream > input_stream_nr) return -1; - return input_streams[stream].pos.stream; + stream = input_streams[stream].pos.stream; + if (stream > input_stream_nr) + return -1; + return stream; } static struct position stream_pos(stream_t *stream) 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 + */ |