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: improve error message for bad modifier in...
details: https://anonhg.NetBSD.org/src/rev/821d663ea386
branches: trunk
changeset: 959756:821d663ea386
user: rillig <rillig%NetBSD.org@localhost>
date: Tue Feb 23 16:07:14 2021 +0000
description:
make: improve error message for bad modifier in variable expression
The improvement is especially noteable for variable expressions based on
the empty variable, see moderrs.exp:103.
diffstat:
usr.bin/make/unit-tests/moderrs.exp | 16 ++++++++--------
usr.bin/make/unit-tests/modts.exp | 4 ++--
usr.bin/make/unit-tests/modword.exp | 22 +++++++++++-----------
usr.bin/make/unit-tests/varmod-assign.exp | 4 ++--
usr.bin/make/unit-tests/varmod-order.exp | 4 ++--
usr.bin/make/unit-tests/varmod-to-separator.exp | 12 ++++++------
usr.bin/make/var.c | 6 +++---
7 files changed, 34 insertions(+), 34 deletions(-)
diffs (200 lines):
diff -r 6c149ed2a890 -r 821d663ea386 usr.bin/make/unit-tests/moderrs.exp
--- a/usr.bin/make/unit-tests/moderrs.exp Tue Feb 23 16:04:16 2021 +0000
+++ b/usr.bin/make/unit-tests/moderrs.exp Tue Feb 23 16:07:14 2021 +0000
@@ -45,7 +45,7 @@
make: Unfinished modifier for "UNDEF" (']' missing)
13=
-make: Bad modifier `:[123451234512345123451234512345]' for UNDEF
+make: Bad modifier ":[123451234512345123451234512345]" for variable "UNDEF"
12345=S,^ok,:S,^3ok,}
exclam:
@@ -98,21 +98,21 @@
mod-ts-parse:
112358132134
15152535558513521534
-make: Bad modifier `:ts\65oct' for FIB
+make: Bad modifier ":ts\65oct" for variable "FIB"
65oct}
-make: Bad modifier `:ts\65oct' for
+make: Bad modifier ":ts\65oct" for variable ""
65oct}
-make: Bad modifier `:tsxy' for FIB
+make: Bad modifier ":tsxy" for variable "FIB"
xy}
mod-t-parse:
-make: Bad modifier `:t' for FIB
+make: Bad modifier ":t" for variable "FIB"
-make: Bad modifier `:txy' for FIB
+make: Bad modifier ":txy" for variable "FIB"
y}
-make: Bad modifier `:t' for FIB
+make: Bad modifier ":t" for variable "FIB"
-make: Bad modifier `:t' for FIB
+make: Bad modifier ":t" for variable "FIB"
M*}
mod-ifelse-parse:
diff -r 6c149ed2a890 -r 821d663ea386 usr.bin/make/unit-tests/modts.exp
--- a/usr.bin/make/unit-tests/modts.exp Tue Feb 23 16:04:16 2021 +0000
+++ b/usr.bin/make/unit-tests/modts.exp Tue Feb 23 16:07:14 2021 +0000
@@ -1,6 +1,6 @@
-make: Bad modifier `:tx' for LIST
+make: Bad modifier ":tx" for variable "LIST"
LIST:tx="}"
-make: Bad modifier `:ts\X' for LIST
+make: Bad modifier ":ts\X" for variable "LIST"
LIST:ts/x:tu="\X:tu}"
FU_mod-ts="a/b/cool"
FU_mod-ts:ts:T="cool" == cool?
diff -r 6c149ed2a890 -r 821d663ea386 usr.bin/make/unit-tests/modword.exp
--- a/usr.bin/make/unit-tests/modword.exp Tue Feb 23 16:04:16 2021 +0000
+++ b/usr.bin/make/unit-tests/modword.exp Tue Feb 23 16:07:14 2021 +0000
@@ -1,4 +1,4 @@
-make: Bad modifier `:[]' for LIST
+make: Bad modifier ":[]" for variable "LIST"
LIST:[]="" is an error
LIST:[0]="one two three four five six"
LIST:[0x0]="one two three four five six"
@@ -37,17 +37,17 @@
REALLYSPACE:[1]="" == "" ?
REALLYSPACE:[*]:[1]=" " == " " ?
LIST:[1]="one"
-make: Bad modifier `:[1.]' for LIST
+make: Bad modifier ":[1.]" for variable "LIST"
LIST:[1.]="" is an error
-make: Bad modifier `:[1].' for LIST
+make: Bad modifier ":[1]." for variable "LIST"
LIST:[1].="}" is an error
LIST:[2]="two"
LIST:[6]="six"
LIST:[7]=""
LIST:[999]=""
-make: Bad modifier `:[-]' for LIST
+make: Bad modifier ":[-]" for variable "LIST"
LIST:[-]="" is an error
-make: Bad modifier `:[--]' for LIST
+make: Bad modifier ":[--]" for variable "LIST"
LIST:[--]="" is an error
LIST:[-1]="six"
LIST:[-2]="five"
@@ -67,20 +67,20 @@
LIST:[*]:C/ /,/:[*]:[2]=""
LIST:[*]:C/ /,/:[@]:[2]="three"
LONGLIST:[012..0x12]="10 11 12 13 14 15 16 17 18"
-make: Bad modifier `:[1.]' for LIST
+make: Bad modifier ":[1.]" for variable "LIST"
LIST:[1.]="" is an error
-make: Bad modifier `:[1..]' for LIST
+make: Bad modifier ":[1..]" for variable "LIST"
LIST:[1..]="" is an error
LIST:[1..1]="one"
-make: Bad modifier `:[1..1.]' for LIST
+make: Bad modifier ":[1..1.]" for variable "LIST"
LIST:[1..1.]="" is an error
LIST:[1..2]="one two"
LIST:[2..1]="two one"
LIST:[3..-2]="three four five"
LIST:[-4..4]="three four"
-make: Bad modifier `:[0..1]' for LIST
+make: Bad modifier ":[0..1]" for variable "LIST"
LIST:[0..1]="" is an error
-make: Bad modifier `:[-1..0]' for LIST
+make: Bad modifier ":[-1..0]" for variable "LIST"
LIST:[-1..0]="" is an error
LIST:[-1..1]="six five four three two one"
LIST:[0..0]="one two three four five six"
@@ -95,7 +95,7 @@
LIST:[${MINUSONE}]="six"
LIST:[${STAR}]="one two three four five six"
LIST:[${AT}]="one two three four five six"
-make: Bad modifier `:[${EMPTY' for LIST
+make: Bad modifier ":[${EMPTY" for variable "LIST"
LIST:[${EMPTY}]="" is an error
LIST:[${LONGLIST:[21]:S/2//}]="one"
LIST:[${LIST:[#]}]="six"
diff -r 6c149ed2a890 -r 821d663ea386 usr.bin/make/unit-tests/varmod-assign.exp
--- a/usr.bin/make/unit-tests/varmod-assign.exp Tue Feb 23 16:04:16 2021 +0000
+++ b/usr.bin/make/unit-tests/varmod-assign.exp Tue Feb 23 16:07:14 2021 +0000
@@ -10,9 +10,9 @@
mod-assign-nested: else2e2
mod-assign-nested: then3t3
mod-assign-nested: else4e4
-make: Bad modifier `:' for
+make: Bad modifier ":" for variable ""
mod-assign-empty: value}
-make: Bad modifier `:' for
+make: Bad modifier ":" for variable ""
mod-assign-empty: overwritten}
mod-assign-empty: VAR=overwritten
make: Unknown modifier ":x"
diff -r 6c149ed2a890 -r 821d663ea386 usr.bin/make/unit-tests/varmod-order.exp
--- a/usr.bin/make/unit-tests/varmod-order.exp Tue Feb 23 16:04:16 2021 +0000
+++ b/usr.bin/make/unit-tests/varmod-order.exp Tue Feb 23 16:07:14 2021 +0000
@@ -1,6 +1,6 @@
-make: Bad modifier `:OX' for NUMBERS
+make: Bad modifier ":OX" for variable "NUMBERS"
make: "varmod-order.mk" line 13: Undefined variable "${NUMBERS:OX"
-make: Bad modifier `:OxXX' for NUMBERS
+make: Bad modifier ":OxXX" for variable "NUMBERS"
make: "varmod-order.mk" line 16: Undefined variable "${NUMBERS:Ox"
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
diff -r 6c149ed2a890 -r 821d663ea386 usr.bin/make/unit-tests/varmod-to-separator.exp
--- a/usr.bin/make/unit-tests/varmod-to-separator.exp Tue Feb 23 16:04:16 2021 +0000
+++ b/usr.bin/make/unit-tests/varmod-to-separator.exp Tue Feb 23 16:07:14 2021 +0000
@@ -2,17 +2,17 @@
make: "varmod-to-separator.mk" line 107: Malformed conditional (${WORDS:[1..3]:ts\400:tu})
make: "varmod-to-separator.mk" line 121: Invalid character number: 100:tu}
make: "varmod-to-separator.mk" line 121: Malformed conditional (${WORDS:[1..3]:ts\x100:tu})
-make: Bad modifier `:ts\-300' for WORDS
+make: Bad modifier ":ts\-300" for variable "WORDS"
make: "varmod-to-separator.mk" line 128: Malformed conditional (${WORDS:[1..3]:ts\-300:tu})
-make: Bad modifier `:ts\8' for 1 2 3
+make: Bad modifier ":ts\8" for variable "1 2 3"
make: "varmod-to-separator.mk" line 136: Malformed conditional (${1 2 3:L:ts\8:tu})
-make: Bad modifier `:ts\100L' for 1 2 3
+make: Bad modifier ":ts\100L" for variable "1 2 3"
make: "varmod-to-separator.mk" line 143: Malformed conditional (${1 2 3:L:ts\100L})
-make: Bad modifier `:ts\x40g' for 1 2 3
+make: Bad modifier ":ts\x40g" for variable "1 2 3"
make: "varmod-to-separator.mk" line 150: Malformed conditional (${1 2 3:L:ts\x40g})
-make: Bad modifier `:tx' for WORDS
+make: Bad modifier ":tx" for variable "WORDS"
make: "varmod-to-separator.mk" line 158: Malformed conditional (${WORDS:tx} != "anything")
-make: Bad modifier `:t\X' for WORDS
+make: Bad modifier ":t\X" for variable "WORDS"
make: "varmod-to-separator.mk" line 165: Malformed conditional (${WORDS:t\X} != "anything")
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
diff -r 6c149ed2a890 -r 821d663ea386 usr.bin/make/var.c
--- a/usr.bin/make/var.c Tue Feb 23 16:04:16 2021 +0000
+++ b/usr.bin/make/var.c Tue Feb 23 16:07:14 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: var.c,v 1.852 2021/02/23 15:56:29 rillig Exp $ */
+/* $NetBSD: var.c,v 1.853 2021/02/23 16:07:14 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -140,7 +140,7 @@
#include "metachar.h"
/* "@(#)var.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.852 2021/02/23 15:56:29 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.853 2021/02/23 16:07:14 rillig Exp $");
typedef enum VarFlags {
VFL_NONE = 0,
@@ -3826,7 +3826,7 @@
bad_modifier:
/* XXX: The modifier end is only guessed. */
- Error("Bad modifier `:%.*s' for %s",
+ Error("Bad modifier \":%.*s\" for variable \"%s\"",
(int)strcspn(mod, ":)}"), mod, expr->var->name.str);
cleanup:
Home |
Main Index |
Thread Index |
Old Index