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): remove unnecessary assignments to st->...
details: https://anonhg.NetBSD.org/src/rev/b244ffd1972b
branches: trunk
changeset: 974379:b244ffd1972b
user: rillig <rillig%NetBSD.org@localhost>
date: Wed Jul 29 21:35:35 2020 +0000
description:
make(1): remove unnecessary assignments to st->next
No change in the size of the resulting binary. Apparently GCC already
knew these assignments were redundant.
diffstat:
usr.bin/make/unit-tests/modmisc.exp | 1 +
usr.bin/make/unit-tests/modmisc.mk | 3 ++-
usr.bin/make/var.c | 29 ++++++++++-------------------
3 files changed, 13 insertions(+), 20 deletions(-)
diffs (124 lines):
diff -r aa2d1aaefeaa -r b244ffd1972b usr.bin/make/unit-tests/modmisc.exp
--- a/usr.bin/make/unit-tests/modmisc.exp Wed Jul 29 21:23:26 2020 +0000
+++ b/usr.bin/make/unit-tests/modmisc.exp Wed Jul 29 21:35:35 2020 +0000
@@ -97,6 +97,7 @@
%Y
2020
%Y
+%Y
mod-localtime:
%Y
2020
diff -r aa2d1aaefeaa -r b244ffd1972b usr.bin/make/unit-tests/modmisc.mk
--- a/usr.bin/make/unit-tests/modmisc.mk Wed Jul 29 21:23:26 2020 +0000
+++ b/usr.bin/make/unit-tests/modmisc.mk Wed Jul 29 21:35:35 2020 +0000
@@ -1,4 +1,4 @@
-# $Id: modmisc.mk,v 1.28 2020/07/29 18:48:47 rillig Exp $
+# $Id: modmisc.mk,v 1.29 2020/07/29 21:35:35 rillig Exp $
#
# miscellaneous modifier tests
@@ -261,6 +261,7 @@
@echo ${%Y:L:gmtim=1593536400} # modifier name too short
@echo ${%Y:L:gmtime=1593536400} # 2020-07-01T00:00:00Z
@echo ${%Y:L:gmtimer=1593536400} # modifier name too long
+ @echo ${%Y:L:gm=gm:M*}
mod-localtime:
@echo $@:
diff -r aa2d1aaefeaa -r b244ffd1972b usr.bin/make/var.c
--- a/usr.bin/make/var.c Wed Jul 29 21:23:26 2020 +0000
+++ b/usr.bin/make/var.c Wed Jul 29 21:35:35 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: var.c,v 1.357 2020/07/29 21:23:26 rillig Exp $ */
+/* $NetBSD: var.c,v 1.358 2020/07/29 21:35:35 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.357 2020/07/29 21:23:26 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.358 2020/07/29 21:35:35 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.357 2020/07/29 21:23:26 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.358 2020/07/29 21:35:35 rillig Exp $");
#endif
#endif /* not lint */
#endif
@@ -2039,7 +2039,8 @@
/* The ApplyModifier functions all work in the same way.
* They parse the modifier (often until the next colon) and store the
- * updated position for the parser into st->next.
+ * updated position for the parser into st->next
+ * (except when returning AMR_UNKNOWN).
* They take the st->val and generate st->newVal from it.
* On failure, many of them update st->missing_delim.
*/
@@ -2195,10 +2196,8 @@
static ApplyModifierResult
ApplyModifier_Gmtime(const char *mod, ApplyModifiersState *st)
{
- if (!ModMatchEq(mod, "gmtime", st->endc)) {
- st->next = mod + 1;
+ if (!ModMatchEq(mod, "gmtime", st->endc))
return AMR_UNKNOWN;
- }
time_t utc;
if (mod[6] == '=') {
@@ -2217,10 +2216,8 @@
static Boolean
ApplyModifier_Localtime(const char *mod, ApplyModifiersState *st)
{
- if (!ModMatchEq(mod, "localtime", st->endc)) {
- st->next = mod + 1;
+ if (!ModMatchEq(mod, "localtime", st->endc))
return AMR_UNKNOWN;
- }
time_t utc;
if (mod[9] == '=') {
@@ -2239,10 +2236,8 @@
static ApplyModifierResult
ApplyModifier_Hash(const char *mod, ApplyModifiersState *st)
{
- if (!ModMatch(mod, "hash", st->endc)) {
- st->next = mod + 1;
+ if (!ModMatch(mod, "hash", st->endc))
return AMR_UNKNOWN;
- }
st->newVal = VarHash(st->val);
st->next = mod + 4;
@@ -2301,10 +2296,8 @@
static ApplyModifierResult
ApplyModifier_Range(const char *mod, ApplyModifiersState *st)
{
- if (!ModMatchEq(mod, "range", st->endc)) {
- st->next = mod + 1;
+ if (!ModMatchEq(mod, "range", st->endc))
return AMR_UNKNOWN;
- }
int n;
if (mod[5] == '=') {
@@ -2910,10 +2903,8 @@
static ApplyModifierResult
ApplyModifier_Remember(const char *mod, ApplyModifiersState *st)
{
- if (!ModMatchEq(mod, "_", st->endc)) {
- st->next = mod + 1;
+ if (!ModMatchEq(mod, "_", st->endc))
return AMR_UNKNOWN;
- }
if (mod[1] == '=') {
size_t n = strcspn(mod + 2, ":)}");
Home |
Main Index |
Thread Index |
Old Index