From fff8dac495fde011c2d88115003beb67ba892b99 Mon Sep 17 00:00:00 2001 From: Will Andrews Date: Thu, 15 Mar 2001 02:51:11 +0000 Subject: [PATCH] Fix make(1) bug: nested comments may be placed in .if, .else .if, and .endif statements but can't be placed in .elif. Basically, the problem was that ParseSkipLine() didn't handle comments the same way that ParseReadLine() did, and thus you had errors with comments that are on a conditional line (i.e. "^.") rather than a non-conditional line. MFC candidate for 4.3-STABLE and 3.5-STABLE. PR: 25627 Bug found by: jhs Fix submitted by: Seth Kingsley (thanks!!) --- usr.bin/make/parse.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c index 7dc9e61073e..2f1c3369a7f 100644 --- a/usr.bin/make/parse.c +++ b/usr.bin/make/parse.c @@ -2057,18 +2057,24 @@ ParseSkipLine(skip) while (((c = ParseReadc()) != '\n' || lastc == '\\') && c != EOF) { - if (c == '\n') { - Buf_ReplaceLastByte(buf, (Byte)' '); - lineno++; + if (c == '#' && lastc != '\\') { + while ((c = ParseReadc()) != '\n' && c != EOF); - while ((c = ParseReadc()) == ' ' || c == '\t'); + break; + } else { + if (c == '\n') { + Buf_ReplaceLastByte(buf, (Byte)' '); + lineno++; - if (c == EOF) - break; + while ((c = ParseReadc()) == ' ' || c == '\t'); + + if (c == EOF) + break; + } + + Buf_AddByte(buf, (Byte)c); + lastc = c; } - - Buf_AddByte(buf, (Byte)c); - lastc = c; } if (c == EOF) {