From 19a7439eddfc8dcf8377ba443567803bf3cdc608 Mon Sep 17 00:00:00 2001 From: Hartmut Brandt Date: Thu, 22 Jul 2004 11:12:01 +0000 Subject: [PATCH] Fix handling of comments on .elif lines. The patch given in a followup to the PR failed, because the line skipping function is actually called from two places in the code to do quite different things (this should be two functions probably): in a false .if to skip to the next line beginning with a dot and to collect .for loops. In the seconds case we should not skip comments, because they are actually harder to handle than we need for the .if case and should defer this to the main code. PR: bin/25627 Submitted by: Seth Kingsley (original patch) --- usr.bin/make/parse.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c index e8a9935fcd23..9cbef9929553 100644 --- a/usr.bin/make/parse.c +++ b/usr.bin/make/parse.c @@ -2021,6 +2021,13 @@ ParseSkipLine(int skip, int keep_newline) while (((c = ParseReadc()) != '\n' || lastc == '\\') && c != EOF) { + if (skip && c == '#' && lastc != '\\') { + /* let a comment be terminated even by an escaped \n. + * This is consistent to comment handling in ParseReadLine */ + while ((c = ParseReadc()) != '\n' && c != EOF) + ; + break; + } if (c == '\n') { if (keep_newline) Buf_AddByte(buf, (Byte)c);