scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 81cb385b648a5ae302c8a9f186714bd3d058f6e0
parent c5eff5581e67f209fde167a6fecdf0c936399571
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Fri, 25 Aug 2017 09:01:53 +0100

[driver] Improve message error generation

We need the message errors of the linker because the user needs
them to catch symbol errors. The fprintf of spawn was only seen
with -d, so in case of missing some tool we were failing without
seeing any message. Changing _Exit to abort forces validatetools()
to print a message. In the same way, if the first tool that fails
if different of CC1 or LD then we have to print an internal error
message, because CC1 and LD are the only tools authorized to fail.

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

diff --git a/driver/posix/scc.c b/driver/posix/scc.c @@ -280,12 +280,12 @@ spawn(int tool) dup2(t->out, 1); if (t->in > -1) dup2(t->in, 0); - if (!dflag && tool != CC1) + if (!dflag && tool != CC1 && tool != LD) dup2(devnullfd, 2); execvp(t->cmd, t->args.s); fprintf(stderr, "scc: execvp %s: %s\n", t->cmd, strerror(errno)); - _exit(1); + abort(); default: if (t->in > -1) close(t->in); @@ -334,7 +334,8 @@ validatetools(void) if (waitpid(t->pid, &st, 0) < 0 || !WIFEXITED(st) || WEXITSTATUS(st) != 0) { - if (!WIFEXITED(st) || tool != CC1 && tool != CC2) { + if (!WIFEXITED(st) || + !failure && tool != CC1 && tool != LD) { fprintf(stderr, "scc:%s: internal error\n", t->bin); }