summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org>2019-01-22 09:05:31 (GMT)
committer Sergey Poznyakoff <gray@gnu.org>2019-01-22 09:05:31 (GMT)
commit9cc96ff20dac0d7d2c9091937395f85dc4fc8259 (patch) (side-by-side diff)
tree24e849fb1fb12b4b46eff0e220eba9f8a6264616
parent9fdcc7fc76f41b3b36161db28774c53803e93d91 (diff)
downloadcflow-9cc96ff20dac0d7d2c9091937395f85dc4fc8259.tar.gz
cflow-9cc96ff20dac0d7d2c9091937395f85dc4fc8259.tar.bz2
Bugfix
* src/main.c (main): Make sure preprocessor options are collected before parsing source files.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--src/main.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/main.c b/src/main.c
index 301de44..e67b3e0 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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();
}
}

Return to:

Send suggestions and report system problems to the System administrator.