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 Var_ParsePP back to Var_Parse



details:   https://anonhg.NetBSD.org/src/rev/294ead4ac1df
branches:  trunk
changeset: 976094:294ead4ac1df
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Sep 12 18:19:50 2020 +0000

description:
make(1): rename Var_ParsePP back to Var_Parse

The migration to the "parsing position" pointer has been done.

diffstat:

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

diffs (truncated from 379 to 300 lines):

diff -r b272211c3bff -r 294ead4ac1df usr.bin/make/arch.c
--- a/usr.bin/make/arch.c       Sat Sep 12 18:12:53 2020 +0000
+++ b/usr.bin/make/arch.c       Sat Sep 12 18:19:50 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: arch.c,v 1.111 2020/09/11 17:32:36 rillig Exp $        */
+/*     $NetBSD: arch.c,v 1.112 2020/09/12 18:19:50 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: arch.c,v 1.111 2020/09/11 17:32:36 rillig Exp $";
+static char rcsid[] = "$NetBSD: arch.c,v 1.112 2020/09/12 18:19:50 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)arch.c     8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: arch.c,v 1.111 2020/09/11 17:32:36 rillig Exp $");
+__RCSID("$NetBSD: arch.c,v 1.112 2020/09/12 18:19:50 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -238,7 +238,7 @@
            const char *result;
            Boolean isError;
 
-           result = Var_ParsePP(&nested_p, ctxt,
+           result = Var_Parse(&nested_p, ctxt,
                               VARE_UNDEFERR|VARE_WANTRES, &result_freeIt);
            isError = result == var_Error;
            free(result_freeIt);
@@ -280,8 +280,8 @@
                Boolean isError;
                const char *nested_p = cp;
 
-               result = Var_ParsePP(&nested_p, ctxt,
-                                    VARE_UNDEFERR|VARE_WANTRES, &freeIt);
+               result = Var_Parse(&nested_p, ctxt,
+                                  VARE_UNDEFERR|VARE_WANTRES, &freeIt);
                isError = result == var_Error;
                free(freeIt);
 
diff -r b272211c3bff -r 294ead4ac1df usr.bin/make/cond.c
--- a/usr.bin/make/cond.c       Sat Sep 12 18:12:53 2020 +0000
+++ b/usr.bin/make/cond.c       Sat Sep 12 18:19:50 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cond.c,v 1.140 2020/09/12 18:04:45 rillig Exp $        */
+/*     $NetBSD: cond.c,v 1.141 2020/09/12 18:19:50 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: cond.c,v 1.140 2020/09/12 18:04:45 rillig Exp $";
+static char rcsid[] = "$NetBSD: cond.c,v 1.141 2020/09/12 18:19:50 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)cond.c     8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: cond.c,v 1.140 2020/09/12 18:04:45 rillig Exp $");
+__RCSID("$NetBSD: cond.c,v 1.141 2020/09/12 18:19:50 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -258,7 +258,7 @@
             */
            void *freeIt;
            VarEvalFlags eflags = VARE_UNDEFERR | (doEval ? VARE_WANTRES : 0);
-           const char *cp2 = Var_ParsePP(&cp, VAR_CMD, eflags, &freeIt);
+           const char *cp2 = Var_Parse(&cp, VAR_CMD, eflags, &freeIt);
            Buf_AddStr(&buf, cp2);
            free(freeIt);
            continue;
@@ -462,7 +462,7 @@
                     (doEval ? VARE_WANTRES : 0);
            nested_p = par->p;
            atStart = nested_p == start;
-           str = Var_ParsePP(&nested_p, VAR_CMD, eflags, freeIt);
+           str = Var_Parse(&nested_p, VAR_CMD, eflags, freeIt);
            if (str == var_Error) {
                if (*freeIt) {
                    free(*freeIt);
@@ -703,7 +703,7 @@
     *argPtr = NULL;
 
     (*linePtr)--;              /* Make (*linePtr)[1] point to the '('. */
-    val = Var_ParsePP(linePtr, VAR_CMD, doEval ? VARE_WANTRES : 0, &val_freeIt);
+    val = Var_Parse(linePtr, VAR_CMD, doEval ? VARE_WANTRES : 0, &val_freeIt);
     /* If successful, *linePtr points beyond the closing ')' now. */
 
     if (val == var_Error) {
diff -r b272211c3bff -r 294ead4ac1df usr.bin/make/nonints.h
--- a/usr.bin/make/nonints.h    Sat Sep 12 18:12:53 2020 +0000
+++ b/usr.bin/make/nonints.h    Sat Sep 12 18:19:50 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nonints.h,v 1.115 2020/09/12 18:04:45 rillig Exp $     */
+/*     $NetBSD: nonints.h,v 1.116 2020/09/12 18:19:50 rillig Exp $     */
 
 /*-
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -213,7 +213,7 @@
 void Var_Append(const char *, const char *, GNode *);
 Boolean Var_Exists(const char *, GNode *);
 const char *Var_Value(const char *, GNode *, char **);
-const char *Var_ParsePP(const char **, GNode *, VarEvalFlags, void **);
+const char *Var_Parse(const char **, GNode *, VarEvalFlags, void **);
 char *Var_Subst(const char *, GNode *, VarEvalFlags);
 void Var_Init(void);
 void Var_End(void);
diff -r b272211c3bff -r 294ead4ac1df usr.bin/make/parse.c
--- a/usr.bin/make/parse.c      Sat Sep 12 18:12:53 2020 +0000
+++ b/usr.bin/make/parse.c      Sat Sep 12 18:19:50 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parse.c,v 1.293 2020/09/12 15:21:25 rillig Exp $       */
+/*     $NetBSD: parse.c,v 1.294 2020/09/12 18:19:50 rillig Exp $       */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: parse.c,v 1.293 2020/09/12 15:21:25 rillig Exp $";
+static char rcsid[] = "$NetBSD: parse.c,v 1.294 2020/09/12 18:19:50 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)parse.c    8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: parse.c,v 1.293 2020/09/12 15:21:25 rillig Exp $");
+__RCSID("$NetBSD: parse.c,v 1.294 2020/09/12 18:19:50 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1201,8 +1201,8 @@
                const char *nested_p = cp;
                void    *freeIt;
 
-               (void)Var_ParsePP(&nested_p, VAR_CMD,
-                                 VARE_UNDEFERR|VARE_WANTRES, &freeIt);
+               (void)Var_Parse(&nested_p, VAR_CMD,
+                               VARE_UNDEFERR|VARE_WANTRES, &freeIt);
                free(freeIt);
                cp += nested_p - cp;
            } else
diff -r b272211c3bff -r 294ead4ac1df usr.bin/make/suff.c
--- a/usr.bin/make/suff.c       Sat Sep 12 18:12:53 2020 +0000
+++ b/usr.bin/make/suff.c       Sat Sep 12 18:19:50 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: suff.c,v 1.151 2020/09/12 16:13:48 rillig Exp $        */
+/*     $NetBSD: suff.c,v 1.152 2020/09/12 18:19:50 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: suff.c,v 1.151 2020/09/12 16:13:48 rillig Exp $";
+static char rcsid[] = "$NetBSD: suff.c,v 1.152 2020/09/12 18:19:50 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)suff.c     8.4 (Berkeley) 3/21/94";
 #else
-__RCSID("$NetBSD: suff.c,v 1.151 2020/09/12 16:13:48 rillig Exp $");
+__RCSID("$NetBSD: suff.c,v 1.152 2020/09/12 18:19:50 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1328,8 +1328,8 @@
                    void        *freeIt;
 
                    /* XXX: Why VARE_WANTRES when the result is not used? */
-                   junk = Var_ParsePP(&nested_p, pgn,
-                                      VARE_UNDEFERR|VARE_WANTRES, &freeIt);
+                   junk = Var_Parse(&nested_p, pgn,
+                                    VARE_UNDEFERR|VARE_WANTRES, &freeIt);
                    if (junk == var_Error) {
                        Parse_Error(PARSE_FATAL,
                                    "Malformed variable expression at \"%s\"",
diff -r b272211c3bff -r 294ead4ac1df usr.bin/make/var.c
--- a/usr.bin/make/var.c        Sat Sep 12 18:12:53 2020 +0000
+++ b/usr.bin/make/var.c        Sat Sep 12 18:19:50 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.495 2020/09/12 18:04:45 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.496 2020/09/12 18:19:50 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.495 2020/09/12 18:04:45 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.496 2020/09/12 18:19:50 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.495 2020/09/12 18:04:45 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.496 2020/09/12 18:19:50 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1683,8 +1683,8 @@
            void *nested_val_freeIt;
            VarEvalFlags nested_eflags = eflags & ~(unsigned)VARE_ASSIGN;
 
-           nested_val = Var_ParsePP(&nested_p, ctxt, nested_eflags,
-                                    &nested_val_freeIt);
+           nested_val = Var_Parse(&nested_p, ctxt, nested_eflags,
+                                  &nested_val_freeIt);
            Buf_AddStr(&buf, nested_val);
            free(nested_val_freeIt);
            p += nested_p - p;
@@ -2031,7 +2031,7 @@
            const char *nested_val;
            void *nested_val_freeIt;
 
-           nested_val = Var_ParsePP(&p, st->ctxt, eflags, &nested_val_freeIt);
+           nested_val = Var_Parse(&p, st->ctxt, eflags, &nested_val_freeIt);
            Buf_AddStr(&buf, nested_val);
            free(nested_val_freeIt);
            continue;
@@ -3018,8 +3018,8 @@
             */
            const char *nested_p = p;
            void *freeIt;
-           const char *rval = Var_ParsePP(&nested_p, st.ctxt, st.eflags,
-                                          &freeIt);
+           const char *rval = Var_Parse(&nested_p, st.ctxt, st.eflags,
+                                        &freeIt);
 
            /*
             * If we have not parsed up to st.endc or ':',
@@ -3343,11 +3343,11 @@
  *     Any effects from the modifiers, such as :!cmd! or ::=value.
  *-----------------------------------------------------------------------
  */
-/* coverity[+alloc : arg-*4] */
-static const char *
-Var_Parse(const char * const str, GNode *ctxt, VarEvalFlags eflags,
-         int *lengthPtr, void **freePtr)
+/* coverity[+alloc : arg-*3] */
+const char *
+Var_Parse(const char **pp, GNode *ctxt, VarEvalFlags eflags, void **freePtr)
 {
+    const char * const str = *pp;
     const char *tstr;          /* Pointer into str */
     Boolean     haveModifier;  /* TRUE if have modifiers for the variable */
     char        startc;        /* Starting character if variable in parens
@@ -3389,7 +3389,7 @@
 
        /* Error out some really stupid names */
        if (startc == '\0' || strchr(")}:$", startc)) {
-           *lengthPtr = 1;
+           (*pp)++;
            return var_Error;
        }
 
@@ -3397,7 +3397,7 @@
        name[1] = '\0';
        v = VarFind(name, ctxt, FIND_ENV | FIND_GLOBAL | FIND_CMD);
        if (v == NULL) {
-           *lengthPtr = 2;
+           *pp += 2;
 
            if (ctxt == VAR_CMD || ctxt == VAR_GLOBAL) {
                /*
@@ -3452,7 +3452,7 @@
            /* A variable inside a variable, expand. */
            if (*tstr == '$') {
                void *freeIt;
-               const char *rval = Var_ParsePP(&tstr, ctxt, eflags, &freeIt);
+               const char *rval = Var_Parse(&tstr, ctxt, eflags, &freeIt);
                Buf_AddStr(&namebuf, rval);
                free(freeIt);
            } else {
@@ -3467,12 +3467,7 @@
        } else {
            Parse_Error(PARSE_FATAL, "Unclosed variable \"%s\"",
                        Buf_GetAll(&namebuf, NULL));
-           /*
-            * If we never did find the end character, return NULL
-            * right now, setting the length to be the distance to
-            * the end of the string, since that's what make does.
-            */



Home | Main Index | Thread Index | Old Index