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 <sethk@osd.bsdi.com>  (thanks!!)
This commit is contained in:
Will Andrews 2001-03-15 02:51:11 +00:00
parent 64007795de
commit fff8dac495

View File

@ -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) {