scc

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

commit 8522e25a5878046fa67777cdb7ad65325a5d1d1b
parent b73a41f156de11e9872b275400ff116373404ac6
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Wed, 17 Jan 2024 19:12:58 +0100

make: Flush echo before running

It is desirable to flush the output stream before
running the command because depending in how  the
libc handles the buffer it can happen  that  the
command prints its output before the echo is printed,
being really confusing for the user.

Diffstat:
Msrc/cmd/make/rules.c | 4+++-
Mtests/make/execute/0006-iflag.sh | 2+-
Mtests/make/execute/0007-iflag.sh | 4++--
Mtests/make/execute/0008-ignore.sh | 2+-
Mtests/make/execute/0009-ignore.sh | 2+-
Mtests/make/execute/0010-kflag.sh | 2+-
Mtests/make/execute/0011-kflag.sh | 2+-
7 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/src/cmd/make/rules.c b/src/cmd/make/rules.c @@ -197,8 +197,10 @@ out_loop: at = 1; if (nflag) at = 0; - if (!at) + if (!at) { puts(s); + fflush(stdout); + } if (nflag && !plus) return 0; diff --git a/tests/make/execute/0006-iflag.sh b/tests/make/execute/0006-iflag.sh @@ -6,9 +6,9 @@ tmp1=tmp1.$$ tmp2=tmp2.$$ cat <<EOF > $tmp2 +no-valid-program sh: 1: no-valid-program: not found -i -no-valid-program EOF scc-make -if test.mk error print-makeflags > $tmp1 2>&1 diff --git a/tests/make/execute/0007-iflag.sh b/tests/make/execute/0007-iflag.sh @@ -6,11 +6,11 @@ tmp1=tmp1.$$ tmp2=tmp2.$$ cat <<EOF > $tmp2 +no-valid-program sh: 1: no-valid-program: not found -i -no-valid-program EOF MAKEFLAGS=-i scc-make -f test.mk error print-makeflags > $tmp1 2>&1 -diff -u $tmp1 $tmp2 +diff $tmp1 $tmp2 diff --git a/tests/make/execute/0008-ignore.sh b/tests/make/execute/0008-ignore.sh @@ -6,9 +6,9 @@ tmp1=tmp1.$$ tmp2=tmp2.$$ cat <<EOF > $tmp2 +no-valid-program sh: 1: no-valid-program: not found Hello World! -no-valid-program EOF scc-make -f test.mk ignored-error hello > $tmp1 2>&1 diff --git a/tests/make/execute/0009-ignore.sh b/tests/make/execute/0009-ignore.sh @@ -17,9 +17,9 @@ error: EOF cat <<EOF > $tmp2 +no-valid-program sh: 1: no-valid-program: not found make: error: don't know how to make hello -no-valid-program EOF scc-make -f $tmp3 error hello > $tmp1 2>&1 diff --git a/tests/make/execute/0010-kflag.sh b/tests/make/execute/0010-kflag.sh @@ -7,11 +7,11 @@ tmp2=tmp2.$$ cat <<EOF > $tmp2 -k +no-valid-program sh: 1: no-valid-program: not found make: warning: target error: error 32512 Hello World! make: warning: target follow not remade because of errors -no-valid-program EOF (set -e diff --git a/tests/make/execute/0011-kflag.sh b/tests/make/execute/0011-kflag.sh @@ -7,11 +7,11 @@ tmp2=tmp2.$$ cat <<EOF > $tmp2 -k +no-valid-program sh: 1: no-valid-program: not found make: warning: target error: error 32512 Hello World! make: warning: target follow not remade because of errors -no-valid-program EOF (set -e