scc

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

commit 941eee05b2a817286159b9470c683cebd27f2345
parent ce844747c2ee341327c4189efe1deaf12b0dd841
Author: Quentin Rameau <quinq@fifth.space>
Date:   Wed,  1 Jun 2016 19:44:34 +0200

[driver] add S flag for stopping after assembly output

Diffstat:
driver/posix/scc.c | 19+++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/driver/posix/scc.c b/driver/posix/scc.c @@ -42,7 +42,7 @@ static struct tool { char *argv0; static char *arch; -static int Eflag, kflag; +static int Eflag, Sflag, kflag; static void terminate(void) @@ -159,13 +159,17 @@ build(char *file) ADDARG(tool, file); break; case CC2: - out = (!arch || strcmp(arch, "qbe")) ? AS : QBE; - if (out != QBE) - keepfile = kflag; + if (!arch || strcmp(arch, "qbe")) { + out = Sflag ? NR_TOOLS : AS; + keepfile = (Sflag || kflag); + } else { + out = QBE; + keepfile = Sflag; + } break; case QBE: - out = AS; - keepfile = kflag; + out = Sflag ? NR_TOOLS : AS; + keepfile = (Sflag || kflag); break; case AS: out = NR_TOOLS; @@ -208,6 +212,9 @@ main(int argc, char *argv[]) Eflag = 1; ADDARG(CC1, "-E"); break; + case 'S': + Sflag = 1; + break; case 'k': kflag = 1; break;