commit ceac1b8776b0635db1af5d67e5559f2f9b64c428
parent 158be47131784180dcf84ee34dfc22865e94796b
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Fri, 19 Jan 2024 18:23:50 +0100
make: Put always a \n in lines read
When a comment was read the rest of the line
was discarded including the newline that finished
the comment, making that the next line was finishing
rules or macro definitions.
Diffstat:
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/cmd/make/parser.c b/src/cmd/make/parser.c
@@ -297,12 +297,12 @@ repeat:
c = getc(fp);
if (c == '\n' || c == EOF) {
input->loc.lineno++;
- if (c == '\n')
- *s++ = c;
+ *s++ = '\n';
break;
}
if (c == '#') {
comment(fp);
+ *s++ = '\n';
break;
}
if (c > UCHAR_MAX || c < 0)
diff --git a/tests/make/execute/0057-default.sh b/tests/make/execute/0057-default.sh
@@ -5,7 +5,9 @@ trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT TERM HUP
tmp1=tmp1.$$
tmp2=tmp2.$$
-echo make: error: DEFAULT rule with prerequisites > $tmp2
+cat > $tmp2 <<'EOF'
+make: error: <stdin>:4: DEFAULT rule with prerequisites
+EOF
scc-make -f- <<EOF > $tmp1 2>&1
.DEFAULT: all