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: rename VARE_NONE to VARE_PARSE_ONLY



details:   https://anonhg.NetBSD.org/src/rev/5f21f9890c6c
branches:  trunk
changeset: 953655:5f21f9890c6c
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Mar 15 11:41:07 2021 +0000

description:
make: rename VARE_NONE to VARE_PARSE_ONLY

The name 'NONE' described the bit pattern, which was not useful to
understand its meaning.  Omitting VARE_WANTRES only parses the
expression, without evaluating any part of it.

No functional change, not even in debug mode since Enum_FlagsToString
always returns "none" for all-bits-unset.

diffstat:

 usr.bin/make/cond.c    |  12 ++++++------
 usr.bin/make/nonints.h |   4 ++--
 usr.bin/make/parse.c   |  10 +++++-----
 usr.bin/make/suff.c    |   6 +++---
 usr.bin/make/var.c     |  14 +++++++-------
 5 files changed, 23 insertions(+), 23 deletions(-)

diffs (186 lines):

diff -r 8114a9cc47d3 -r 5f21f9890c6c usr.bin/make/cond.c
--- a/usr.bin/make/cond.c       Mon Mar 15 10:58:05 2021 +0000
+++ b/usr.bin/make/cond.c       Mon Mar 15 11:41:07 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cond.c,v 1.257 2021/02/22 23:21:33 rillig Exp $        */
+/*     $NetBSD: cond.c,v 1.258 2021/03/15 11:41:07 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -95,7 +95,7 @@
 #include "dir.h"
 
 /*     "@(#)cond.c     8.2 (Berkeley) 1/2/94"  */
-MAKE_RCSID("$NetBSD: cond.c,v 1.257 2021/02/22 23:21:33 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.258 2021/03/15 11:41:07 rillig Exp $");
 
 /*
  * The parsing of conditional expressions is based on this grammar:
@@ -266,7 +266,7 @@
                         */
                        VarEvalFlags eflags = doEval
                            ? VARE_WANTRES | VARE_UNDEFERR
-                           : VARE_NONE;
+                           : VARE_PARSE_ONLY;
                        FStr nestedVal;
                        (void)Var_Parse(&p, SCOPE_CMDLINE, eflags, &nestedVal);
                        /* TODO: handle errors */
@@ -422,7 +422,7 @@
        /* if we are in quotes, an undefined variable is ok */
        eflags = doEval && !quoted ? VARE_WANTRES | VARE_UNDEFERR
            : doEval ? VARE_WANTRES
-           : VARE_NONE;
+           : VARE_PARSE_ONLY;
 
        nested_p = par->p;
        atStart = nested_p == start;
@@ -740,8 +740,8 @@
        *out_arg = NULL;
 
        (*pp)--;                /* Make (*pp)[1] point to the '('. */
-       (void)Var_Parse(pp, SCOPE_CMDLINE, doEval ? VARE_WANTRES : VARE_NONE,
-           &val);
+       (void)Var_Parse(pp, SCOPE_CMDLINE,
+           doEval ? VARE_WANTRES : VARE_PARSE_ONLY, &val);
        /* TODO: handle errors */
        /* If successful, *pp points beyond the closing ')' now. */
 
diff -r 8114a9cc47d3 -r 5f21f9890c6c usr.bin/make/nonints.h
--- a/usr.bin/make/nonints.h    Mon Mar 15 10:58:05 2021 +0000
+++ b/usr.bin/make/nonints.h    Mon Mar 15 11:41:07 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nonints.h,v 1.203 2021/02/14 21:32:58 rillig Exp $     */
+/*     $NetBSD: nonints.h,v 1.204 2021/03/15 11:41:07 rillig Exp $     */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -293,7 +293,7 @@
 void Var_End(void);
 
 typedef enum VarEvalFlags {
-       VARE_NONE               = 0,
+       VARE_PARSE_ONLY         = 0,
 
        /*
         * Expand and evaluate variables during parsing.
diff -r 8114a9cc47d3 -r 5f21f9890c6c usr.bin/make/parse.c
--- a/usr.bin/make/parse.c      Mon Mar 15 10:58:05 2021 +0000
+++ b/usr.bin/make/parse.c      Mon Mar 15 11:41:07 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parse.c,v 1.550 2021/02/22 23:21:33 rillig Exp $       */
+/*     $NetBSD: parse.c,v 1.551 2021/03/15 11:41:07 rillig Exp $       */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
 #include "pathnames.h"
 
 /*     "@(#)parse.c    8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.550 2021/02/22 23:21:33 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.551 2021/03/15 11:41:07 rillig Exp $");
 
 /* types and constants */
 
@@ -1042,8 +1042,8 @@
                        const char *nested_p = cp;
                        FStr nested_val;
 
-                       (void)Var_Parse(&nested_p, SCOPE_CMDLINE, VARE_NONE,
-                           &nested_val);
+                       (void)Var_Parse(&nested_p, SCOPE_CMDLINE,
+                           VARE_PARSE_ONLY, &nested_val);
                        /* TODO: handle errors */
                        FStr_Done(&nested_val);
                        cp += nested_p - cp;
@@ -1874,7 +1874,7 @@
                if (type != VAR_SUBST && strchr(uvalue, '$') != NULL) {
                        char *expandedValue;
 
-                       (void)Var_Subst(uvalue, scope, VARE_NONE,
+                       (void)Var_Subst(uvalue, scope, VARE_PARSE_ONLY,
                            &expandedValue);
                        /* TODO: handle errors */
                        free(expandedValue);
diff -r 8114a9cc47d3 -r 5f21f9890c6c usr.bin/make/suff.c
--- a/usr.bin/make/suff.c       Mon Mar 15 10:58:05 2021 +0000
+++ b/usr.bin/make/suff.c       Mon Mar 15 11:41:07 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: suff.c,v 1.346 2021/02/23 15:56:29 rillig Exp $        */
+/*     $NetBSD: suff.c,v 1.347 2021/03/15 11:41:07 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -114,7 +114,7 @@
 #include "dir.h"
 
 /*     "@(#)suff.c     8.4 (Berkeley) 3/21/94" */
-MAKE_RCSID("$NetBSD: suff.c,v 1.346 2021/02/23 15:56:29 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.347 2021/03/15 11:41:07 rillig Exp $");
 
 typedef List SuffixList;
 typedef ListNode SuffixListNode;
@@ -1309,7 +1309,7 @@
                        const char *nested_p = cp;
                        FStr junk;
 
-                       (void)Var_Parse(&nested_p, pgn, VARE_NONE, &junk);
+                       (void)Var_Parse(&nested_p, pgn, VARE_PARSE_ONLY, &junk);
                        /* TODO: handle errors */
                        if (junk.str == var_Error) {
                                Parse_Error(PARSE_FATAL,
diff -r 8114a9cc47d3 -r 5f21f9890c6c usr.bin/make/var.c
--- a/usr.bin/make/var.c        Mon Mar 15 10:58:05 2021 +0000
+++ b/usr.bin/make/var.c        Mon Mar 15 11:41:07 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.883 2021/03/14 20:23:29 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.884 2021/03/15 11:41:07 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.883 2021/03/14 20:23:29 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.884 2021/03/15 11:41:07 rillig Exp $");
 
 typedef enum VarFlags {
        VFL_NONE        = 0,
@@ -2408,7 +2408,7 @@
        args.scope = expr->scope;
 
        (*pp)++;                /* Skip the first '@' */
-       res = ParseModifierPart(pp, '@', VARE_NONE, st, &args.tvar);
+       res = ParseModifierPart(pp, '@', VARE_PARSE_ONLY, st, &args.tvar);
        if (res != VPR_OK)
                return AMR_CLEANUP;
        if (opts.strict && strchr(args.tvar, '$') != NULL) {
@@ -2419,7 +2419,7 @@
                return AMR_CLEANUP;
        }
 
-       res = ParseModifierPart(pp, '@', VARE_NONE, st, &args.str);
+       res = ParseModifierPart(pp, '@', VARE_PARSE_ONLY, st, &args.str);
        if (res != VPR_OK)
                return AMR_CLEANUP;
 
@@ -2452,7 +2452,7 @@
        Buffer buf;
        const char *p;
 
-       VarEvalFlags eflags = VARE_NONE;
+       VarEvalFlags eflags = VARE_PARSE_ONLY;
        if (expr->eflags & VARE_WANTRES)
                if ((**pp == 'D') == (expr->defined == DEF_REGULAR))
                        eflags = expr->eflags;
@@ -3292,8 +3292,8 @@
        VarParseResult res;
 
        Boolean value = FALSE;
-       VarEvalFlags then_eflags = VARE_NONE;
-       VarEvalFlags else_eflags = VARE_NONE;
+       VarEvalFlags then_eflags = VARE_PARSE_ONLY;
+       VarEvalFlags else_eflags = VARE_PARSE_ONLY;
 
        int cond_rc = COND_PARSE;       /* anything other than COND_INVALID */
        if (expr->eflags & VARE_WANTRES) {



Home | Main Index | Thread Index | Old Index