Module Name:    src
Committed By:   rillig
Date:           Sun Dec 20 19:10:54 UTC 2020

Modified Files:
        src/usr.bin/make: var.c
        src/usr.bin/make/unit-tests: opt-debug-lint.exp opt-debug-lint.mk

Log Message:
make(1): remove wrong error message for indirect modifier in lint mode


To generate a diff of this commit:
cvs rdiff -u -r1.752 -r1.753 src/usr.bin/make/var.c
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/opt-debug-lint.exp \
    src/usr.bin/make/unit-tests/opt-debug-lint.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.752 src/usr.bin/make/var.c:1.753
--- src/usr.bin/make/var.c:1.752	Sun Dec 20 19:02:28 2020
+++ src/usr.bin/make/var.c	Sun Dec 20 19:10:53 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.752 2020/12/20 19:02:28 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.753 2020/12/20 19:10:53 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -131,7 +131,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.752 2020/12/20 19:02:28 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.753 2020/12/20 19:10:53 rillig Exp $");
 
 typedef enum VarFlags {
 	VAR_NONE	= 0,
@@ -3455,12 +3455,6 @@ ApplyModifiersIndirect(ApplyModifiersSta
 	/* TODO: handle errors */
 
 	if (mods.str[0] != '\0' && *p != '\0' && *p != ':' && *p != st->endc) {
-		if (opts.lint)
-			Parse_Error(PARSE_FATAL,
-			    "Missing delimiter ':' "
-			    "after indirect modifier \"%.*s\"",
-			    (int)(p - *pp), *pp);
-
 		FStr_Done(&mods);
 		return AMIR_APPLY_MODS;
 	}

Index: src/usr.bin/make/unit-tests/opt-debug-lint.exp
diff -u src/usr.bin/make/unit-tests/opt-debug-lint.exp:1.11 src/usr.bin/make/unit-tests/opt-debug-lint.exp:1.12
--- src/usr.bin/make/unit-tests/opt-debug-lint.exp:1.11	Mon Oct  5 19:27:48 2020
+++ src/usr.bin/make/unit-tests/opt-debug-lint.exp	Sun Dec 20 19:10:53 2020
@@ -2,7 +2,6 @@ make: "opt-debug-lint.mk" line 19: Varia
 make: "opt-debug-lint.mk" line 41: Variable "UNDEF" is undefined
 make: "opt-debug-lint.mk" line 61: Missing delimiter ':' after modifier "L"
 make: "opt-debug-lint.mk" line 61: Missing delimiter ':' after modifier "P"
-make: "opt-debug-lint.mk" line 67: Missing delimiter ':' after indirect modifier "${:UL}"
 make: Unknown modifier '$'
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
Index: src/usr.bin/make/unit-tests/opt-debug-lint.mk
diff -u src/usr.bin/make/unit-tests/opt-debug-lint.mk:1.11 src/usr.bin/make/unit-tests/opt-debug-lint.mk:1.12
--- src/usr.bin/make/unit-tests/opt-debug-lint.mk:1.11	Sat Oct 24 08:50:17 2020
+++ src/usr.bin/make/unit-tests/opt-debug-lint.mk	Sun Dec 20 19:10:53 2020
@@ -1,4 +1,4 @@
-# $NetBSD: opt-debug-lint.mk,v 1.11 2020/10/24 08:50:17 rillig Exp $
+# $NetBSD: opt-debug-lint.mk,v 1.12 2020/12/20 19:10:53 rillig Exp $
 #
 # Tests for the -dL command line option, which runs additional checks
 # to catch common mistakes, such as unclosed variable expressions.
@@ -62,11 +62,20 @@ ${UNDEF}: ${UNDEF}
 .  error
 .endif
 
-# Since 2020-10-03, in lint mode the variable modifier must be separated
-# by colons.  See varparse-mod.mk.
+# Between 2020-10-03 and var.c 1.752 from 2020-12-20, in lint mode the
+# variable modifier had to be separated by colons.  This was wrong though
+# since make always fell back trying to parse the indirect modifier as a
+# SysV modifier.
 .if ${value:${:UL}PL} != "LPL}"		# FIXME: "LPL}" is unexpected here.
 .  error ${value:${:UL}PL}
 .endif
 
+# Typically, an indirect modifier is followed by a colon or the closing
+# brace.  This one isn't, therefore make falls back to parsing it as the SysV
+# modifier ":lue=lid".
+.if ${value:L:${:Ulue}=${:Ulid}} != "valid"
+.  error
+.endif
+
 all:
 	@:;

Reply via email to