Module Name: src Committed By: rillig Date: Thu Jul 23 19:49:39 UTC 2020
Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: modmisc.exp Log Message: make(1): fix wrong warning about missing delimiter To generate a diff of this commit: cvs rdiff -u -r1.296 -r1.297 src/usr.bin/make/var.c cvs rdiff -u -r1.26 -r1.27 src/usr.bin/make/unit-tests/modmisc.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.296 src/usr.bin/make/var.c:1.297 --- src/usr.bin/make/var.c:1.296 Thu Jul 23 19:32:54 2020 +++ src/usr.bin/make/var.c Thu Jul 23 19:49:39 2020 @@ -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 @@ ApplyModifier_Regex(ApplyModifiersState 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 @@ ApplyModifier_Regex(ApplyModifiersState regfree(&args.re); free(args.replace); free(args.matches); - st->delim = '\0'; return TRUE; } #endif Index: src/usr.bin/make/unit-tests/modmisc.exp diff -u src/usr.bin/make/unit-tests/modmisc.exp:1.26 src/usr.bin/make/unit-tests/modmisc.exp:1.27 --- src/usr.bin/make/unit-tests/modmisc.exp:1.26 Thu Jul 23 19:46:55 2020 +++ src/usr.bin/make/unit-tests/modmisc.exp Thu Jul 23 19:49:39 2020 @@ -29,7 +29,6 @@ mod-C: :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-missing:1 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.