scc

Simple C99 Compiler
Log | Files | Refs | README | LICENSE

commit 665c38d088b19183501943cd0b179bc8d6b75357
parent 5e7b55dcc252f28c5c21b347dadaa8209fd061bb
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Tue, 21 Apr 2015 13:47:45 +0200

Rewrite main loop in cc1

The original loop was a bit ugly because the three parts of
the for were totally unrelated, so it was an abuse of the for
loop, where it helps if the three parts are concerned about
some common thing.

Diffstat:
cc1/main.c | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/cc1/main.c b/cc1/main.c @@ -69,8 +69,10 @@ repeat: init_keywords(); init_expr(); open_file(input); - for (next(); yytoken != EOFTOK; extdecl()); - /* nothing */; + next(); + + while (yytoken != EOFTOK) + extdecl(); if (ferror(stdin) || ferror(stdout)) { die("error reading/writing from input/output:%s",