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: remove optimization for single-letter .fo...



details:   https://anonhg.NetBSD.org/src/rev/39b52df68d66
branches:  trunk
changeset: 1023293:39b52df68d66
user:      rillig <rillig%NetBSD.org@localhost>
date:      Wed Sep 01 23:07:41 2021 +0000

description:
make: remove optimization for single-letter .for variables

Most .for loops have a single iteration variable.  For these loops, the
difference between the optimized and the unoptimized versions of the
code is negligible.

Remove the optimization since the comment for explaining it was almost
larger than the code itself.

diffstat:

 usr.bin/make/for.c |  13 +++----------
 1 files changed, 3 insertions(+), 10 deletions(-)

diffs (55 lines):

diff -r da3509d7aec3 -r 39b52df68d66 usr.bin/make/for.c
--- a/usr.bin/make/for.c        Wed Sep 01 23:05:03 2021 +0000
+++ b/usr.bin/make/for.c        Wed Sep 01 23:07:41 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: for.c,v 1.144 2021/06/25 16:10:07 rillig Exp $ */
+/*     $NetBSD: for.c,v 1.145 2021/09/01 23:07:41 rillig Exp $ */
 
 /*
  * Copyright (c) 1992, The Regents of the University of California.
@@ -58,7 +58,7 @@
 #include "make.h"
 
 /*     "@(#)for.c      8.1 (Berkeley) 6/6/93"  */
-MAKE_RCSID("$NetBSD: for.c,v 1.144 2021/06/25 16:10:07 rillig Exp $");
+MAKE_RCSID("$NetBSD: for.c,v 1.145 2021/09/01 23:07:41 rillig Exp $");
 
 
 /* One of the variables to the left of the "in" in a .for loop. */
@@ -72,10 +72,6 @@
        Vector /* of ForVar */ vars; /* Iteration variables */
        Words items;            /* Substitution items */
        Buffer curBody;         /* Expanded body of the current iteration */
-       /* Is any of the names 1 character long? If so, when the variable
-        * values are substituted, the parser must handle $V expressions as
-        * well, not only ${V} and $(V). */
-       bool short_var;
        unsigned int sub_next;  /* Where to continue iterating */
 } ForLoop;
 
@@ -94,7 +90,6 @@
        f->items.words = NULL;
        f->items.freeIt = NULL;
        Buf_Init(&f->curBody);
-       f->short_var = false;
        f->sub_next = 0;
 
        return f;
@@ -150,8 +145,6 @@
                        p += 2;
                        break;
                }
-               if (len == 1)
-                       f->short_var = true;
 
                ForLoop_AddVar(f, p, len);
                p += len;
@@ -422,7 +415,7 @@
        size_t i;
 
        /* Skip $$ and stupid ones. */
-       if (!f->short_var || strchr("}):$", ch) != NULL)
+       if (strchr("}):$", ch) != NULL)
                return;
 
        vars = Vector_Get(&f->vars, 0);



Home | Main Index | Thread Index | Old Index