Sun Jul 19 15:51:51 2020 UTC ()
make(1): eliminate unused local variables


(rillig)
diff -r1.263 -r1.264 src/usr.bin/make/var.c

cvs diff -r1.263 -r1.264 src/usr.bin/make/var.c (expand / switch to unified diff)

--- src/usr.bin/make/var.c 2020/07/19 15:47:10 1.263
+++ src/usr.bin/make/var.c 2020/07/19 15:51:51 1.264
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: var.c,v 1.263 2020/07/19 15:47:10 rillig Exp $ */ 1/* $NetBSD: var.c,v 1.264 2020/07/19 15:51:51 rillig Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1988, 1989, 1990, 1993 4 * Copyright (c) 1988, 1989, 1990, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to Berkeley by 7 * This code is derived from software contributed to Berkeley by
8 * Adam de Boor. 8 * Adam de Boor.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -59,34 +59,34 @@ @@ -59,34 +59,34 @@
59 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 59 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
60 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 60 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
61 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 61 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
62 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 62 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
63 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 63 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
64 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 64 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
65 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 65 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
66 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 66 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
67 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 67 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
68 * SUCH DAMAGE. 68 * SUCH DAMAGE.
69 */ 69 */
70 70
71#ifndef MAKE_NATIVE 71#ifndef MAKE_NATIVE
72static char rcsid[] = "$NetBSD: var.c,v 1.263 2020/07/19 15:47:10 rillig Exp $"; 72static char rcsid[] = "$NetBSD: var.c,v 1.264 2020/07/19 15:51:51 rillig Exp $";
73#else 73#else
74#include <sys/cdefs.h> 74#include <sys/cdefs.h>
75#ifndef lint 75#ifndef lint
76#if 0 76#if 0
77static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94"; 77static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94";
78#else 78#else
79__RCSID("$NetBSD: var.c,v 1.263 2020/07/19 15:47:10 rillig Exp $"); 79__RCSID("$NetBSD: var.c,v 1.264 2020/07/19 15:51:51 rillig Exp $");
80#endif 80#endif
81#endif /* not lint */ 81#endif /* not lint */
82#endif 82#endif
83 83
84/*- 84/*-
85 * var.c -- 85 * var.c --
86 * Variable-handling functions 86 * Variable-handling functions
87 * 87 *
88 * Interface: 88 * Interface:
89 * Var_Set Set the value of a variable in the given 89 * Var_Set Set the value of a variable in the given
90 * context. The variable is created if it doesn't 90 * context. The variable is created if it doesn't
91 * yet exist. The value and variable name need not 91 * yet exist. The value and variable name need not
92 * be preserved. 92 * be preserved.
@@ -3053,39 +3053,37 @@ ApplyModifier_IfElse(ApplyModifiersState @@ -3053,39 +3053,37 @@ ApplyModifier_IfElse(ApplyModifiersState
3053 /* find ':', and then substitute accordingly */ 3053 /* find ':', and then substitute accordingly */
3054 if (st->flags & VARE_WANTRES) { 3054 if (st->flags & VARE_WANTRES) {
3055 cond_rc = Cond_EvalExpression(NULL, st->v->name, &value, 0, FALSE); 3055 cond_rc = Cond_EvalExpression(NULL, st->v->name, &value, 0, FALSE);
3056 then_flags = cond_rc != COND_INVALID && value ? 0 : VAR_NOSUBST; 3056 then_flags = cond_rc != COND_INVALID && value ? 0 : VAR_NOSUBST;
3057 else_flags = cond_rc != COND_INVALID && !value ? 0 : VAR_NOSUBST; 3057 else_flags = cond_rc != COND_INVALID && !value ? 0 : VAR_NOSUBST;
3058 } else { 3058 } else {
3059 /* we are just consuming and discarding */ 3059 /* we are just consuming and discarding */
3060 cond_rc = value = 0; 3060 cond_rc = value = 0;
3061 then_flags = else_flags = VAR_NOSUBST; 3061 then_flags = else_flags = VAR_NOSUBST;
3062 } 3062 }
3063 3063
3064 st->cp = ++st->tstr; 3064 st->cp = ++st->tstr;
3065 st->delim = ':'; 3065 st->delim = ':';
3066 int then_len; 
3067 char *then_expr = VarGetPattern( 3066 char *then_expr = VarGetPattern(
3068 st->ctxt, &st->parsestate, st->flags, &st->cp, st->delim, 3067 st->ctxt, &st->parsestate, st->flags, &st->cp, st->delim,
3069 &then_flags, &then_len, NULL); 3068 &then_flags, NULL, NULL);
3070 if (then_expr == NULL) 3069 if (then_expr == NULL)
3071 return FALSE; 3070 return FALSE;
3072 3071
3073 /* BROPEN or PROPEN */ 3072 /* BROPEN or PROPEN */
3074 st->delim = st->endc; 3073 st->delim = st->endc;
3075 int else_len; 
3076 char *else_expr = VarGetPattern( 3074 char *else_expr = VarGetPattern(
3077 st->ctxt, &st->parsestate, st->flags, &st->cp, st->delim, 3075 st->ctxt, &st->parsestate, st->flags, &st->cp, st->delim,
3078 &else_flags, &else_len, NULL); 3076 &else_flags, NULL, NULL);
3079 if (else_expr == NULL) 3077 if (else_expr == NULL)
3080 return FALSE; 3078 return FALSE;
3081 3079
3082 st->termc = *--st->cp; 3080 st->termc = *--st->cp;
3083 st->delim = '\0'; 3081 st->delim = '\0';
3084 if (cond_rc == COND_INVALID) { 3082 if (cond_rc == COND_INVALID) {
3085 Error("Bad conditional expression `%s' in %s?%s:%s", 3083 Error("Bad conditional expression `%s' in %s?%s:%s",
3086 st->v->name, st->v->name, then_expr, else_expr); 3084 st->v->name, st->v->name, then_expr, else_expr);
3087 return FALSE; 3085 return FALSE;
3088 } 3086 }
3089 3087
3090 if (value) { 3088 if (value) {
3091 st->newStr = then_expr; 3089 st->newStr = then_expr;