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): add error handling for .for loop items
details: https://anonhg.NetBSD.org/src/rev/0e8d743691b7
branches: trunk
changeset: 979375:0e8d743691b7
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Dec 27 10:04:32 2020 +0000
description:
make(1): add error handling for .for loop items
Right now, Var_Subst always returns VPR_OK, even if there had been parse
errors or evaluation errors. If that is no longer true, the errors will
be reported properly.
diffstat:
usr.bin/make/for.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diffs (41 lines):
diff -r 3b5686c2a0e4 -r 0e8d743691b7 usr.bin/make/for.c
--- a/usr.bin/make/for.c Sun Dec 27 09:58:35 2020 +0000
+++ b/usr.bin/make/for.c Sun Dec 27 10:04:32 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: for.c,v 1.120 2020/12/19 13:31:37 rillig Exp $ */
+/* $NetBSD: for.c,v 1.121 2020/12/27 10:04:32 rillig Exp $ */
/*
* Copyright (c) 1992, The Regents of the University of California.
@@ -60,7 +60,7 @@
#include "make.h"
/* "@(#)for.c 8.1 (Berkeley) 6/6/93" */
-MAKE_RCSID("$NetBSD: for.c,v 1.120 2020/12/19 13:31:37 rillig Exp $");
+MAKE_RCSID("$NetBSD: for.c,v 1.121 2020/12/27 10:04:32 rillig Exp $");
static int forLevel = 0; /* Nesting level */
@@ -206,8 +206,12 @@
{
char *items;
- (void)Var_Subst(p, VAR_GLOBAL, VARE_WANTRES, &items);
- /* TODO: handle errors */
+ if (Var_Subst(p, VAR_GLOBAL, VARE_WANTRES, &items) != VPR_OK) {
+ Parse_Error(PARSE_FATAL, "Error in .for loop items");
+ f->items.len = 0;
+ goto done;
+ }
+
f->items = Str_Words(items, FALSE);
free(items);
@@ -233,6 +237,7 @@
}
}
+done:
accumFor = f;
forLevel = 1;
return 1;
Home |
Main Index |
Thread Index |
Old Index