Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Mar 2001 17:00:04 -0800 (PST)
From:      Seth Kingsley <sethk@osd.bsdi.com>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/25627: Cannot append hash after .elif in Makefile, (but can after .if)
Message-ID:  <200103150100.f2F104k00932@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/25627; it has been noted by GNATS.

From: Seth Kingsley <sethk@osd.bsdi.com>
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200103150100.f2F104k00932>