Module Name: src
Committed By: sjg
Date: Mon Jun 21 04:24:17 UTC 2021
Modified Files:
src/usr.bin/make: var.c
src/usr.bin/make/unit-tests: moderrs.exp moderrs.mk
Log Message:
Do not report unmatched regex subexpressions
It is not always an error for a subexpression to have not matched,
since the regex library can/does not convey how many matches are
expected, only report an error if opts.strict (-dL)
Reviewed by: christos
To generate a diff of this commit:
cvs rdiff -u -r1.932 -r1.933 src/usr.bin/make/var.c
cvs rdiff -u -r1.29 -r1.30 src/usr.bin/make/unit-tests/moderrs.exp
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/make/unit-tests/moderrs.mk
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.932 src/usr.bin/make/var.c:1.933
--- src/usr.bin/make/var.c:1.932 Sun May 30 20:41:34 2021
+++ src/usr.bin/make/var.c Mon Jun 21 04:24:17 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: var.c,v 1.932 2021/05/30 20:41:34 rillig Exp $ */
+/* $NetBSD: var.c,v 1.933 2021/06/21 04:24:17 sjg 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.932 2021/05/30 20:41:34 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.933 2021/06/21 04:24:17 sjg Exp $");
/*
* Variables are defined using one of the VAR=value assignments. Their
@@ -1651,9 +1651,11 @@ tryagain:
Error("No subexpression \\%u",
(unsigned)n);
} else if (m[n].rm_so == -1) {
- Error(
- "No match for subexpression \\%u",
- (unsigned)n);
+ if (opts.strict) {
+ Error(
+ "No match for subexpression \\%u",
+ (unsigned)n);
+ }
} else {
SepBuf_AddBytesBetween(buf,
wp + m[n].rm_so, wp + m[n].rm_eo);
Index: src/usr.bin/make/unit-tests/moderrs.exp
diff -u src/usr.bin/make/unit-tests/moderrs.exp:1.29 src/usr.bin/make/unit-tests/moderrs.exp:1.30
--- src/usr.bin/make/unit-tests/moderrs.exp:1.29 Tue Feb 23 16:07:14 2021
+++ src/usr.bin/make/unit-tests/moderrs.exp Mon Jun 21 04:24:17 2021
@@ -143,4 +143,4 @@ make: Unclosed variable expression, expe
1 1 2 x3 5 8 1x3 21 34
-exit status 0
+exit status 2
Index: src/usr.bin/make/unit-tests/moderrs.mk
diff -u src/usr.bin/make/unit-tests/moderrs.mk:1.27 src/usr.bin/make/unit-tests/moderrs.mk:1.28
--- src/usr.bin/make/unit-tests/moderrs.mk:1.27 Tue Feb 23 16:04:16 2021
+++ src/usr.bin/make/unit-tests/moderrs.mk Mon Jun 21 04:24:17 2021
@@ -1,7 +1,10 @@
-# $NetBSD: moderrs.mk,v 1.27 2021/02/23 16:04:16 rillig Exp $
+# $NetBSD: moderrs.mk,v 1.28 2021/06/21 04:24:17 sjg Exp $
#
# various modifier error tests
+# report unmatched subexpressions
+.MAKEFLAGS: -dL
+
'= '\''
VAR= TheVariable
# in case we have to change it ;-)