scc

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

commit b34aa2c27fb0724d6bd2ffda631feaa503122ed4
parent e93f759a6bcd0d6e812a3f6c6f6146c637f7145c
Author: Quentin Rameau <quinq@fifth.space>
Date:   Mon, 23 Jan 2017 14:39:27 +0100

[driver] fix and simplify target tool name setting

Diffstat:
Mdriver/posix/scc.c | 13++++---------
1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/driver/posix/scc.c b/driver/posix/scc.c @@ -38,9 +38,9 @@ static struct tool { int in, out, init; pid_t pid; } tools[] = { - [CC1] = { .bin = "cc1" }, + [CC1] = { .cmd = "cc1" }, [TEEIR] = { .bin = "tee", .cmd = "tee", }, - [CC2] = { .bin = "cc2" }, + [CC2] = { .cmd = "cc2" }, [TEEQBE] = { .bin = "tee", .cmd = "tee", }, [QBE] = { .bin = "qbe", .cmd = "qbe", }, [TEEAS] = { .bin = "tee", .cmd = "tee", }, @@ -95,7 +95,6 @@ static int inittool(int tool) { struct tool *t = &tools[tool]; - size_t binln; int n; if (t->init) @@ -104,15 +103,11 @@ inittool(int tool) switch (tool) { case CC1: /* FALLTHROUGH */ case CC2: - binln = strlen(t->bin); if (!arch) arch = ARCH; - n = snprintf(t->bin + binln, - sizeof(t->bin) - binln, - "-%s", arch); + n = snprintf(t->bin, sizeof(t->bin), "%s-%s", t->cmd, arch); if (n < 0 || n >= sizeof(t->bin)) - die("scc: target tool bin too long"); - binln = strlen(t->bin); + die("scc: target tool name too long"); if (!execpath) execpath = PREFIX "/libexec/scc";