From owner-freebsd-bugs Wed Mar 14 17: 0:12 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 99DF737B718 for ; Wed, 14 Mar 2001 17:00:04 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f2F104k00932; Wed, 14 Mar 2001 17:00:04 -0800 (PST) (envelope-from gnats) Date: Wed, 14 Mar 2001 17:00:04 -0800 (PST) Message-Id: <200103150100.f2F104k00932@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Seth Kingsley Subject: Re: bin/25627: Cannot append hash after .elif in Makefile, (but can after .if) Reply-To: Seth Kingsley Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The following reply was made to PR bin/25627; it has been noted by GNATS. From: Seth Kingsley To: freebsd-gnats-submit@FreeBSD.org, jhs@jhs.muc.de Cc: Subject: Re: bin/25627: Cannot append hash after .elif in Makefile, (but can after .if) Date: Wed, 14 Mar 2001 16:56:58 -0800 Make's parser skips down to the next conditional (line beginning with a '.') when the current conditional evaluates to false. The function parse.c:ParseSkipLine() does not handle comments in the same way that parse.c:ParseReadLine() does, and thus causes errors such as this one. This patch adds the correct behavior to parse.c:ParseSkipLine. Index: parse.c =================================================================== RCS file: /ncvs/src/usr.bin/make/parse.c,v retrieving revision 1.22 diff -u -r1.22 parse.c --- parse.c 1999/08/28 01:03:35 1.22 +++ parse.c 2001/03/14 21:02:37 @@ -2059,18 +2059,24 @@ 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) { -- || Seth Kingsley || BSDi/Open Source Division || sethk@osd.bsdi.com || To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message