diff options
author | will <will@FreeBSD.org> | 2001-03-15 02:51:11 +0000 |
---|---|---|
committer | will <will@FreeBSD.org> | 2001-03-15 02:51:11 +0000 |
commit | 30e261c307c1465d0c1e2ca74ddbd8886812d581 (patch) | |
tree | 2e79eb6c82e9bfba0ec85f9ea094381c72065806 /usr.bin/make | |
parent | 1e1aef3713e79a600a134caaa6e2665050a32129 (diff) | |
download | FreeBSD-src-30e261c307c1465d0c1e2ca74ddbd8886812d581.zip FreeBSD-src-30e261c307c1465d0c1e2ca74ddbd8886812d581.tar.gz |
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!!)
Diffstat (limited to 'usr.bin/make')
-rw-r--r-- | usr.bin/make/parse.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c index 7dc9e61..2f1c336 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) { |