scc

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

commit c9632f2365b7d225524bf28b6c8ec11136caca9e
parent 012a5fae45b1e819d9970bab19756c4c3f3fd6aa
Author: Quentin Rameau <quinq@fifth.space>
Date:   Wed, 21 Apr 2021 21:42:38 +0200

cmd/cc: Fix cc1 tool name generation

Since edabe2f, there is no targe-specific cc1, and this change was
forgotten in the driver.

Diffstat:
Msrc/cmd/cc/posix/cc.c | 16++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/cmd/cc/posix/cc.c b/src/cmd/cc/posix/cc.c @@ -141,14 +141,14 @@ setargv0(int tool, char *arg) newitem(&t->args, arg); } -static int -qbe(int tool) +static char * +cc12fmt(int tool) { - if (tool != CC2 || !Qflag) - return 0; - if (!strcmp(arch, "amd64") && !strcmp(abi, "sysv")) - return 1; - return 0; + if (tool == CC1) + return "%s"; + if (Qflag && !strcmp(arch, "amd64") && !strcmp(abi, "sysv")) + return "%s-qbe_%s-%s"; + return "%s-%s-%s"; } static int @@ -170,7 +170,7 @@ inittool(int tool) addarg(tool, path(sysincludes[n])); } case CC2: - fmt = (qbe(tool)) ? "%s-qbe_%s-%s" : "%s-%s-%s"; + fmt = cc12fmt(tool); n = snprintf(t->bin, sizeof(t->bin), fmt, t->cmd, arch, abi); if (n < 0 || n >= sizeof(t->bin)) die("cc: target tool name is too long");