diff options
| author | rillig <rillig@NetBSD.org> | 2020-11-02 20:48:36 +0000 |
|---|---|---|
| committer | rillig <rillig@NetBSD.org> | 2020-11-02 20:48:36 +0000 |
| commit | 67d7db576b3c91d22a9645ebfcf414d706018e31 (patch) | |
| tree | 9acbf4045aeb3a812f12359dca98027c8c191213 /usr.bin/make | |
| parent | a6c337142569931bf580134d0946a292e32a072c (diff) | |
make(1): error out on unclosed expressions after the colon
Diffstat (limited to 'usr.bin/make')
| -rw-r--r-- | usr.bin/make/unit-tests/cmd-errors-lint.exp | 1 | ||||
| -rw-r--r-- | usr.bin/make/unit-tests/cmd-errors.exp | 1 | ||||
| -rw-r--r-- | usr.bin/make/var.c | 11 |
3 files changed, 11 insertions, 2 deletions
diff --git a/usr.bin/make/unit-tests/cmd-errors-lint.exp b/usr.bin/make/unit-tests/cmd-errors-lint.exp index fadc324aae6..09924c538de 100644 --- a/usr.bin/make/unit-tests/cmd-errors-lint.exp +++ b/usr.bin/make/unit-tests/cmd-errors-lint.exp @@ -1,6 +1,7 @@ : undefined make: Unclosed variable "UNCLOSED" : unclosed-variable +make: Unclosed variable expression (expecting '}') for "UNCLOSED" : unclosed-modifier make: Unknown modifier 'Z' : unknown-modifier diff --git a/usr.bin/make/unit-tests/cmd-errors.exp b/usr.bin/make/unit-tests/cmd-errors.exp index 504b6122c74..da18ba54749 100644 --- a/usr.bin/make/unit-tests/cmd-errors.exp +++ b/usr.bin/make/unit-tests/cmd-errors.exp @@ -1,6 +1,7 @@ : undefined make: Unclosed variable "UNCLOSED" : unclosed-variable +make: Unclosed variable expression (expecting '}') for "UNCLOSED" : unclosed-modifier make: Unknown modifier 'Z' : unknown-modifier diff --git a/usr.bin/make/var.c b/usr.bin/make/var.c index 9e366f52c4e..447cba85de5 100644 --- a/usr.bin/make/var.c +++ b/usr.bin/make/var.c @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.648 2020/11/02 19:07:09 rillig Exp $ */ +/* $NetBSD: var.c,v 1.649 2020/11/02 20:48:36 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -130,7 +130,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.648 2020/11/02 19:07:09 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.649 2020/11/02 20:48:36 rillig Exp $"); #define VAR_DEBUG1(fmt, arg1) DEBUG1(VAR, fmt, arg1) #define VAR_DEBUG2(fmt, arg1, arg2) DEBUG2(VAR, fmt, arg1, arg2) @@ -3357,6 +3357,13 @@ ApplyModifiers( assert(val != NULL); p = *pp; + + if (*p == '\0' && endc != '\0') { + Error("Unclosed variable expression (expecting '%c') for \"%s\"", + st.endc, st.v->name); + goto cleanup; + } + while (*p != '\0' && *p != endc) { if (*p == '$') { |
