Module Name: src
Committed By: rillig
Date: Fri Jun 7 18:57:30 UTC 2024
Modified Files:
src/usr.bin/make: for.c
Log Message:
make: remove redundant shortcut for building the .for loop body
The function NeedsEscapes was not optimized enough by GCC 10 to be worth
the extra code.
To generate a diff of this commit:
cvs rdiff -u -r1.181 -r1.182 src/usr.bin/make/for.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/make/for.c
diff -u src/usr.bin/make/for.c:1.181 src/usr.bin/make/for.c:1.182
--- src/usr.bin/make/for.c:1.181 Sun Jun 2 15:31:25 2024
+++ src/usr.bin/make/for.c Fri Jun 7 18:57:30 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: for.c,v 1.181 2024/06/02 15:31:25 rillig Exp $ */
+/* $NetBSD: for.c,v 1.182 2024/06/07 18:57:30 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.181 2024/06/02 15:31:25 rillig Exp $");
+MAKE_RCSID("$NetBSD: for.c,v 1.182 2024/06/07 18:57:30 rillig Exp $");
typedef struct ForLoop {
@@ -332,23 +332,6 @@ ExprLen(const char *s, const char *e)
}
/*
- * The .for loop substitutes the items as ${:U<value>...}, which means
- * that characters that break this syntax must be backslash-escaped.
- */
-static bool
-NeedsEscapes(Substring value, char endc)
-{
- const char *p;
-
- for (p = value.start; p != value.end; p++) {
- if (*p == ':' || *p == '$' || *p == '\\' || *p == endc ||
- *p == '\n')
- return true;
- }
- return false;
-}
-
-/*
* While expanding the body of a .for loop, write the item as a ${:U...}
* expression, escaping characters as needed. The result is later unescaped
* by ApplyModifier_Defined.
@@ -359,11 +342,6 @@ AddEscaped(Buffer *cmds, Substring item,
const char *p;
char ch;
- if (!NeedsEscapes(item, endc)) {
- Buf_AddRange(cmds, item.start, item.end);
- return;
- }
-
for (p = item.start; p != item.end;) {
ch = *p;
if (ch == '$') {