scc

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

commit 63d94614fadf26fe058afb1afa9c9b7686efac8f
parent 0c62dba5426ebaeaba6bef15f70862c4e869c767
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Thu,  2 Jun 2016 11:33:57 +0200

[driver] Move wait logic to build()

We need this code in build because we have to wait for all the
process before moving to compile the next source.

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

diff --git a/driver/posix/scc.c b/driver/posix/scc.c @@ -189,6 +189,15 @@ build(char *file) spawn(settool(inittool(tool), out)); in = tool; } + for (i = 0; i < NR_TOOLS; ++i) { + if ((pid = tools[i].pid) == 0) + continue; + if (waitpid(pid, &st, 0) < 0) + exit(-1); + tools[i].pid = 0; + if (!WIFEXITED(st) || WEXITSTATUS(st) != 0) + exit(-1); + } } static void @@ -236,14 +245,5 @@ main(int argc, char *argv[]) build(*argv); - for (i = 0; i < NR_TOOLS; ++i) { - if ((pid = wait(&st)) < 0) - break; - if (pid == tools[i].pid) - tools[i].pid = 0; - if (!WIFEXITED(st) || WEXITSTATUS(st) != 0) - exit(-1); - } - return 0; }