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): rename VarParseErrors to VarParseResult



details:   https://anonhg.NetBSD.org/src/rev/d44ebd81cd43
branches:  trunk
changeset: 944173:d44ebd81cd43
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Sep 22 06:06:18 2020 +0000

description:
make(1): rename VarParseErrors to VarParseResult

The name VPE_OK was confusing since it was not an error at all.

diffstat:

 usr.bin/make/cond.c    |  10 +++++-----
 usr.bin/make/nonints.h |  32 ++++++++++++++++----------------
 usr.bin/make/var.c     |  24 ++++++++++++------------
 3 files changed, 33 insertions(+), 33 deletions(-)

diffs (218 lines):

diff -r c19088f012ef -r d44ebd81cd43 usr.bin/make/cond.c
--- a/usr.bin/make/cond.c       Tue Sep 22 05:55:49 2020 +0000
+++ b/usr.bin/make/cond.c       Tue Sep 22 06:06:18 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cond.c,v 1.147 2020/09/14 23:09:34 rillig Exp $        */
+/*     $NetBSD: cond.c,v 1.148 2020/09/22 06:06:18 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -93,7 +93,7 @@
 #include "dir.h"
 
 /*     "@(#)cond.c     8.2 (Berkeley) 1/2/94"  */
-MAKE_RCSID("$NetBSD: cond.c,v 1.147 2020/09/14 23:09:34 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.148 2020/09/22 06:06:18 rillig Exp $");
 
 /*
  * The parsing of conditional expressions is based on this grammar:
@@ -417,7 +417,7 @@
     Boolean qt;
     const char *start;
     VarEvalFlags eflags;
-    VarParseErrors errors;
+    VarParseResult parseResult;
 
     Buf_Init(&buf, 0);
     str = NULL;
@@ -461,10 +461,10 @@
                     (doEval ? VARE_WANTRES : 0);
            nested_p = par->p;
            atStart = nested_p == start;
-           errors = Var_Parse(&nested_p, VAR_CMD, eflags, &str, freeIt);
+           parseResult = Var_Parse(&nested_p, VAR_CMD, eflags, &str, freeIt);
            /* TODO: handle errors */
            if (str == var_Error) {
-               if (errors & VPE_ANY_MSG)
+               if (parseResult & VPR_ANY_MSG)
                    par->printedError = TRUE;
                if (*freeIt) {
                    free(*freeIt);
diff -r c19088f012ef -r d44ebd81cd43 usr.bin/make/nonints.h
--- a/usr.bin/make/nonints.h    Tue Sep 22 05:55:49 2020 +0000
+++ b/usr.bin/make/nonints.h    Tue Sep 22 06:06:18 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nonints.h,v 1.124 2020/09/22 04:05:41 rillig Exp $     */
+/*     $NetBSD: nonints.h,v 1.125 2020/09/22 06:06:18 rillig Exp $     */
 
 /*-
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -216,48 +216,48 @@
 typedef enum {
 
     /* Both parsing and evaluation succeeded. */
-    VPE_OK             = 0x0000,
+    VPR_OK             = 0x0000,
 
     /* See if a message has already been printed for this error. */
-    VPE_ANY_MSG                = 0x0001,
+    VPR_ANY_MSG                = 0x0001,
 
     /* Parsing failed.
      * No error message has been printed yet.
-     * Deprecated, migrate to VPE_PARSE_MSG instead. */
-    VPE_PARSE_SILENT   = 0x0002,
+     * Deprecated, migrate to VPR_PARSE_MSG instead. */
+    VPR_PARSE_SILENT   = 0x0002,
 
     /* Parsing failed.
      * An error message has already been printed. */
-    VPE_PARSE_MSG      = VPE_PARSE_SILENT | VPE_ANY_MSG,
+    VPR_PARSE_MSG      = VPR_PARSE_SILENT | VPR_ANY_MSG,
 
     /* Parsing succeeded.
      * During evaluation, VARE_UNDEFERR was set and there was an undefined
      * variable.
      * No error message has been printed yet.
-     * Deprecated, migrate to VPE_UNDEF_MSG instead. */
-    VPE_UNDEF_SILENT   = 0x0004,
+     * Deprecated, migrate to VPR_UNDEF_MSG instead. */
+    VPR_UNDEF_SILENT   = 0x0004,
 
     /* Parsing succeeded.
      * During evaluation, VARE_UNDEFERR was set and there was an undefined
      * variable.
      * An error message has already been printed. */
-    VPE_UNDEF_MSG      = VPE_UNDEF_SILENT | VPE_ANY_MSG,
+    VPR_UNDEF_MSG      = VPR_UNDEF_SILENT | VPR_ANY_MSG,
 
     /* Parsing succeeded.
      * Evaluation failed.
      * No error message has been printed yet.
-     * Deprecated, migrate to VPE_EVAL_MSG instead. */
-    VPE_EVAL_SILENT    = 0x0006,
+     * Deprecated, migrate to VPR_EVAL_MSG instead. */
+    VPR_EVAL_SILENT    = 0x0006,
 
     /* Parsing succeeded.
      * Evaluation failed.
      * An error message has already been printed. */
-    VPE_EVAL_MSG       = VPE_EVAL_SILENT | VPE_ANY_MSG,
+    VPR_EVAL_MSG       = VPR_EVAL_SILENT | VPR_ANY_MSG,
 
     /* The exact error handling status is not known yet.
-     * Deprecated, migrate to VPE_OK or any VPE_*_MSG instead. */
-    VPE_UNKNOWN                = 0x0008
-} VarParseErrors;
+     * Deprecated, migrate to VPR_OK or any VPE_*_MSG instead. */
+    VPR_UNKNOWN                = 0x0008
+} VarParseResult;
 
 void Var_Delete(const char *, GNode *);
 void Var_Set(const char *, const char *, GNode *);
@@ -265,7 +265,7 @@
 void Var_Append(const char *, const char *, GNode *);
 Boolean Var_Exists(const char *, GNode *);
 const char *Var_Value(const char *, GNode *, char **);
-VarParseErrors Var_Parse(const char **, GNode *, VarEvalFlags,
+VarParseResult Var_Parse(const char **, GNode *, VarEvalFlags,
                         const char **, void **);
 char *Var_Subst(const char *, GNode *, VarEvalFlags);
 void Var_Init(void);
diff -r c19088f012ef -r d44ebd81cd43 usr.bin/make/var.c
--- a/usr.bin/make/var.c        Tue Sep 22 05:55:49 2020 +0000
+++ b/usr.bin/make/var.c        Tue Sep 22 06:06:18 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.525 2020/09/22 05:55:49 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.526 2020/09/22 06:06:18 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -121,7 +121,7 @@
 #include    "metachar.h"
 
 /*     "@(#)var.c      8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.525 2020/09/22 05:55:49 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.526 2020/09/22 06:06:18 rillig Exp $");
 
 #define VAR_DEBUG_IF(cond, fmt, ...)   \
     if (!(DEBUG(VAR) && (cond)))       \
@@ -3433,7 +3433,7 @@
  *-----------------------------------------------------------------------
  */
 /* coverity[+alloc : arg-*4] */
-VarParseErrors
+VarParseResult
 Var_Parse(const char **pp, GNode *ctxt, VarEvalFlags eflags,
          const char **out_val, void **freePtr)
 {
@@ -3478,7 +3478,7 @@
        if (!ValidShortVarname(startc, start)) {
            (*pp)++;
            *out_val = var_Error;
-           return VPE_PARSE_MSG;
+           return VPR_PARSE_MSG;
        }
 
        name[0] = startc;
@@ -3490,9 +3490,9 @@
            *out_val = ShortVarValue(startc, ctxt, eflags);
            if (DEBUG(LINT) && *out_val == var_Error) {
                Parse_Error(PARSE_FATAL, "Variable \"%s\" is undefined", name);
-               return VPE_UNDEF_MSG;
+               return VPR_UNDEF_MSG;
            }
-           return eflags & VARE_UNDEFERR ? VPE_UNDEF_SILENT : VPE_OK;
+           return eflags & VARE_UNDEFERR ? VPR_UNDEF_SILENT : VPR_OK;
        } else {
            haveModifier = FALSE;
            p = start + 1;
@@ -3515,7 +3515,7 @@
            *pp = p;
            free(varname);
            *out_val = var_Error;
-           return VPE_PARSE_MSG;
+           return VPR_PARSE_MSG;
        }
 
        v = VarFind(varname, ctxt, FIND_ENV | FIND_GLOBAL | FIND_CMD);
@@ -3557,7 +3557,7 @@
                    *freePtr = pstr;
                    free(varname);
                    *out_val = pstr;
-                   return VPE_OK;
+                   return VPR_OK;
                }
 
                if ((eflags & VARE_UNDEFERR) && (eflags & VARE_WANTRES) &&
@@ -3567,18 +3567,18 @@
                                varname);
                    free(varname);
                    *out_val = var_Error;
-                   return VPE_UNDEF_MSG;
+                   return VPR_UNDEF_MSG;
                }
 
                if (eflags & VARE_UNDEFERR) {
                    free(varname);
                    *out_val = var_Error;
-                   return VPE_UNDEF_SILENT;
+                   return VPR_UNDEF_SILENT;
                }
 
                free(varname);
                *out_val = varNoError;
-               return VPE_OK;
+               return VPR_OK;
            }
 
            /* The variable expression is based on an undefined variable.
@@ -3686,7 +3686,7 @@
        free(v);
     }
     *out_val = nstr;
-    return VPE_UNKNOWN;
+    return VPR_UNKNOWN;
 }
 
 /* Substitute for all variables in the given string in the given context.



Home | Main Index | Thread Index | Old Index