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 | |
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.
-rw-r--r-- | src/main.c | 16 |
1 files changed, 12 insertions, 4 deletions
@@ -783,12 +783,20 @@ main(int argc, char **argv) | |||
783 | 783 | ||
784 | if (arglist) { | 784 | if (arglist) { |
785 | struct linked_list_entry *p; | 785 | struct linked_list_entry *p; |
786 | 786 | /* First pass: collect options */ | |
787 | for (p = arglist->head; p; p = p->next) { | 787 | for (p = linked_list_head(arglist); p; ) { |
788 | struct linked_list_entry *next = p->next; | ||
788 | char *s = (char*)p->data; | 789 | char *s = (char*)p->data; |
789 | if (s[0] == '-') | 790 | if (s[0] == '-') { |
790 | pp_option(s); | 791 | pp_option(s); |
791 | else if (source(s) == 0) | 792 | linked_list_unlink(arglist, p); |
793 | } | ||
794 | p = next; | ||
795 | } | ||
796 | /* Second pass: collect sources */ | ||
797 | for (p = linked_list_head(arglist); p; p = p->next) { | ||
798 | char *s = (char*)p->data; | ||
799 | if (source(s) == 0) | ||
792 | yyparse(); | 800 | yyparse(); |
793 | } | 801 | } |
794 | } | 802 | } |