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): move error handling code out of Undefi...



details:   https://anonhg.NetBSD.org/src/rev/1e4be283c239
branches:  trunk
changeset: 958157:1e4be283c239
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Dec 27 13:12:34 2020 +0000

description:
make(1): move error handling code out of UndefinedShortVarValue

diffstat:

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

diffs (50 lines):

diff -r 58b2548c6f52 -r 1e4be283c239 usr.bin/make/var.c
--- a/usr.bin/make/var.c        Sun Dec 27 12:45:33 2020 +0000
+++ b/usr.bin/make/var.c        Sun Dec 27 13:12:34 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.768 2020/12/27 11:03:00 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.769 2020/12/27 13:12:34 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -131,7 +131,7 @@
 #include "metachar.h"
 
 /*     "@(#)var.c      8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.768 2020/12/27 11:03:00 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.769 2020/12/27 13:12:34 rillig Exp $");
 
 typedef enum VarFlags {
        VAR_NONE        = 0,
@@ -3673,7 +3673,7 @@
 }
 
 static const char *
-UndefinedShortVarValue(char varname, const GNode *ctxt, VarEvalFlags eflags)
+UndefinedShortVarValue(char varname, const GNode *ctxt)
 {
        if (ctxt == VAR_CMDLINE || ctxt == VAR_GLOBAL) {
                /*
@@ -3696,7 +3696,7 @@
                        return "$(.ARCHIVE)";
                }
        }
-       return eflags & VARE_UNDEFERR ? var_Error : varUndefined;
+       return NULL;
 }
 
 /* Parse a variable name, until the end character or a colon, whichever
@@ -3803,7 +3803,12 @@
        if (v == NULL) {
                *pp += 2;
 
-               *out_FALSE_val = UndefinedShortVarValue(startc, ctxt, eflags);
+               *out_FALSE_val = UndefinedShortVarValue(startc, ctxt);
+               if (*out_FALSE_val == NULL) {
+                       *out_FALSE_val =
+                           eflags & VARE_UNDEFERR ? var_Error : varUndefined;
+               }
+
                if (opts.strict && *out_FALSE_val == var_Error) {
                        Parse_Error(PARSE_FATAL,
                            "Variable \"%s\" is undefined", name);



Home | Main Index | Thread Index | Old Index