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): fix assertion failure in debug output ...
details: https://anonhg.NetBSD.org/src/rev/f9675fb2abb5
branches: trunk
changeset: 937666:f9675fb2abb5
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Aug 23 09:28:52 2020 +0000
description:
make(1): fix assertion failure in debug output for read-only variables
diffstat:
usr.bin/make/enum.h | 13 ++++++++-----
usr.bin/make/nonints.h | 4 +++-
usr.bin/make/unit-tests/Makefile | 6 ++++--
usr.bin/make/unit-tests/varname-dot-shell.exp | 5 +++++
usr.bin/make/unit-tests/varname-dot-shell.mk | 5 ++---
usr.bin/make/var.c | 23 ++++++++++++-----------
6 files changed, 34 insertions(+), 22 deletions(-)
diffs (165 lines):
diff -r b4b0aca632d4 -r f9675fb2abb5 usr.bin/make/enum.h
--- a/usr.bin/make/enum.h Sun Aug 23 09:18:25 2020 +0000
+++ b/usr.bin/make/enum.h Sun Aug 23 09:28:52 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: enum.h,v 1.5 2020/08/09 09:44:14 rillig Exp $ */
+/* $NetBSD: enum.h,v 1.6 2020/08/23 09:28:52 rillig Exp $ */
/*
Copyright (c) 2020 Roland Illig <rillig%NetBSD.org@localhost>
@@ -59,6 +59,8 @@
#v1 ENUM__SEP ENUM__JOIN_5(v2, v3, v4, v5, v6)
#define ENUM__JOIN_7(v1, v2, v3, v4, v5, v6, v7) \
#v1 ENUM__SEP ENUM__JOIN_6(v2, v3, v4, v5, v6, v7)
+#define ENUM__JOIN_8(v1, v2, v3, v4, v5, v6, v7, v8) \
+ #v1 ENUM__SEP ENUM__JOIN_7(v2, v3, v4, v5, v6, v7, v8)
#define ENUM__RTTI(typnam, specs, joined) \
static const EnumToStringSpec typnam ## _ ## ToStringSpecs[] = specs; \
@@ -72,7 +74,7 @@
ENUM__SPEC(v3), \
{ 0, "" } }
-#define ENUM__SPEC_7(v1, v2, v3, v4, v5, v6, v7) { \
+#define ENUM__SPEC_8(v1, v2, v3, v4, v5, v6, v7, v8) { \
ENUM__SPEC(v1), \
ENUM__SPEC(v2), \
ENUM__SPEC(v3), \
@@ -80,6 +82,7 @@
ENUM__SPEC(v5), \
ENUM__SPEC(v6), \
ENUM__SPEC(v7), \
+ ENUM__SPEC(v8), \
{ 0, "" } }
#define ENUM_RTTI_3(typnam, v1, v2, v3) \
@@ -87,9 +90,9 @@
ENUM__SPEC_3(v1, v2, v3), \
ENUM__JOIN_3(v1, v2, v3))
-#define ENUM_RTTI_7(typnam, v1, v2, v3, v4, v5, v6, v7) \
+#define ENUM_RTTI_8(typnam, v1, v2, v3, v4, v5, v6, v7, v8) \
ENUM__RTTI(typnam, \
- ENUM__SPEC_7(v1, v2, v3, v4, v5, v6, v7), \
- ENUM__JOIN_7(v1, v2, v3, v4, v5, v6, v7))
+ ENUM__SPEC_8(v1, v2, v3, v4, v5, v6, v7, v8), \
+ ENUM__JOIN_8(v1, v2, v3, v4, v5, v6, v7, v8))
#endif
diff -r b4b0aca632d4 -r f9675fb2abb5 usr.bin/make/nonints.h
--- a/usr.bin/make/nonints.h Sun Aug 23 09:18:25 2020 +0000
+++ b/usr.bin/make/nonints.h Sun Aug 23 09:28:52 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nonints.h,v 1.96 2020/08/22 19:30:58 sjg Exp $ */
+/* $NetBSD: nonints.h,v 1.97 2020/08/23 09:28:52 rillig Exp $ */
/*-
* Copyright (c) 1988, 1989, 1990, 1993
@@ -188,6 +188,8 @@
typedef enum {
VAR_NO_EXPORT = 0x01, /* do not export */
+ /* Make the variable read-only. No further modification is possible,
+ * except for another call to Var_Set with the same flag. */
VAR_SET_READONLY = 0x02
} VarSet_Flags;
diff -r b4b0aca632d4 -r f9675fb2abb5 usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile Sun Aug 23 09:18:25 2020 +0000
+++ b/usr.bin/make/unit-tests/Makefile Sun Aug 23 09:28:52 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.115 2020/08/23 09:18:25 rillig Exp $
+# $NetBSD: Makefile,v 1.116 2020/08/23 09:28:52 rillig Exp $
#
# Unit tests for make(1)
#
@@ -335,7 +335,9 @@
SED_CMDS.varmod-edge+= -e 's, line [0-9]*:, line omitted:,'
SED_CMDS.varshell+= -e 's,^${.SHELL:T}: ,,'
SED_CMDS.varshell+= -e '/command/s,No such.*,not found,'
-SED_CMDS.varname-dot-shell= -e 's, = /.*, = (details omitted),'
+SED_CMDS.varname-dot-shell= -e 's, = /.*, = (details omitted),'
+SED_CMDS.varname-dot-shell+= -e 's,"/[^"]*","(details omitted)",'
+SED_CMDS.varname-dot-shell+= -e 's,\[/[^]]*\],[(details omitted)],'
# Some tests need an additional round of postprocessing.
POSTPROC.counter= ${TOOL_SED} -n -e '/:RELEVANT = yes/,/:RELEVANT = no/p'
diff -r b4b0aca632d4 -r f9675fb2abb5 usr.bin/make/unit-tests/varname-dot-shell.exp
--- a/usr.bin/make/unit-tests/varname-dot-shell.exp Sun Aug 23 09:18:25 2020 +0000
+++ b/usr.bin/make/unit-tests/varname-dot-shell.exp Sun Aug 23 09:28:52 2020 +0000
@@ -11,4 +11,9 @@
Global:.SHELL = newly overwritten
Var_Parse: ${.SHELL} != ${ORIG_SHELL} with VARE_UNDEFERR|VARE_WANTRES
ParseReadLine (24): 'all:'
+ParseReadLine (25): ' @echo ${.SHELL:M*}'
+Var_Parse: ${.SHELL:M*} with VARE_WANTRES
+Applying ${.SHELL:M...} to "(details omitted)" (eflags = VARE_WANTRES, vflags = VAR_READONLY)
+Pattern[.SHELL] for [(details omitted)] is [*]
+Result of ${.SHELL:M*} is "(details omitted)" (eflags = VARE_WANTRES, vflags = VAR_READONLY)
exit status 0
diff -r b4b0aca632d4 -r f9675fb2abb5 usr.bin/make/unit-tests/varname-dot-shell.mk
--- a/usr.bin/make/unit-tests/varname-dot-shell.mk Sun Aug 23 09:18:25 2020 +0000
+++ b/usr.bin/make/unit-tests/varname-dot-shell.mk Sun Aug 23 09:28:52 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: varname-dot-shell.mk,v 1.1 2020/08/23 09:18:25 rillig Exp $
+# $NetBSD: varname-dot-shell.mk,v 1.2 2020/08/23 09:28:52 rillig Exp $
#
# Tests for the special .SHELL variable, which contains the shell used for
# running the commands.
@@ -22,5 +22,4 @@
.endif
all:
-# Cannot be activated yet because VAR_READONLY is not in the debug info.
-# @echo ${.SHELL:M*}
+ @echo ${.SHELL:M*}
diff -r b4b0aca632d4 -r f9675fb2abb5 usr.bin/make/var.c
--- a/usr.bin/make/var.c Sun Aug 23 09:18:25 2020 +0000
+++ b/usr.bin/make/var.c Sun Aug 23 09:28:52 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: var.c,v 1.462 2020/08/23 08:32:57 rillig Exp $ */
+/* $NetBSD: var.c,v 1.463 2020/08/23 09:28:52 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.462 2020/08/23 08:32:57 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.463 2020/08/23 09:28:52 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94";
#else
-__RCSID("$NetBSD: var.c,v 1.462 2020/08/23 08:32:57 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.463 2020/08/23 09:28:52 rillig Exp $");
#endif
#endif /* not lint */
#endif
@@ -229,14 +229,15 @@
VAR_READONLY = 0x80
} VarFlags;
-ENUM_RTTI_7(VarFlags,
- VAR_IN_USE,
- VAR_FROM_ENV,
- VAR_JUNK,
- VAR_KEEP,
- VAR_EXPORTED,
- VAR_REEXPORT,
- VAR_FROM_CMD);
+ENUM_RTTI_8(VarFlags,
+ VAR_IN_USE,
+ VAR_FROM_ENV,
+ VAR_JUNK,
+ VAR_KEEP,
+ VAR_EXPORTED,
+ VAR_REEXPORT,
+ VAR_FROM_CMD,
+ VAR_READONLY);
typedef struct Var {
char *name; /* the variable's name; it is allocated for
Home |
Main Index |
Thread Index |
Old Index