scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit e4101bbd30eb454370fc59546daa49c76f032511
parent 3c3f8ca7a9acc53b9846871a7988174143c1d3ff
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Wed, 23 Aug 2017 19:35:11 +0200

[driver] Add complex logic to determine if qbe is needed

Qbe use depends of the value of Qflag, tool and the selected
target, so it is better to use a different function and
keep the logic there.

Diffstat:
Mdriver/posix/scc.c | 12+++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/driver/posix/scc.c b/driver/posix/scc.c @@ -98,6 +98,16 @@ setargv0(int tool, char *arg) } static int +qbe(int tool) +{ + if (tool != CC2 || !Qflag) + return 0; + if (!strcmp(arch, "amd64") && !strcmp(abi, "sysv")) + return 1; + return 0; +} + +static int inittool(int tool) { struct tool *t = &tools[tool]; @@ -110,7 +120,7 @@ inittool(int tool) switch (tool) { case CC1: /* FALLTHROUGH */ case CC2: - fmt = (Qflag && tool == CC2) ? "%s-qbe_%s-%s" : "%s-%s-%s"; + fmt = (qbe(tool)) ? "%s-qbe_%s-%s" : "%s-%s-%s"; n = snprintf(t->bin, sizeof(t->bin), fmt, t->cmd, arch, abi); if (n < 0 || n >= sizeof(t->bin)) die("scc: target tool name too long");