Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make Avoid the need to escape the # in :[#] when par...



details:   https://anonhg.NetBSD.org/src/rev/d6f32a55c2bb
branches:  trunk
changeset: 778399:d6f32a55c2bb
user:      sjg <sjg%NetBSD.org@localhost>
date:      Sat Mar 24 20:28:41 2012 +0000

description:
Avoid the need to escape the # in :[#] when parsing conditionals.

diffstat:

 usr.bin/make/parse.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (37 lines):

diff -r 8157bd6a440a -r d6f32a55c2bb usr.bin/make/parse.c
--- a/usr.bin/make/parse.c      Sat Mar 24 20:09:30 2012 +0000
+++ b/usr.bin/make/parse.c      Sat Mar 24 20:28:41 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parse.c,v 1.180 2011/11/06 19:46:56 christos Exp $     */
+/*     $NetBSD: parse.c,v 1.181 2012/03/24 20:28:41 sjg Exp $  */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: parse.c,v 1.180 2011/11/06 19:46:56 christos Exp $";
+static char rcsid[] = "$NetBSD: parse.c,v 1.181 2012/03/24 20:28:41 sjg Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)parse.c    8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: parse.c,v 1.180 2011/11/06 19:46:56 christos Exp $");
+__RCSID("$NetBSD: parse.c,v 1.181 2012/03/24 20:28:41 sjg Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -2524,7 +2524,9 @@
            }
            if (ch == '#' && comment == NULL) {
                /* Remember first '#' for comment stripping */
-               comment = line_end;
+               /* Unless previous char was '[', as in modifier :[#] */
+               if (!(ptr > line && ptr[-1] == '['))
+                   comment = line_end;
            }
            ptr++;
            if (ch == '\n')



Home | Main Index | Thread Index | Old Index