diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2019-01-22 11:05:31 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2019-01-22 11:05:31 +0200 |
commit | 9cc96ff20dac0d7d2c9091937395f85dc4fc8259 (patch) | |
tree | 24e849fb1fb12b4b46eff0e220eba9f8a6264616 /src/main.c | |
parent | 9fdcc7fc76f41b3b36161db28774c53803e93d91 (diff) | |
download | cflow-9cc96ff20dac0d7d2c9091937395f85dc4fc8259.tar.gz cflow-9cc96ff20dac0d7d2c9091937395f85dc4fc8259.tar.bz2 |
Bugfix
* src/main.c (main): Make sure preprocessor options are collected
before parsing source files.
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 16 |
1 files changed, 12 insertions, 4 deletions
@@ -783,12 +783,20 @@ main(int argc, char **argv) if (arglist) { struct linked_list_entry *p; - - for (p = arglist->head; p; p = p->next) { + /* First pass: collect options */ + for (p = linked_list_head(arglist); p; ) { + struct linked_list_entry *next = p->next; char *s = (char*)p->data; - if (s[0] == '-') + if (s[0] == '-') { pp_option(s); - else if (source(s) == 0) + linked_list_unlink(arglist, p); + } + p = next; + } + /* Second pass: collect sources */ + for (p = linked_list_head(arglist); p; p = p->next) { + char *s = (char*)p->data; + if (source(s) == 0) yyparse(); } } |