Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make make(1): fix wrong warning about missing delimiter



details:   https://anonhg.NetBSD.org/src/rev/7b5d6074eaa7
branches:  trunk
changeset: 974110:7b5d6074eaa7
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Jul 23 19:49:39 2020 +0000

description:
make(1): fix wrong warning about missing delimiter

diffstat:

 usr.bin/make/unit-tests/modmisc.exp |   2 --
 usr.bin/make/var.c                  |  20 +++++++++++---------
 2 files changed, 11 insertions(+), 11 deletions(-)

diffs (82 lines):

diff -r eb6deb4e9792 -r 7b5d6074eaa7 usr.bin/make/unit-tests/modmisc.exp
--- a/usr.bin/make/unit-tests/modmisc.exp       Thu Jul 23 19:46:55 2020 +0000
+++ b/usr.bin/make/unit-tests/modmisc.exp       Thu Jul 23 19:49:39 2020 +0000
@@ -29,7 +29,6 @@
 :a b b c:
 : b c:
 make: RE substitution error: (details omitted)
-make: Unclosed substitution for  (, missing)
 :C,word,____,:Q}:
 :a c:
 :x__ 3 x__ 3:
@@ -74,7 +73,6 @@
 mod-C-limits:22-ok:1 33 556
 mod-C-limits:capture:ihgfedcbaabcdefghijABCDEFGHIJa0a1a2rest
 make: RE substitution error: (details omitted)
-make: Unclosed substitution for UNDEF (, missing)
 mod-C-errors:
 mod-assign: first=1.
 mod-assign: last=3.
diff -r eb6deb4e9792 -r 7b5d6074eaa7 usr.bin/make/var.c
--- a/usr.bin/make/var.c        Thu Jul 23 19:46:55 2020 +0000
+++ b/usr.bin/make/var.c        Thu Jul 23 19:49:39 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.296 2020/07/23 19:32:54 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.297 2020/07/23 19:49:39 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.296 2020/07/23 19:32:54 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.297 2020/07/23 19:49:39 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c      8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.296 2020/07/23 19:32:54 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.297 2020/07/23 19:49:39 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -2485,20 +2485,23 @@
 
     args.pflags = 0;
     Var_Parse_State tmpparsestate = st->parsestate;
-    st->delim = st->tstr[1];
+    char delim = st->tstr[1];
     st->tstr += 2;
 
     st->cp = st->tstr;
 
-    char *re = ParseModifierPart(st->ctxt, &st->cp, st->delim,
+    char *re = ParseModifierPart(st->ctxt, &st->cp, delim,
                                 st->eflags, NULL, NULL, NULL);
-    if (re == NULL)
+    if (re == NULL) {
+       st->delim = delim;
        return FALSE;
-
-    args.replace = ParseModifierPart(st->ctxt, &st->cp, st->delim,
+    }
+
+    args.replace = ParseModifierPart(st->ctxt, &st->cp, delim,
                                     st->eflags, NULL, NULL, NULL);
     if (args.replace == NULL) {
        free(re);
+       st->delim = delim;
        return FALSE;
     }
 
@@ -2539,7 +2542,6 @@
     regfree(&args.re);
     free(args.replace);
     free(args.matches);
-    st->delim = '\0';
     return TRUE;
 }
 #endif



Home | Main Index | Thread Index | Old Index