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: do not evaluate modifiers ':M' and ':N' i...



details:   https://anonhg.NetBSD.org/src/rev/64ede50eb6bc
branches:  trunk
changeset: 953639:64ede50eb6bc
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Mar 14 19:25:05 2021 +0000

description:
make: do not evaluate modifiers ':M' and ':N' in parse-only mode

No functional change outside debug mode (-dv for ModifyWord_Match).

diffstat:

 usr.bin/make/var.c |  15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diffs (40 lines):

diff -r b67e2b1ad341 -r 64ede50eb6bc usr.bin/make/var.c
--- a/usr.bin/make/var.c        Sun Mar 14 19:21:28 2021 +0000
+++ b/usr.bin/make/var.c        Sun Mar 14 19:25:05 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.875 2021/03/14 19:21:28 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.876 2021/03/14 19:25:05 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -140,7 +140,7 @@
 #include "metachar.h"
 
 /*     "@(#)var.c      8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.875 2021/03/14 19:21:28 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.876 2021/03/14 19:25:05 rillig Exp $");
 
 typedef enum VarFlags {
        VFL_NONE        = 0,
@@ -2811,14 +2811,17 @@
 static ApplyModifierResult
 ApplyModifier_Match(const char **pp, ApplyModifiersState *st)
 {
-       const char *mod = *pp;
+       const char mod = **pp;
        char *pattern;
-       ModifyWordProc modifyWord;
 
        ParseModifier_Match(pp, st, &pattern);
 
-       modifyWord = mod[0] == 'M' ? ModifyWord_Match : ModifyWord_NoMatch;
-       ModifyWords(st, modifyWord, pattern, st->oneBigWord);
+       if (st->expr->eflags & VARE_WANTRES) {
+               ModifyWordProc modifyWord =
+                   mod == 'M' ? ModifyWord_Match : ModifyWord_NoMatch;
+               ModifyWords(st, modifyWord, pattern, st->oneBigWord);
+       }
+
        free(pattern);
        return AMR_OK;
 }



Home | Main Index | Thread Index | Old Index