CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Wed Aug 7 05:48:45 UTC 2024 Modified Files: src/usr.bin/make: cond.c src/usr.bin/make/unit-tests: cond-func.exp cond-func.mk directive-include-guard.exp directive-include-guard.mk Log Message: make: in erroneous conditions, report the non-expanded text In a condition, when a function call expression is missing its closing parenthesis, there's no point in having the expanded argument text in the error message. When parsing a bare word in a condition, the trailing space was included in that word, which was inconsistent, as the leading space was not included either. Removing the trailing space from the word reduces the cases where a multiple-inclusion guard steps in, but only in an edge case that is irrelevant in practice. To generate a diff of this commit: cvs rdiff -u -r1.368 -r1.369 src/usr.bin/make/cond.c cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/cond-func.exp cvs rdiff -u -r1.17 -r1.18 src/usr.bin/make/unit-tests/cond-func.mk \ src/usr.bin/make/unit-tests/directive-include-guard.mk cvs rdiff -u -r1.15 -r1.16 \ src/usr.bin/make/unit-tests/directive-include-guard.exp 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/cond.c diff -u src/usr.bin/make/cond.c:1.368 src/usr.bin/make/cond.c:1.369 --- src/usr.bin/make/cond.c:1.368 Tue Aug 6 18:00:16 2024 +++ src/usr.bin/make/cond.c Wed Aug 7 05:48:45 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: cond.c,v 1.368 2024/08/06 18:00:16 rillig Exp $ */ +/* $NetBSD: cond.c,v 1.369 2024/08/07 05:48:45 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -91,7 +91,7 @@ #include "dir.h" /* "@(#)cond.c 8.2 (Berkeley) 1/2/94" */ -MAKE_RCSID("$NetBSD: cond.c,v 1.368 2024/08/06 18:00:16 rillig Exp $"); +MAKE_RCSID("$NetBSD: cond.c,v 1.369 2024/08/07 05:48:45 rillig Exp $"); /* * Conditional expressions conform to this grammar: @@ -242,7 +242,6 @@ ParseWord(const char **pp, bool doEval) p++; } - cpp_skip_hspace(); *pp = p; return Buf_DoneData(); @@ -252,12 +251,14 @@ ParseWord(const char **pp, bool doEval) static char * ParseFuncArg(CondParser *par, const char **pp, bool doEval, const char *func) { - const char *p = *pp; + const char *p = *pp, *argStart, *argEnd; char *res; p++; /* skip the '(' */ cpp_skip_hspace(); + argStart = p; res = ParseWord(, doEval); + argEnd = p; cpp_skip_hspace(); if (*p++ != ')') { @@ -266,8 +267,8 @@ ParseFuncArg(CondParser *par, const char len++; Parse_Error(PARSE_FATAL, - "Missing ')' after argument '%s' for '%.*s'", - res, len, func); + "Missing ')' after argument '%.*s' for '%.*s'", + (int)(argEnd - argStart), argStart, len, func); par->printedError = true; free(res); return NULL; @@ -735,6 +736,7 @@ CondParser_ComparisonOrLeaf(CondParser * */ arg = ParseWord(, doEval); assert(arg[0] != '\0'); + cpp_skip_hspace(); if (*p == '=' || *p == '!' || *p == '<' || *p == '>') { free(arg); Index: src/usr.bin/make/unit-tests/cond-func.exp diff -u src/usr.bin/make/unit-tests/cond-func.exp:1.12 src/usr.bin/make/unit-tests/cond-func.exp:1.13 --- src/usr.bin/make/unit-tests/cond-func.exp:1.12 Wed Aug 7 05:37:11 2024 +++ src/usr.bin/make/unit-tests/cond-func.exp Wed Aug 7 05:48:45 2024 @@ -7,7 +7,7 @@ make: "cond-func.mk" line 115: A plain f make: "cond-func.mk" line 126: Symbols may start with a function name. make: "cond-func.mk" line 132: Symbols may start with a function name. make: "cond-func.mk" line 138: Missing ')' after argument '' for 'defined' -make: "cond-func.mk" line 146: Missing ')' after argument 'VARNAME.param' for 'defined' +make: "cond-func.mk" line 145: Missing ')' after argument '${:UVARNAME}.param' for 'defined' make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 Index: src/usr.bin/make/unit-tests/cond-func.mk diff -u src/usr.bin/make/unit-tests/cond-func.mk:1.17 src/usr.bin/make/unit-tests/cond-func.mk:1.18 --- src/usr.bin/make/unit-tests/cond-func.mk:1.17 Wed Aug 7 05:37:11 2024 +++ src/usr.bin/make/unit-tests/cond-func.mk Wed Aug 7 05:48:45 2024 @@ -1,4 +1,4 @@ -# $NetBSD: cond-func.mk,v 1.17 2024/08/07 05:37:11 rillig Exp $ +# $NetBSD: cond-func.mk,v 1.18 2024/08/07 05:48:45 rillig Exp $ # # Tests for those parts of the functions in .if conditions that are common # among several functions. @@ -141,8 +141,7 @@ defined-var= # defined but empty . error .endif -# XXX: Don't use the expanded argument in the diagnostic. -# expect+1: Missing ')' after argument 'VARNAME.param' for 'defined' +# expect+1: Missing ')' after argument '${:UVARNAME}.param' for 'defined' .if defined(${:UVARNAME}.param extra) . error .else Index: src/usr.bin/make/unit-tests/directive-include-guard.mk diff -u
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Wed Aug 7 05:48:45 UTC 2024 Modified Files: src/usr.bin/make: cond.c src/usr.bin/make/unit-tests: cond-func.exp cond-func.mk directive-include-guard.exp directive-include-guard.mk Log Message: make: in erroneous conditions, report the non-expanded text In a condition, when a function call expression is missing its closing parenthesis, there's no point in having the expanded argument text in the error message. When parsing a bare word in a condition, the trailing space was included in that word, which was inconsistent, as the leading space was not included either. Removing the trailing space from the word reduces the cases where a multiple-inclusion guard steps in, but only in an edge case that is irrelevant in practice. To generate a diff of this commit: cvs rdiff -u -r1.368 -r1.369 src/usr.bin/make/cond.c cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/cond-func.exp cvs rdiff -u -r1.17 -r1.18 src/usr.bin/make/unit-tests/cond-func.mk \ src/usr.bin/make/unit-tests/directive-include-guard.mk cvs rdiff -u -r1.15 -r1.16 \ src/usr.bin/make/unit-tests/directive-include-guard.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Wed Aug 7 05:37:11 UTC 2024 Modified Files: src/usr.bin/make/unit-tests: cond-func.exp cond-func.mk directive-include-guard.exp directive-include-guard.mk Log Message: tests/make: demonstrate unintended parsing of words in conditions A word is not supposed to include its trailing space, as it doesn't contain its leading space either. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/cond-func.exp cvs rdiff -u -r1.16 -r1.17 src/usr.bin/make/unit-tests/cond-func.mk \ src/usr.bin/make/unit-tests/directive-include-guard.mk cvs rdiff -u -r1.14 -r1.15 \ src/usr.bin/make/unit-tests/directive-include-guard.exp 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/unit-tests/cond-func.exp diff -u src/usr.bin/make/unit-tests/cond-func.exp:1.11 src/usr.bin/make/unit-tests/cond-func.exp:1.12 --- src/usr.bin/make/unit-tests/cond-func.exp:1.11 Tue Aug 6 17:46:01 2024 +++ src/usr.bin/make/unit-tests/cond-func.exp Wed Aug 7 05:37:11 2024 @@ -7,6 +7,7 @@ make: "cond-func.mk" line 115: A plain f make: "cond-func.mk" line 126: Symbols may start with a function name. make: "cond-func.mk" line 132: Symbols may start with a function name. make: "cond-func.mk" line 138: Missing ')' after argument '' for 'defined' +make: "cond-func.mk" line 146: Missing ')' after argument 'VARNAME.param' for 'defined' make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 Index: src/usr.bin/make/unit-tests/cond-func.mk diff -u src/usr.bin/make/unit-tests/cond-func.mk:1.16 src/usr.bin/make/unit-tests/cond-func.mk:1.17 --- src/usr.bin/make/unit-tests/cond-func.mk:1.16 Tue Aug 6 17:46:01 2024 +++ src/usr.bin/make/unit-tests/cond-func.mk Wed Aug 7 05:37:11 2024 @@ -1,4 +1,4 @@ -# $NetBSD: cond-func.mk,v 1.16 2024/08/06 17:46:01 rillig Exp $ +# $NetBSD: cond-func.mk,v 1.17 2024/08/07 05:37:11 rillig Exp $ # # Tests for those parts of the functions in .if conditions that are common # among several functions. @@ -140,3 +140,11 @@ defined-var= # defined but empty .else . error .endif + +# XXX: Don't use the expanded argument in the diagnostic. +# expect+1: Missing ')' after argument 'VARNAME.param' for 'defined' +.if defined(${:UVARNAME}.param extra) +. error +.else +. error +.endif Index: src/usr.bin/make/unit-tests/directive-include-guard.mk diff -u src/usr.bin/make/unit-tests/directive-include-guard.mk:1.16 src/usr.bin/make/unit-tests/directive-include-guard.mk:1.17 --- src/usr.bin/make/unit-tests/directive-include-guard.mk:1.16 Sun Dec 17 14:07:22 2023 +++ src/usr.bin/make/unit-tests/directive-include-guard.mk Wed Aug 7 05:37:11 2024 @@ -1,4 +1,4 @@ -# $NetBSD: directive-include-guard.mk,v 1.16 2023/12/17 14:07:22 rillig Exp $ +# $NetBSD: directive-include-guard.mk,v 1.17 2024/08/07 05:37:11 rillig Exp $ # # Tests for multiple-inclusion guards in makefiles. # @@ -583,13 +583,21 @@ LINES.target-name-exclamation= \ # If the guard target name is enclosed in spaces, it does not have an effect, # as that form is not common in practice. -CASES+= target-name-parenthesized -LINES.target-name-parenthesized= \ - '.if !target( target-name-parenthesized )' \ - 'target-name-parenthesized: .NOTMAIN' \ +CASES+= target-name-leading-space +LINES.target-name-leading-space= \ + '.if !target( target-name-leading-space)' \ + 'target-name-leading-space: .NOTMAIN' \ + '.endif' +# expect: Parse_PushInput: file target-name-leading-space.tmp, line 1 +# expect: Parse_PushInput: file target-name-leading-space.tmp, line 1 + +CASES+= target-name-trailing-space +LINES.target-name-trailing-space= \ + '.if !target(target-name-trailing-space )' \ + 'target-name-trailing-space: .NOTMAIN' \ '.endif' -# expect: Parse_PushInput: file target-name-parenthesized.tmp, line 1 -# expect: Parse_PushInput: file target-name-parenthesized.tmp, line 1 +# expect: Parse_PushInput: file target-name-trailing-space.tmp, line 1 +# expect: Skipping 'target-name-trailing-space.tmp' because 'target-name-trailing-space' is defined # If the guard target condition is enclosed in parentheses, it does not have # an effect, as that form is not common in practice. Index: src/usr.bin/make/unit-tests/directive-include-guard.exp diff -u src/usr.bin/make/unit-tests/directive-include-guard.exp:1.14 src/usr.bin/make/unit-tests/directive-include-guard.exp:1.15 --- src/usr.bin/make/unit-tests/directive-include-guard.exp:1.14 Sun Dec 17 14:07:22 2023 +++ src/usr.bin/make/unit-tests/directive-include-guard.exp Wed Aug 7 05:37:11 2024 @@ -95,8 +95,10 @@ Parse_PushInput: file target-already-def Skipping 'target-already-defined.tmp' because 'target-already-defined' is defined Parse_PushInput: file target-name-exclamation.tmp, line 1 Parse_PushInput: file target-name-exclamation.tmp, line 1 -Parse_PushInput: file
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Wed Aug 7 05:37:11 UTC 2024 Modified Files: src/usr.bin/make/unit-tests: cond-func.exp cond-func.mk directive-include-guard.exp directive-include-guard.mk Log Message: tests/make: demonstrate unintended parsing of words in conditions A word is not supposed to include its trailing space, as it doesn't contain its leading space either. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/cond-func.exp cvs rdiff -u -r1.16 -r1.17 src/usr.bin/make/unit-tests/cond-func.mk \ src/usr.bin/make/unit-tests/directive-include-guard.mk cvs rdiff -u -r1.14 -r1.15 \ src/usr.bin/make/unit-tests/directive-include-guard.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Tue Aug 6 18:00:17 UTC 2024 Modified Files: src/usr.bin/make: cond.c src/usr.bin/make/unit-tests: cond-cmp-numeric-eq.exp cond-cmp-numeric-eq.mk cond-cmp-numeric.exp cond-cmp-numeric.mk cond-cmp-string.exp cond-cmp-string.mk cond-eof.exp cond-eof.mk cond-func-empty.exp cond-func-empty.mk cond-op-and.exp cond-op-and.mk cond-op-not.exp cond-op-not.mk cond-op-or.exp cond-op-or.mk cond-op-parentheses.exp cond-op-parentheses.mk cond-op.exp cond-op.mk cond-token-number.exp cond-token-number.mk cond-token-plain.exp cond-token-plain.mk cond-token-string.exp cond-token-string.mk cond-token-var.exp cond-token-var.mk cond-undef-lint.exp cond-undef-lint.mk directive-if.exp directive-if.mk directive-include-fatal.exp directive-include-fatal.mk opt-debug-lint.exp opt-debug-lint.mk var-eval-short.exp var-eval-short.mk vardebug.exp vardebug.mk varmod-edge.exp varmod-edge.mk varmod-gmtime.exp varmod-gmtime.mk varmod-ifelse.exp varmod-ifelse.mk varmod-localtime.exp varmod-localtime.mk varmod-loop-varname.exp varmod-loop-varname.mk varmod-match.exp varmod-match.mk varmod-mtime.exp varmod-mtime.mk varmod-order.exp varmod-order.mk varmod-range.exp varmod-range.mk varmod-sysv.exp varmod-sysv.mk varmod-to-separator.exp varmod-to-separator.mk varmod.exp varmod.mk varparse-dynamic.exp varparse-dynamic.mk Log Message: make: in error message about conditionals, use single quotes Single quotes are used less often in the conditionals themselves, which leads to fewer confusions. To generate a diff of this commit: cvs rdiff -u -r1.367 -r1.368 src/usr.bin/make/cond.c cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/cond-cmp-numeric-eq.exp \ src/usr.bin/make/unit-tests/cond-eof.exp \ src/usr.bin/make/unit-tests/cond-op-and.exp cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/cond-cmp-numeric-eq.mk \ src/usr.bin/make/unit-tests/cond-cmp-numeric.mk \ src/usr.bin/make/unit-tests/cond-func-empty.exp \ src/usr.bin/make/unit-tests/cond-op-parentheses.exp \ src/usr.bin/make/unit-tests/cond-op-parentheses.mk cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/cond-cmp-numeric.exp \ src/usr.bin/make/unit-tests/cond-op-and.mk \ src/usr.bin/make/unit-tests/cond-token-number.mk \ src/usr.bin/make/unit-tests/varmod-loop-varname.exp cvs rdiff -u -r1.13 -r1.14 src/usr.bin/make/unit-tests/cond-cmp-string.exp \ src/usr.bin/make/unit-tests/cond-op.exp \ src/usr.bin/make/unit-tests/varmod-range.mk cvs rdiff -u -r1.19 -r1.20 src/usr.bin/make/unit-tests/cond-cmp-string.mk \ src/usr.bin/make/unit-tests/cond-token-plain.mk \ src/usr.bin/make/unit-tests/varmod-sysv.mk cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/cond-eof.mk \ src/usr.bin/make/unit-tests/cond-op-not.exp \ src/usr.bin/make/unit-tests/cond-op-or.exp \ src/usr.bin/make/unit-tests/cond-undef-lint.exp cvs rdiff -u -r1.25 -r1.26 src/usr.bin/make/unit-tests/cond-func-empty.mk cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/cond-op-not.mk \ src/usr.bin/make/unit-tests/cond-token-number.exp \ src/usr.bin/make/unit-tests/cond-token-var.mk \ src/usr.bin/make/unit-tests/varparse-dynamic.mk cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/cond-op-or.mk \ src/usr.bin/make/unit-tests/directive-if.mk cvs rdiff -u -r1.16 -r1.17 src/usr.bin/make/unit-tests/cond-op.mk \ src/usr.bin/make/unit-tests/varmod-to-separator.exp cvs rdiff -u -r1.20 -r1.21 src/usr.bin/make/unit-tests/cond-token-plain.exp \ src/usr.bin/make/unit-tests/opt-debug-lint.exp \ src/usr.bin/make/unit-tests/varmod-gmtime.exp \ src/usr.bin/make/unit-tests/varmod-match.exp cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/unit-tests/cond-token-string.exp \ src/usr.bin/make/unit-tests/var-eval-short.mk \ src/usr.bin/make/unit-tests/varmod-order.exp \ src/usr.bin/make/unit-tests/varmod-sysv.exp cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/cond-token-string.mk \ src/usr.bin/make/unit-tests/directive-if.exp \ src/usr.bin/make/unit-tests/vardebug.mk \ src/usr.bin/make/unit-tests/varmod-mtime.mk cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/cond-token-var.exp \ src/usr.bin/make/unit-tests/cond-undef-lint.mk \ src/usr.bin/make/unit-tests/directive-include-fatal.exp \ src/usr.bin/make/unit-tests/directive-include-fatal.mk cvs rdiff -u -r1.18 -r1.19 src/usr.bin/make/unit-tests/opt-debug-lint.mk \ src/usr.bin/make/unit-tests/varmod-to-separator.mk \ src/usr.bin/make/unit-tests/varmod.mk cvs rdiff -u -r1.29 -r1.30 src/usr.bin/make/unit-tests/var-eval-short.exp \ src/usr.bin/make/unit-tests/varmod-edge.mk cvs rdiff -u -r1.36 -r1.37
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Tue Aug 6 18:00:17 UTC 2024 Modified Files: src/usr.bin/make: cond.c src/usr.bin/make/unit-tests: cond-cmp-numeric-eq.exp cond-cmp-numeric-eq.mk cond-cmp-numeric.exp cond-cmp-numeric.mk cond-cmp-string.exp cond-cmp-string.mk cond-eof.exp cond-eof.mk cond-func-empty.exp cond-func-empty.mk cond-op-and.exp cond-op-and.mk cond-op-not.exp cond-op-not.mk cond-op-or.exp cond-op-or.mk cond-op-parentheses.exp cond-op-parentheses.mk cond-op.exp cond-op.mk cond-token-number.exp cond-token-number.mk cond-token-plain.exp cond-token-plain.mk cond-token-string.exp cond-token-string.mk cond-token-var.exp cond-token-var.mk cond-undef-lint.exp cond-undef-lint.mk directive-if.exp directive-if.mk directive-include-fatal.exp directive-include-fatal.mk opt-debug-lint.exp opt-debug-lint.mk var-eval-short.exp var-eval-short.mk vardebug.exp vardebug.mk varmod-edge.exp varmod-edge.mk varmod-gmtime.exp varmod-gmtime.mk varmod-ifelse.exp varmod-ifelse.mk varmod-localtime.exp varmod-localtime.mk varmod-loop-varname.exp varmod-loop-varname.mk varmod-match.exp varmod-match.mk varmod-mtime.exp varmod-mtime.mk varmod-order.exp varmod-order.mk varmod-range.exp varmod-range.mk varmod-sysv.exp varmod-sysv.mk varmod-to-separator.exp varmod-to-separator.mk varmod.exp varmod.mk varparse-dynamic.exp varparse-dynamic.mk Log Message: make: in error message about conditionals, use single quotes Single quotes are used less often in the conditionals themselves, which leads to fewer confusions. To generate a diff of this commit: cvs rdiff -u -r1.367 -r1.368 src/usr.bin/make/cond.c cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/cond-cmp-numeric-eq.exp \ src/usr.bin/make/unit-tests/cond-eof.exp \ src/usr.bin/make/unit-tests/cond-op-and.exp cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/cond-cmp-numeric-eq.mk \ src/usr.bin/make/unit-tests/cond-cmp-numeric.mk \ src/usr.bin/make/unit-tests/cond-func-empty.exp \ src/usr.bin/make/unit-tests/cond-op-parentheses.exp \ src/usr.bin/make/unit-tests/cond-op-parentheses.mk cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/cond-cmp-numeric.exp \ src/usr.bin/make/unit-tests/cond-op-and.mk \ src/usr.bin/make/unit-tests/cond-token-number.mk \ src/usr.bin/make/unit-tests/varmod-loop-varname.exp cvs rdiff -u -r1.13 -r1.14 src/usr.bin/make/unit-tests/cond-cmp-string.exp \ src/usr.bin/make/unit-tests/cond-op.exp \ src/usr.bin/make/unit-tests/varmod-range.mk cvs rdiff -u -r1.19 -r1.20 src/usr.bin/make/unit-tests/cond-cmp-string.mk \ src/usr.bin/make/unit-tests/cond-token-plain.mk \ src/usr.bin/make/unit-tests/varmod-sysv.mk cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/cond-eof.mk \ src/usr.bin/make/unit-tests/cond-op-not.exp \ src/usr.bin/make/unit-tests/cond-op-or.exp \ src/usr.bin/make/unit-tests/cond-undef-lint.exp cvs rdiff -u -r1.25 -r1.26 src/usr.bin/make/unit-tests/cond-func-empty.mk cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/cond-op-not.mk \ src/usr.bin/make/unit-tests/cond-token-number.exp \ src/usr.bin/make/unit-tests/cond-token-var.mk \ src/usr.bin/make/unit-tests/varparse-dynamic.mk cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/cond-op-or.mk \ src/usr.bin/make/unit-tests/directive-if.mk cvs rdiff -u -r1.16 -r1.17 src/usr.bin/make/unit-tests/cond-op.mk \ src/usr.bin/make/unit-tests/varmod-to-separator.exp cvs rdiff -u -r1.20 -r1.21 src/usr.bin/make/unit-tests/cond-token-plain.exp \ src/usr.bin/make/unit-tests/opt-debug-lint.exp \ src/usr.bin/make/unit-tests/varmod-gmtime.exp \ src/usr.bin/make/unit-tests/varmod-match.exp cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/unit-tests/cond-token-string.exp \ src/usr.bin/make/unit-tests/var-eval-short.mk \ src/usr.bin/make/unit-tests/varmod-order.exp \ src/usr.bin/make/unit-tests/varmod-sysv.exp cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/cond-token-string.mk \ src/usr.bin/make/unit-tests/directive-if.exp \ src/usr.bin/make/unit-tests/vardebug.mk \ src/usr.bin/make/unit-tests/varmod-mtime.mk cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/cond-token-var.exp \ src/usr.bin/make/unit-tests/cond-undef-lint.mk \ src/usr.bin/make/unit-tests/directive-include-fatal.exp \ src/usr.bin/make/unit-tests/directive-include-fatal.mk cvs rdiff -u -r1.18 -r1.19 src/usr.bin/make/unit-tests/opt-debug-lint.mk \ src/usr.bin/make/unit-tests/varmod-to-separator.mk \ src/usr.bin/make/unit-tests/varmod.mk cvs rdiff -u -r1.29 -r1.30 src/usr.bin/make/unit-tests/var-eval-short.exp \ src/usr.bin/make/unit-tests/varmod-edge.mk cvs rdiff -u -r1.36 -r1.37
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Tue Aug 6 17:46:01 UTC 2024 Modified Files: src/usr.bin/make: arch.c cond.c src/usr.bin/make/unit-tests: cond-func-defined.exp cond-func-defined.mk cond-func.exp cond-func.mk varname.exp varname.mk Log Message: make: add details to error messages about missing ')' To generate a diff of this commit: cvs rdiff -u -r1.221 -r1.222 src/usr.bin/make/arch.c cvs rdiff -u -r1.366 -r1.367 src/usr.bin/make/cond.c cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/cond-func-defined.exp \ src/usr.bin/make/unit-tests/cond-func.exp cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/cond-func-defined.mk cvs rdiff -u -r1.15 -r1.16 src/usr.bin/make/unit-tests/cond-func.mk cvs rdiff -u -r1.21 -r1.22 src/usr.bin/make/unit-tests/varname.exp cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/unit-tests/varname.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/arch.c diff -u src/usr.bin/make/arch.c:1.221 src/usr.bin/make/arch.c:1.222 --- src/usr.bin/make/arch.c:1.221 Sun Jul 7 07:50:57 2024 +++ src/usr.bin/make/arch.c Tue Aug 6 17:46:01 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: arch.c,v 1.221 2024/07/07 07:50:57 rillig Exp $ */ +/* $NetBSD: arch.c,v 1.222 2024/08/06 17:46:01 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -126,7 +126,7 @@ #include "config.h" /* "@(#)arch.c 8.2 (Berkeley) 1/2/94" */ -MAKE_RCSID("$NetBSD: arch.c,v 1.221 2024/07/07 07:50:57 rillig Exp $"); +MAKE_RCSID("$NetBSD: arch.c,v 1.222 2024/08/06 17:46:01 rillig Exp $"); typedef struct List ArchList; typedef struct ListNode ArchListNode; @@ -266,8 +266,7 @@ Arch_ParseArchive(char **pp, GNodeList * if (*cp == '\0') { Parse_Error(PARSE_FATAL, - "No closing parenthesis " - "in archive specification"); + "Missing ')' in archive specification"); return false; } Index: src/usr.bin/make/cond.c diff -u src/usr.bin/make/cond.c:1.366 src/usr.bin/make/cond.c:1.367 --- src/usr.bin/make/cond.c:1.366 Sat Jul 6 21:21:09 2024 +++ src/usr.bin/make/cond.c Tue Aug 6 17:46:01 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: cond.c,v 1.366 2024/07/06 21:21:09 rillig Exp $ */ +/* $NetBSD: cond.c,v 1.367 2024/08/06 17:46:01 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -91,7 +91,7 @@ #include "dir.h" /* "@(#)cond.c 8.2 (Berkeley) 1/2/94" */ -MAKE_RCSID("$NetBSD: cond.c,v 1.366 2024/07/06 21:21:09 rillig Exp $"); +MAKE_RCSID("$NetBSD: cond.c,v 1.367 2024/08/06 17:46:01 rillig Exp $"); /* * Conditional expressions conform to this grammar: @@ -266,7 +266,8 @@ ParseFuncArg(CondParser *par, const char len++; Parse_Error(PARSE_FATAL, - "Missing closing parenthesis for %.*s()", len, func); + "Missing ')' after argument '%s' for '%.*s'", + res, len, func); par->printedError = true; free(res); return NULL; Index: src/usr.bin/make/unit-tests/cond-func-defined.exp diff -u src/usr.bin/make/unit-tests/cond-func-defined.exp:1.10 src/usr.bin/make/unit-tests/cond-func-defined.exp:1.11 --- src/usr.bin/make/unit-tests/cond-func-defined.exp:1.10 Thu Jul 4 20:18:40 2024 +++ src/usr.bin/make/unit-tests/cond-func-defined.exp Tue Aug 6 17:46:01 2024 @@ -1,5 +1,5 @@ -make: "cond-func-defined.mk" line 24: Missing closing parenthesis for defined() -make: "cond-func-defined.mk" line 34: Missing closing parenthesis for defined() +make: "cond-func-defined.mk" line 24: Missing ')' after argument 'A' for 'defined' +make: "cond-func-defined.mk" line 34: Missing ')' after argument 'DEF' for 'defined' make: Fatal errors encountered -- cannot continue make: stopped making "all" in unit-tests exit status 1 Index: src/usr.bin/make/unit-tests/cond-func.exp diff -u src/usr.bin/make/unit-tests/cond-func.exp:1.10 src/usr.bin/make/unit-tests/cond-func.exp:1.11 --- src/usr.bin/make/unit-tests/cond-func.exp:1.10 Sat Jul 6 21:21:10 2024 +++ src/usr.bin/make/unit-tests/cond-func.exp Tue Aug 6 17:46:01 2024 @@ -1,12 +1,12 @@ -make: "cond-func.mk" line 37: Missing closing parenthesis for defined() -make: "cond-func.mk" line 53: Missing closing parenthesis for defined() -make: "cond-func.mk" line 57: Missing closing parenthesis for defined() +make: "cond-func.mk" line 37: Missing ')' after argument 'A' for 'defined' +make: "cond-func.mk" line 53: Missing ')' after argument 'A' for 'defined' +make: "cond-func.mk" line 57: Missing ')' after argument 'A' for 'defined' make: "cond-func.mk" line 91: Unknown operator '&' make: "cond-func.mk" line 107: A plain function name is parsed as defined(...). make: "cond-func.mk" line 115: A plain function name is parsed as defined(...). make: "cond-func.mk" line 126: Symbols may start with a function name. make: "cond-func.mk" line 132: Symbols may start with a function name. -make: "cond-func.mk" line 138: Missing closing parenthesis
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Tue Aug 6 17:46:01 UTC 2024 Modified Files: src/usr.bin/make: arch.c cond.c src/usr.bin/make/unit-tests: cond-func-defined.exp cond-func-defined.mk cond-func.exp cond-func.mk varname.exp varname.mk Log Message: make: add details to error messages about missing ')' To generate a diff of this commit: cvs rdiff -u -r1.221 -r1.222 src/usr.bin/make/arch.c cvs rdiff -u -r1.366 -r1.367 src/usr.bin/make/cond.c cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/cond-func-defined.exp \ src/usr.bin/make/unit-tests/cond-func.exp cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/cond-func-defined.mk cvs rdiff -u -r1.15 -r1.16 src/usr.bin/make/unit-tests/cond-func.mk cvs rdiff -u -r1.21 -r1.22 src/usr.bin/make/unit-tests/varname.exp cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/unit-tests/varname.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/printf
Module Name:src Committed By: uwe Date: Tue Aug 6 17:23:01 UTC 2024 Modified Files: src/usr.bin/printf: printf.1 Log Message: printf(1): misc tweaks Move the advise about getopt's "--" to where the format is disussed. Use .Vt for types. To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 src/usr.bin/printf/printf.1 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/printf/printf.1 diff -u src/usr.bin/printf/printf.1:1.39 src/usr.bin/printf/printf.1:1.40 --- src/usr.bin/printf/printf.1:1.39 Tue Aug 6 17:18:00 2024 +++ src/usr.bin/printf/printf.1 Tue Aug 6 17:23:01 2024 @@ -1,4 +1,4 @@ -.\" $NetBSD: printf.1,v 1.39 2024/08/06 17:18:00 uwe Exp $ +.\" $NetBSD: printf.1,v 1.40 2024/08/06 17:23:01 uwe Exp $ .\" .\" Copyright (c) 1989, 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -56,13 +56,24 @@ are converted and copied to the standard each of which causes printing of the next successive .Ar argument . .Pp +If the first character of +.Ar format +is a dash, +.Ar format +must be preceded by a word consisting of two dashes +.Pq Sq Fl Fl +to prevent it +from being interpreted as an option string. +See +.Xr getopt 3 . +.Pp The .Fl L option causes all floating point values resulting from format conversions to be printed using -.Em long double +.Vt long double formats, rather than the default -.Em double . +.Vt double . .Pp The .Ar arguments @@ -424,17 +435,6 @@ precision is omitted, all characters in In no case does a non-existent or small field width cause truncation of a field; padding takes place only if the specified field width exceeds the actual width. -.Pp -If the first character of -.Ar format -is a dash, -.Ar format -must be preceded by a word consisting of two dashes -.Pq Sq Fl Fl -to prevent it -from being interpreted as an option string. -See -.Xr getopt 3 . .Sh EXIT STATUS .Ex -std .Sh SEE ALSO
CVS commit: src/usr.bin/printf
Module Name:src Committed By: uwe Date: Tue Aug 6 17:23:01 UTC 2024 Modified Files: src/usr.bin/printf: printf.1 Log Message: printf(1): misc tweaks Move the advise about getopt's "--" to where the format is disussed. Use .Vt for types. To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 src/usr.bin/printf/printf.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/printf
Module Name:src Committed By: uwe Date: Tue Aug 6 17:18:01 UTC 2024 Modified Files: src/usr.bin/printf: printf.1 Log Message: printf(1): move \e description to its lexicographic place To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/usr.bin/printf/printf.1 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/printf/printf.1 diff -u src/usr.bin/printf/printf.1:1.38 src/usr.bin/printf/printf.1:1.39 --- src/usr.bin/printf/printf.1:1.38 Tue Aug 6 14:55:48 2024 +++ src/usr.bin/printf/printf.1 Tue Aug 6 17:18:00 2024 @@ -1,4 +1,4 @@ -.\" $NetBSD: printf.1,v 1.38 2024/08/06 14:55:48 kre Exp $ +.\" $NetBSD: printf.1,v 1.39 2024/08/06 17:18:00 uwe Exp $ .\" .\" Copyright (c) 1989, 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -92,10 +92,6 @@ Character escape sequences are in backsl .St -ansiC . The characters and their meanings are as follows: .Bl -tag -offset indent -width Cm -.It Cm \ee -Write an -.Aq escape -character. .It Cm \ea Write a .Aq bell @@ -104,6 +100,10 @@ character. Write a .Aq backspace character. +.It Cm \ee +Write an +.Aq escape +character. .It Cm \ef Write a .Aq form-feed
CVS commit: src/usr.bin/printf
Module Name:src Committed By: uwe Date: Tue Aug 6 17:18:01 UTC 2024 Modified Files: src/usr.bin/printf: printf.1 Log Message: printf(1): move \e description to its lexicographic place To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/usr.bin/printf/printf.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/printf
Module Name:src Committed By: kre Date: Tue Aug 6 14:55:48 UTC 2024 Modified Files: src/usr.bin/printf: printf.1 printf.c Log Message: Add %C format conversion and -L option to printf(1) %C does what everyone always thought %c should do, but doesn't, and operates rather like the %c conversion in printf(3) (to be more precise, like %lc). It takes a code point integer value in the current locale's LC_CTYPE and prints the character designated. -L (this printf's first, and only, option) makes the floating conversions use long double instead of double. In the manual (printf.1) document both of those, and also be more precise as to when things are affecting bytes, and when they're manipulating characters (which makes no difference if LC_ALL=C). To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/usr.bin/printf/printf.1 cvs rdiff -u -r1.56 -r1.57 src/usr.bin/printf/printf.c 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/printf/printf.1 diff -u src/usr.bin/printf/printf.1:1.37 src/usr.bin/printf/printf.1:1.38 --- src/usr.bin/printf/printf.1:1.37 Mon Feb 13 23:02:27 2023 +++ src/usr.bin/printf/printf.1 Tue Aug 6 14:55:48 2024 @@ -1,4 +1,4 @@ -.\" $NetBSD: printf.1,v 1.37 2023/02/13 23:02:27 andvar Exp $ +.\" $NetBSD: printf.1,v 1.38 2024/08/06 14:55:48 kre Exp $ .\" .\" Copyright (c) 1989, 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -32,7 +32,7 @@ .\" .\" from: @(#)printf.1 8.1 (Berkeley) 6/6/93 .\" -.Dd May 19, 2021 +.Dd August 6, 2024 .Dt PRINTF 1 .Os .Sh NAME @@ -40,6 +40,7 @@ .Nd formatted output .Sh SYNOPSIS .Nm +.Op Fl L .Ar format .Op Ar arguments ... .Sh DESCRIPTION @@ -56,6 +57,14 @@ each of which causes printing of the nex .Ar argument . .Pp The +.Fl L +option causes all floating point values resulting from format +conversions to be printed using +.Em long double +formats, rather than the default +.Em double . +.Pp +The .Ar arguments after the first are treated as strings if the corresponding format is either @@ -69,8 +78,9 @@ otherwise it is evaluated as a C\~consta .It A leading plus or minus sign is allowed. .It -If the leading character is a single or double quote, the value is the ASCII +If the leading character is a single or double quote, the value is the code of the next character. +No further characters are permitted. .El .Pp The format string is reused as often as necessary to satisfy the @@ -154,6 +164,7 @@ character specifying that the value shou For .Cm b , .Cm c , +.Cm C , .Cm d , and .Cm s @@ -219,7 +230,7 @@ if both are used; .It Field Width : An optional digit string specifying a .Em field width ; -if the output string has fewer characters than the field width it will +if the output string has fewer bytes than the field width it will be space-padded on the left (or right, if the left-adjustment indicator has been given) to make up the field width (note that a leading zero is a flag, but an embedded zero is part of a field width); @@ -233,7 +244,7 @@ for .Cm e and .Cm f -formats, or the maximum number of characters to be printed +formats, or the maximum number of bytes to be printed from a string .Sm off .Pf ( Cm b , @@ -245,7 +256,7 @@ formats); if the digit string is missing as zero; .It Format : A character which indicates the type of format to use (one of -.Cm diouxXfFeEgGaAbBcs ) . +.Cm diouxXfFeEgGaAbBcCs ) . .El .Pp A field width or precision may be @@ -396,10 +407,16 @@ formats described above. The first character of .Ar argument is printed. +.It Cm C +The +.Ar argument , +which must represent an integer constant, +with an optional leading plus or minus sign, +is treated as a wide character code point, and printed. .It Cm s Characters from the string .Ar argument -are printed until the end is reached or until the number of characters +are printed until the end is reached or until the number of bytes indicated by the precision specification is reached; if the precision is omitted, all characters in the string are printed. .El @@ -416,6 +433,8 @@ must be preceded by a word consisting of .Pq Sq Fl Fl to prevent it from being interpreted as an option string. +See +.Xr getopt 3 . .Sh EXIT STATUS .Ex -std .Sh SEE ALSO @@ -436,7 +455,9 @@ are optional in POSIX. .Pp The behaviour of the .Cm \&%B -format and the +and +.Cm \&%C +formats and the .Cm \e\(aq , .Cm \e\*q , .Cm \ee , @@ -466,7 +487,9 @@ One might expect the format to do likewise, but in fact it does not. .Pp To convert a string representation of a decimal, octal, or hexadecimal -number into the corresponding character, two nested +number into the corresponding character, +using a portable invocation, +two nested .Nm invocations may be used, in which the inner invocation converts the input to an octal string, and the outer @@ -475,3 +498,9 @@ For example, the
CVS commit: src/usr.bin/printf
Module Name:src Committed By: kre Date: Tue Aug 6 14:55:48 UTC 2024 Modified Files: src/usr.bin/printf: printf.1 printf.c Log Message: Add %C format conversion and -L option to printf(1) %C does what everyone always thought %c should do, but doesn't, and operates rather like the %c conversion in printf(3) (to be more precise, like %lc). It takes a code point integer value in the current locale's LC_CTYPE and prints the character designated. -L (this printf's first, and only, option) makes the floating conversions use long double instead of double. In the manual (printf.1) document both of those, and also be more precise as to when things are affecting bytes, and when they're manipulating characters (which makes no difference if LC_ALL=C). To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/usr.bin/printf/printf.1 cvs rdiff -u -r1.56 -r1.57 src/usr.bin/printf/printf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/printf
Module Name:src Committed By: kre Date: Tue Aug 6 07:48:16 UTC 2024 Modified Files: src/usr.bin/printf: printf.c Log Message: PR bin/58534 -- printf(1) source code comment fix Update the comment near the start of main() in printf.c so it explains what is really happening and why, rather than being a whole bunch of incorrect BS about what posix does or doesn't require. This changes comments only, NFC (should be no binary change at all). To generate a diff of this commit: cvs rdiff -u -r1.55 -r1.56 src/usr.bin/printf/printf.c 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/printf/printf.c diff -u src/usr.bin/printf/printf.c:1.55 src/usr.bin/printf/printf.c:1.56 --- src/usr.bin/printf/printf.c:1.55 Thu Jul 18 12:08:11 2024 +++ src/usr.bin/printf/printf.c Tue Aug 6 07:48:16 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: printf.c,v 1.55 2024/07/18 12:08:11 wiz Exp $ */ +/* $NetBSD: printf.c,v 1.56 2024/08/06 07:48:16 kre Exp $ */ /* * Copyright (c) 1989, 1993 @@ -41,7 +41,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 19 #if 0 static char sccsid[] = "@(#)printf.c 8.2 (Berkeley) 3/22/95"; #else -__RCSID("$NetBSD: printf.c,v 1.55 2024/07/18 12:08:11 wiz Exp $"); +__RCSID("$NetBSD: printf.c,v 1.56 2024/08/06 07:48:16 kre Exp $"); #endif #endif /* not lint */ @@ -144,23 +144,33 @@ main(int argc, char *argv[]) rval = 0; /* clear for builtin versions (avoid holdover) */ clearerr(stdout); /* for the builtin version */ - /* - * printf does not comply with Posix XBD 12.2 - there are no opts, - * not even the -- end of options marker. Do not run getopt(). - */ if (argc > 2 && strchr(argv[1], '%') == NULL) { int o; /* - * except that if there are multiple args and - * the first (the nominal format) contains no '%' - * conversions (which we will approximate as no '%' - * characters at all, conversions or not) then the - * results are unspecified, and we can do what we - * like. So in that case, for some backward compat - * to scripts which (stupidly) do: - * printf -- format args - * process this case the old way. + * We only do this for argc > 2, as: + * + * for argc <= 1 + * at best we have a bare "printf" so there cannot be + * any options, thus getopts() would be a waste of time. + * The usage() below is assured. + * + * for argc == 2 + * There is only one arg (argv[1]) which logically must + * be intended to be the (required) format string for + * printf, without which we can do nothing so rather + * than usage() if it happens to start with a '-' we + * just avoid getopts() and treat it as a format string. + * + * Then, for argc > 2, we also skip this if there is a '%' + * anywhere in argv[1] as it is likely that would be intended + * to be the format string, rather than options, even if it + * starts with a '-' so we skip getopts() in that case as well. + * + * Note that this would fail should there ever be an option + * which takes an arbitrary string value, which could be given + * as -Oabc%def so should that ever become possible, remove + * the strchr() test above. */ while ((o = getopt(argc, argv, "")) != -1) { @@ -178,13 +188,13 @@ main(int argc, char *argv[]) argv += 1; } - if (argc < 1) { + if (argc < 1) { /* Nothing left at all? */ usage(); return 1; } - format = *argv; - gargv = ++argv; + format = *argv; /* First remaining arg is the format string */ + gargv = ++argv; /* remaining args are for that to consume */ #define SKIP1 "#-+ 0'" #define SKIP2 "0123456789"
CVS commit: src/usr.bin/printf
Module Name:src Committed By: kre Date: Tue Aug 6 07:48:16 UTC 2024 Modified Files: src/usr.bin/printf: printf.c Log Message: PR bin/58534 -- printf(1) source code comment fix Update the comment near the start of main() in printf.c so it explains what is really happening and why, rather than being a whole bunch of incorrect BS about what posix does or doesn't require. This changes comments only, NFC (should be no binary change at all). To generate a diff of this commit: cvs rdiff -u -r1.55 -r1.56 src/usr.bin/printf/printf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/getconf
Module Name:src Committed By: rillig Date: Mon Jul 22 21:03:17 UTC 2024 Modified Files: src/usr.bin/getconf: getconf.c Log Message: getconf: clean up obsolete lint stuff The warning about the "weird expression" was fixed in lint's tree.c 1.201 from 2021-01-31. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/usr.bin/getconf/getconf.c 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/getconf/getconf.c diff -u src/usr.bin/getconf/getconf.c:1.37 src/usr.bin/getconf/getconf.c:1.38 --- src/usr.bin/getconf/getconf.c:1.37 Sat Jan 27 16:04:36 2024 +++ src/usr.bin/getconf/getconf.c Mon Jul 22 21:03:17 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: getconf.c,v 1.37 2024/01/27 16:04:36 christos Exp $ */ +/* $NetBSD: getconf.c,v 1.38 2024/07/22 21:03:17 rillig Exp $ */ /*- * Copyright (c) 1996, 1998 The NetBSD Foundation, Inc. @@ -30,9 +30,7 @@ */ #include -#ifndef lint -__RCSID("$NetBSD: getconf.c,v 1.37 2024/01/27 16:04:36 christos Exp $"); -#endif /* not lint */ +__RCSID("$NetBSD: getconf.c,v 1.38 2024/07/22 21:03:17 rillig Exp $"); #include #include @@ -234,7 +232,6 @@ main(int argc, char **argv) again: for (cp = conf_table; cp->name != NULL; cp++) { if (a_flag || strcmp(vn, cp->name) == 0) { - /*LINTED weird expression*/ if ((cp->type == PATHCONF) == (pathname != NULL)) { printvar(cp, pathname); found = 1;
CVS commit: src/usr.bin/getconf
Module Name:src Committed By: rillig Date: Mon Jul 22 21:03:17 UTC 2024 Modified Files: src/usr.bin/getconf: getconf.c Log Message: getconf: clean up obsolete lint stuff The warning about the "weird expression" was fixed in lint's tree.c 1.201 from 2021-01-31. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/usr.bin/getconf/getconf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Mon Jul 22 18:15:04 UTC 2024 Modified Files: src/usr.bin/make: job.c Log Message: make: remove dead code To generate a diff of this commit: cvs rdiff -u -r1.482 -r1.483 src/usr.bin/make/job.c 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/job.c diff -u src/usr.bin/make/job.c:1.482 src/usr.bin/make/job.c:1.483 --- src/usr.bin/make/job.c:1.482 Mon Jul 22 18:11:15 2024 +++ src/usr.bin/make/job.c Mon Jul 22 18:15:04 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.482 2024/07/22 18:11:15 rillig Exp $ */ +/* $NetBSD: job.c,v 1.483 2024/07/22 18:15:04 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -141,7 +141,7 @@ #include "trace.h" /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: job.c,v 1.482 2024/07/22 18:11:15 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.483 2024/07/22 18:15:04 rillig Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -1943,30 +1943,12 @@ again: static void JobRun(GNode *targ) { -#if 0 - /* - * Unfortunately it is too complicated to run .BEGIN, .END, and - * .INTERRUPT job in the parallel job module. As of 2020-09-25, - * unit-tests/deptgt-end-jobs.mk hangs in an endless loop. - * - * Running these jobs in compat mode also guarantees that these - * jobs do not overlap with other unrelated jobs. - */ - GNodeList lst = LST_INIT; - Lst_Append(, targ); - (void)Make_Run(); - Lst_Done(); - JobStart(targ, true); - while (jobTokensRunning != 0) { - Job_CatchOutput(); - } -#else + /* Don't let these special jobs overlap with other unrelated jobs. */ Compat_Make(targ, targ); if (GNode_IsError(targ)) { PrintOnError(targ, "\n\nStop.\n"); exit(1); } -#endif } /* @@ -2905,11 +2887,6 @@ Job_RunTarget(const char *target, const Var_Set(gn, ALLSRC, fname); JobRun(gn); - /* XXX: Replace with GNode_IsError(gn) */ - if (gn->made == ERROR) { - PrintOnError(gn, "\n\nStop.\n"); - exit(1); - } return true; }
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Mon Jul 22 18:15:04 UTC 2024 Modified Files: src/usr.bin/make: job.c Log Message: make: remove dead code To generate a diff of this commit: cvs rdiff -u -r1.482 -r1.483 src/usr.bin/make/job.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Mon Jul 22 18:11:15 UTC 2024 Modified Files: src/usr.bin/make: job.c src/usr.bin/make/unit-tests: cmd-errors-jobs.exp cmd-errors-jobs.mk Log Message: make: fix exit status for error in .BEGIN/.END prerequisite To generate a diff of this commit: cvs rdiff -u -r1.481 -r1.482 src/usr.bin/make/job.c cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/cmd-errors-jobs.exp cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/cmd-errors-jobs.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/job.c diff -u src/usr.bin/make/job.c:1.481 src/usr.bin/make/job.c:1.482 --- src/usr.bin/make/job.c:1.481 Sat Jul 20 14:09:27 2024 +++ src/usr.bin/make/job.c Mon Jul 22 18:11:15 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.481 2024/07/20 14:09:27 rillig Exp $ */ +/* $NetBSD: job.c,v 1.482 2024/07/22 18:11:15 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -141,7 +141,7 @@ #include "trace.h" /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: job.c,v 1.481 2024/07/20 14:09:27 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.482 2024/07/22 18:11:15 rillig Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -1962,8 +1962,7 @@ JobRun(GNode *targ) } #else Compat_Make(targ, targ); - /* XXX: Replace with GNode_IsError(gn) */ - if (targ->made == ERROR) { + if (GNode_IsError(targ)) { PrintOnError(targ, "\n\nStop.\n"); exit(1); } Index: src/usr.bin/make/unit-tests/cmd-errors-jobs.exp diff -u src/usr.bin/make/unit-tests/cmd-errors-jobs.exp:1.12 src/usr.bin/make/unit-tests/cmd-errors-jobs.exp:1.13 --- src/usr.bin/make/unit-tests/cmd-errors-jobs.exp:1.12 Mon Jul 22 18:02:51 2024 +++ src/usr.bin/make/unit-tests/cmd-errors-jobs.exp Mon Jul 22 18:11:15 2024 @@ -30,7 +30,11 @@ end begin-direct with status 1 begin begin-indirect (exit 13) # before-begin *** Error code 13 (continuing) -end begin-indirect with status 0 + + +Stop. +make: stopped making "begin-indirect" in unit-tests +end begin-indirect with status 1 begin end-direct (exit 13) # .END @@ -44,6 +48,10 @@ end end-direct with status 1 begin end-indirect (exit 13) # before-end *** Error code 13 (continuing) -end end-indirect with status 0 + + +Stop. +make: stopped making "end-indirect" in unit-tests +end end-indirect with status 1 exit status 0 Index: src/usr.bin/make/unit-tests/cmd-errors-jobs.mk diff -u src/usr.bin/make/unit-tests/cmd-errors-jobs.mk:1.11 src/usr.bin/make/unit-tests/cmd-errors-jobs.mk:1.12 --- src/usr.bin/make/unit-tests/cmd-errors-jobs.mk:1.11 Mon Jul 22 18:02:51 2024 +++ src/usr.bin/make/unit-tests/cmd-errors-jobs.mk Mon Jul 22 18:11:15 2024 @@ -1,4 +1,4 @@ -# $NetBSD: cmd-errors-jobs.mk,v 1.11 2024/07/22 18:02:51 rillig Exp $ +# $NetBSD: cmd-errors-jobs.mk,v 1.12 2024/07/22 18:11:15 rillig Exp $ # # Demonstrate how errors in expressions affect whether the commands # are actually executed in jobs mode. @@ -76,11 +76,9 @@ before-begin: (exit 13) # $@ .endif # expect: begin begin-indirect -# TODO: Show the "stopped making" message. -# expect-not: stopped making "begin-indirect" # expect: *** Error code 13 (continuing) -# TODO: Exit with a non-zero status due to the failed target. -# expect: end begin-indirect with status 0 +# expect: make: stopped making "begin-indirect" in unit-tests +# expect: end begin-indirect with status 1 .if make(end-direct) @@ -102,8 +100,6 @@ before-end: (exit 13) # $@ .endif # expect: begin end-indirect -# TODO: Show the "stopped making" message. -# expect-not: stopped making "end-indirect" # expect: *** Error code 13 (continuing) -# TODO: Exit with a non-zero status due to the failed target. -# expect: end end-indirect with status 0 +# expect: make: stopped making "end-indirect" in unit-tests +# expect: end end-indirect with status 1
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Mon Jul 22 18:11:15 UTC 2024 Modified Files: src/usr.bin/make: job.c src/usr.bin/make/unit-tests: cmd-errors-jobs.exp cmd-errors-jobs.mk Log Message: make: fix exit status for error in .BEGIN/.END prerequisite To generate a diff of this commit: cvs rdiff -u -r1.481 -r1.482 src/usr.bin/make/job.c cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/cmd-errors-jobs.exp cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/cmd-errors-jobs.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Mon Jul 22 18:02:51 UTC 2024 Modified Files: src/usr.bin/make/unit-tests: cmd-errors-jobs.exp cmd-errors-jobs.mk Log Message: tests/make: demonstrate wrong exit status for .END dependency To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/cmd-errors-jobs.exp cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/cmd-errors-jobs.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/unit-tests/cmd-errors-jobs.exp diff -u src/usr.bin/make/unit-tests/cmd-errors-jobs.exp:1.11 src/usr.bin/make/unit-tests/cmd-errors-jobs.exp:1.12 --- src/usr.bin/make/unit-tests/cmd-errors-jobs.exp:1.11 Sat Jul 20 14:09:27 2024 +++ src/usr.bin/make/unit-tests/cmd-errors-jobs.exp Mon Jul 22 18:02:51 2024 @@ -1,9 +1,49 @@ -: undefined--eol -make: in target "unclosed-expression": Unclosed variable "UNCLOSED" -make: in target "unclosed-modifier": while evaluating variable "UNCLOSED" with value "": Unclosed expression, expecting '}' -make: in target "unknown-modifier": while evaluating variable "UNKNOWN" with value "": Unknown modifier "Z" -make: in target "depend-source": while evaluating variable "UNCLOSED" with value "": Unclosed expression, expecting '}' -: end-eol -: Making depend-target -: .END-eol -exit status 2 +begin undefined-direct +: undefined-direct--eol +end undefined-direct with status 0 + +begin undefined-indirect +: undefined-direct--eol +end undefined-indirect with status 0 + +begin parse-error-direct +make: in target "parse-error-unclosed-expression": Unclosed variable "UNCLOSED" +make: in target "parse-error-unclosed-modifier": while evaluating variable "UNCLOSED" with value "": Unclosed expression, expecting '}' +make: in target "parse-error-unknown-modifier": while evaluating variable "UNKNOWN" with value "": Unknown modifier "Z" +end parse-error-direct with status 2 + +begin parse-error-indirect +make: in target "parse-error-unclosed-expression": Unclosed variable "UNCLOSED" +make: in target "parse-error-unclosed-modifier": while evaluating variable "UNCLOSED" with value "": Unclosed expression, expecting '}' +make: in target "parse-error-unknown-modifier": while evaluating variable "UNKNOWN" with value "": Unknown modifier "Z" +end parse-error-indirect with status 2 + +begin begin-direct +(exit 13) # .BEGIN +*** Error code 13 (continuing) + + +Stop. +make: stopped making "begin-direct" in unit-tests +end begin-direct with status 1 + +begin begin-indirect +(exit 13) # before-begin +*** Error code 13 (continuing) +end begin-indirect with status 0 + +begin end-direct +(exit 13) # .END +*** Error code 13 (continuing) + + +Stop. +make: stopped making "end-direct" in unit-tests +end end-direct with status 1 + +begin end-indirect +(exit 13) # before-end +*** Error code 13 (continuing) +end end-indirect with status 0 + +exit status 0 Index: src/usr.bin/make/unit-tests/cmd-errors-jobs.mk diff -u src/usr.bin/make/unit-tests/cmd-errors-jobs.mk:1.10 src/usr.bin/make/unit-tests/cmd-errors-jobs.mk:1.11 --- src/usr.bin/make/unit-tests/cmd-errors-jobs.mk:1.10 Sat Jul 20 14:09:27 2024 +++ src/usr.bin/make/unit-tests/cmd-errors-jobs.mk Mon Jul 22 18:02:51 2024 @@ -1,51 +1,109 @@ -# $NetBSD: cmd-errors-jobs.mk,v 1.10 2024/07/20 14:09:27 rillig Exp $ +# $NetBSD: cmd-errors-jobs.mk,v 1.11 2024/07/22 18:02:51 rillig Exp $ # # Demonstrate how errors in expressions affect whether the commands # are actually executed in jobs mode. -.MAKEFLAGS: -j1 +RUN= @ run() { \ + echo "begin $$*" \ + && ${MAKE} -f ${MAKEFILE} -j1 "$$*" \ + && echo "end $$* with status $$?" \ + || echo "end $$* with status $$?" \ + && echo;\ + } && run + +all: + ${RUN} undefined-direct + ${RUN} undefined-indirect + ${RUN} parse-error-direct + ${RUN} parse-error-indirect + ${RUN} begin-direct + ${RUN} begin-indirect + ${RUN} end-direct + ${RUN} end-indirect -all: undefined unclosed-expression unclosed-modifier unknown-modifier -all: depend-target -all: end # Undefined variables in expressions are not an error. They expand to empty # strings. -# expect: : undefined--eol -undefined: +# expect: : undefined-direct--eol +# expect: end undefined-direct with status 0 +# expect: : undefined-direct--eol +# expect: end undefined-indirect with status 0 +undefined-indirect: undefined-direct +undefined-direct: : $@-${UNDEFINED}-eol -unclosed-expression: -# expect: make: in target "unclosed-expression": Unclosed variable "UNCLOSED" -# expect-not: : unclosed-expression- - : $@-${UNCLOSED - -unclosed-modifier: -# expect: make: in target "unclosed-modifier": while evaluating variable "UNCLOSED" with value "": Unclosed expression, expecting '}' -# expect-not: : unclosed-modifier- - : $@-${UNCLOSED: - -unknown-modifier: -# expect: make: in target "unknown-modifier": while evaluating variable "UNKNOWN" with value "": Unknown modifier "Z" -#
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Mon Jul 22 18:02:51 UTC 2024 Modified Files: src/usr.bin/make/unit-tests: cmd-errors-jobs.exp cmd-errors-jobs.mk Log Message: tests/make: demonstrate wrong exit status for .END dependency To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/cmd-errors-jobs.exp cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/cmd-errors-jobs.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Jul 20 14:09:27 UTC 2024 Modified Files: src/usr.bin/make: job.c src/usr.bin/make/unit-tests: cmd-errors-jobs.exp cmd-errors-jobs.mk Log Message: make: don't run erroneous commands in parallel mode To generate a diff of this commit: cvs rdiff -u -r1.480 -r1.481 src/usr.bin/make/job.c cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/cmd-errors-jobs.exp cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/cmd-errors-jobs.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/job.c diff -u src/usr.bin/make/job.c:1.480 src/usr.bin/make/job.c:1.481 --- src/usr.bin/make/job.c:1.480 Sun Jul 7 07:50:57 2024 +++ src/usr.bin/make/job.c Sat Jul 20 14:09:27 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.480 2024/07/07 07:50:57 rillig Exp $ */ +/* $NetBSD: job.c,v 1.481 2024/07/20 14:09:27 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -141,7 +141,7 @@ #include "trace.h" /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: job.c,v 1.480 2024/07/07 07:50:57 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.481 2024/07/20 14:09:27 rillig Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -1680,6 +1680,8 @@ JobStart(GNode *gn, bool special) * virtual targets. */ + int parseErrorsBefore; + /* * We're serious here, but if the commands were bogus, we're * also dead... @@ -1689,7 +1691,10 @@ JobStart(GNode *gn, bool special) DieHorribly(); } + parseErrorsBefore = parseErrors; JobWriteShellCommands(job, gn, ); + if (parseErrors != parseErrorsBefore) + run = false; (void)fflush(job->cmdFILE); } else if (!GNode_ShouldExecute(gn)) { /* Index: src/usr.bin/make/unit-tests/cmd-errors-jobs.exp diff -u src/usr.bin/make/unit-tests/cmd-errors-jobs.exp:1.10 src/usr.bin/make/unit-tests/cmd-errors-jobs.exp:1.11 --- src/usr.bin/make/unit-tests/cmd-errors-jobs.exp:1.10 Sat Jul 20 13:59:31 2024 +++ src/usr.bin/make/unit-tests/cmd-errors-jobs.exp Sat Jul 20 14:09:27 2024 @@ -1,12 +1,8 @@ : undefined--eol make: in target "unclosed-expression": Unclosed variable "UNCLOSED" -: unclosed-expression- make: in target "unclosed-modifier": while evaluating variable "UNCLOSED" with value "": Unclosed expression, expecting '}' -: unclosed-modifier- make: in target "unknown-modifier": while evaluating variable "UNKNOWN" with value "": Unknown modifier "Z" -: unknown-modifier--eol make: in target "depend-source": while evaluating variable "UNCLOSED" with value "": Unclosed expression, expecting '}' -: depend-source- : end-eol : Making depend-target : .END-eol Index: src/usr.bin/make/unit-tests/cmd-errors-jobs.mk diff -u src/usr.bin/make/unit-tests/cmd-errors-jobs.mk:1.9 src/usr.bin/make/unit-tests/cmd-errors-jobs.mk:1.10 --- src/usr.bin/make/unit-tests/cmd-errors-jobs.mk:1.9 Sat Jul 20 13:59:31 2024 +++ src/usr.bin/make/unit-tests/cmd-errors-jobs.mk Sat Jul 20 14:09:27 2024 @@ -1,4 +1,4 @@ -# $NetBSD: cmd-errors-jobs.mk,v 1.9 2024/07/20 13:59:31 rillig Exp $ +# $NetBSD: cmd-errors-jobs.mk,v 1.10 2024/07/20 14:09:27 rillig Exp $ # # Demonstrate how errors in expressions affect whether the commands # are actually executed in jobs mode. @@ -17,20 +17,17 @@ undefined: unclosed-expression: # expect: make: in target "unclosed-expression": Unclosed variable "UNCLOSED" -# XXX: This command is executed even though it contains parse errors. -# expect: : unclosed-expression- +# expect-not: : unclosed-expression- : $@-${UNCLOSED unclosed-modifier: # expect: make: in target "unclosed-modifier": while evaluating variable "UNCLOSED" with value "": Unclosed expression, expecting '}' -# XXX: This command is executed even though it contains parse errors. -# expect: : unclosed-modifier- +# expect-not: : unclosed-modifier- : $@-${UNCLOSED: unknown-modifier: # expect: make: in target "unknown-modifier": while evaluating variable "UNKNOWN" with value "": Unknown modifier "Z" -# XXX: This command is executed even though it contains parse errors. -# expect: : unknown-modifier--eol +# expect-not: : unknown-modifier--eol : $@-${UNKNOWN:Z}-eol depend-target: depend-source
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Jul 20 14:09:27 UTC 2024 Modified Files: src/usr.bin/make: job.c src/usr.bin/make/unit-tests: cmd-errors-jobs.exp cmd-errors-jobs.mk Log Message: make: don't run erroneous commands in parallel mode To generate a diff of this commit: cvs rdiff -u -r1.480 -r1.481 src/usr.bin/make/job.c cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/cmd-errors-jobs.exp cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/cmd-errors-jobs.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sat Jul 20 13:59:31 UTC 2024 Modified Files: src/usr.bin/make/unit-tests: cmd-errors-jobs.exp cmd-errors-jobs.mk Log Message: tests/make: demonstrate failing dependency in parallel mode In parallel mode, when generating the commands for a target, parse or evaluation errors still continue generating and executing the commands. And if the commands succeed, the targets that depend on this target are still made. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/cmd-errors-jobs.exp cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/cmd-errors-jobs.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/unit-tests/cmd-errors-jobs.exp diff -u src/usr.bin/make/unit-tests/cmd-errors-jobs.exp:1.9 src/usr.bin/make/unit-tests/cmd-errors-jobs.exp:1.10 --- src/usr.bin/make/unit-tests/cmd-errors-jobs.exp:1.9 Tue Jul 9 19:43:01 2024 +++ src/usr.bin/make/unit-tests/cmd-errors-jobs.exp Sat Jul 20 13:59:31 2024 @@ -5,5 +5,9 @@ make: in target "unclosed-modifier": whi : unclosed-modifier- make: in target "unknown-modifier": while evaluating variable "UNKNOWN" with value "": Unknown modifier "Z" : unknown-modifier--eol +make: in target "depend-source": while evaluating variable "UNCLOSED" with value "": Unclosed expression, expecting '}' +: depend-source- : end-eol +: Making depend-target +: .END-eol exit status 2 Index: src/usr.bin/make/unit-tests/cmd-errors-jobs.mk diff -u src/usr.bin/make/unit-tests/cmd-errors-jobs.mk:1.8 src/usr.bin/make/unit-tests/cmd-errors-jobs.mk:1.9 --- src/usr.bin/make/unit-tests/cmd-errors-jobs.mk:1.8 Tue Jul 9 19:43:01 2024 +++ src/usr.bin/make/unit-tests/cmd-errors-jobs.mk Sat Jul 20 13:59:31 2024 @@ -1,11 +1,13 @@ -# $NetBSD: cmd-errors-jobs.mk,v 1.8 2024/07/09 19:43:01 rillig Exp $ +# $NetBSD: cmd-errors-jobs.mk,v 1.9 2024/07/20 13:59:31 rillig Exp $ # # Demonstrate how errors in expressions affect whether the commands # are actually executed in jobs mode. .MAKEFLAGS: -j1 -all: undefined unclosed-expression unclosed-modifier unknown-modifier end +all: undefined unclosed-expression unclosed-modifier unknown-modifier +all: depend-target +all: end # Undefined variables in expressions are not an error. They expand to empty # strings. @@ -31,8 +33,22 @@ unknown-modifier: # expect: : unknown-modifier--eol : $@-${UNKNOWN:Z}-eol +depend-target: depend-source +# TODO: don't make the target, as its source failed to generate the commands. +# expect: : Making depend-target +# expect-reset + : Making $@ + +depend-source: +# expect: make: in target "depend-source": while evaluating variable "UNCLOSED" with value "": Unclosed expression, expecting '}' + : $@-${UNCLOSED: + # expect: : end-eol end: : $@-eol +# expect: : .END-eol +.END: + : $@-eol + # expect: exit status 2
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sat Jul 20 13:59:31 UTC 2024 Modified Files: src/usr.bin/make/unit-tests: cmd-errors-jobs.exp cmd-errors-jobs.mk Log Message: tests/make: demonstrate failing dependency in parallel mode In parallel mode, when generating the commands for a target, parse or evaluation errors still continue generating and executing the commands. And if the commands succeed, the targets that depend on this target are still made. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/cmd-errors-jobs.exp cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/cmd-errors-jobs.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Jul 20 11:05:12 UTC 2024 Modified Files: src/usr.bin/make: compat.c src/usr.bin/make/unit-tests: check-expect.lua cmd-errors-lint.exp cmd-errors-lint.mk cmd-errors.exp cmd-errors.mk lint.exp moderrs.exp moderrs.mk varmisc.exp varmisc.mk varmod-assign.exp varmod-assign.mk varmod-hash.exp varmod-hash.mk varmod-select-words.exp varmod-select-words.mk varmod-subst-regex.exp varmod-subst-regex.mk varmod-subst.exp varmod-subst.mk Log Message: make: don't run erroneous commands in compat mode When there is a parse or evaluation error in an expression that becomes part of the command, don't run that command, as the result of the failed evaluation typically contains garbage characters. Skip the remaining commands from that target as well, as they may depend on the erroneous command. To generate a diff of this commit: cvs rdiff -u -r1.260 -r1.261 src/usr.bin/make/compat.c cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/check-expect.lua \ src/usr.bin/make/unit-tests/cmd-errors-lint.exp cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/cmd-errors-lint.mk \ src/usr.bin/make/unit-tests/varmod-select-words.exp \ src/usr.bin/make/unit-tests/varmod-select-words.mk cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/cmd-errors.exp cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/cmd-errors.mk cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/lint.exp \ src/usr.bin/make/unit-tests/varmod-hash.mk cvs rdiff -u -r1.43 -r1.44 src/usr.bin/make/unit-tests/moderrs.exp cvs rdiff -u -r1.39 -r1.40 src/usr.bin/make/unit-tests/moderrs.mk cvs rdiff -u -r1.23 -r1.24 src/usr.bin/make/unit-tests/varmisc.exp \ src/usr.bin/make/unit-tests/varmod-assign.mk cvs rdiff -u -r1.35 -r1.36 src/usr.bin/make/unit-tests/varmisc.mk cvs rdiff -u -r1.27 -r1.28 src/usr.bin/make/unit-tests/varmod-assign.exp cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/varmod-hash.exp cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/varmod-subst-regex.exp cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/varmod-subst-regex.mk cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/varmod-subst.exp cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/unit-tests/varmod-subst.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/compat.c diff -u src/usr.bin/make/compat.c:1.260 src/usr.bin/make/compat.c:1.261 --- src/usr.bin/make/compat.c:1.260 Thu Jul 11 20:09:16 2024 +++ src/usr.bin/make/compat.c Sat Jul 20 11:05:11 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: compat.c,v 1.260 2024/07/11 20:09:16 sjg Exp $ */ +/* $NetBSD: compat.c,v 1.261 2024/07/20 11:05:11 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -91,7 +91,7 @@ #include "pathnames.h" /* "@(#)compat.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: compat.c,v 1.260 2024/07/11 20:09:16 sjg Exp $"); +MAKE_RCSID("$NetBSD: compat.c,v 1.261 2024/07/20 11:05:11 rillig Exp $"); static GNode *curTarg = NULL; static pid_t compatChild; @@ -248,13 +248,18 @@ Compat_RunCommand(const char *cmdp, GNod const char *cmd = cmdp; char cmd_file[MAXPATHLEN]; size_t cmd_len; + int parseErrorsBefore; silent = (gn->type & OP_SILENT) != OP_NONE; errCheck = !(gn->type & OP_IGNORE); doIt = false; + parseErrorsBefore = parseErrors; cmdStart = Var_SubstInTarget(cmd, gn); - /* TODO: handle errors */ + if (parseErrors != parseErrorsBefore) { + free(cmdStart); + return false; + } if (cmdStart[0] == '\0') { free(cmdStart); Index: src/usr.bin/make/unit-tests/check-expect.lua diff -u src/usr.bin/make/unit-tests/check-expect.lua:1.8 src/usr.bin/make/unit-tests/check-expect.lua:1.9 --- src/usr.bin/make/unit-tests/check-expect.lua:1.8 Sun Dec 17 09:44:00 2023 +++ src/usr.bin/make/unit-tests/check-expect.lua Sat Jul 20 11:05:11 2024 @@ -1,5 +1,5 @@ #! /usr/bin/lua --- $NetBSD: check-expect.lua,v 1.8 2023/12/17 09:44:00 rillig Exp $ +-- $NetBSD: check-expect.lua,v 1.9 2024/07/20 11:05:11 rillig Exp $ --[[ @@ -19,6 +19,10 @@ expected text in the corresponding .exp # expect[+-]offset: Each message must occur in the .exp file and refer back to the source line in the .mk file. + +# expect-not: +The substring must not occur as part of any line of the .exp file. + ]] @@ -104,6 +108,18 @@ local function check_mk(mk_fname) local prev_expect_line = 0 for mk_lineno, mk_line in ipairs(mk_lines) do + +for text in mk_line:gmatch("#%s*expect%-not:%s*(.*)") do + local i = 1 + while i <= #exp_lines and not exp_lines[i]:find(text, 1, true) do +i = i + 1 + end + if i <= #exp_lines then +print_error("error: %s:%d: %s must not contain '%s'", + mk_fname, mk_lineno, exp_fname, text) + end +end
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Jul 20 11:05:12 UTC 2024 Modified Files: src/usr.bin/make: compat.c src/usr.bin/make/unit-tests: check-expect.lua cmd-errors-lint.exp cmd-errors-lint.mk cmd-errors.exp cmd-errors.mk lint.exp moderrs.exp moderrs.mk varmisc.exp varmisc.mk varmod-assign.exp varmod-assign.mk varmod-hash.exp varmod-hash.mk varmod-select-words.exp varmod-select-words.mk varmod-subst-regex.exp varmod-subst-regex.mk varmod-subst.exp varmod-subst.mk Log Message: make: don't run erroneous commands in compat mode When there is a parse or evaluation error in an expression that becomes part of the command, don't run that command, as the result of the failed evaluation typically contains garbage characters. Skip the remaining commands from that target as well, as they may depend on the erroneous command. To generate a diff of this commit: cvs rdiff -u -r1.260 -r1.261 src/usr.bin/make/compat.c cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/check-expect.lua \ src/usr.bin/make/unit-tests/cmd-errors-lint.exp cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/cmd-errors-lint.mk \ src/usr.bin/make/unit-tests/varmod-select-words.exp \ src/usr.bin/make/unit-tests/varmod-select-words.mk cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/cmd-errors.exp cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/cmd-errors.mk cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/lint.exp \ src/usr.bin/make/unit-tests/varmod-hash.mk cvs rdiff -u -r1.43 -r1.44 src/usr.bin/make/unit-tests/moderrs.exp cvs rdiff -u -r1.39 -r1.40 src/usr.bin/make/unit-tests/moderrs.mk cvs rdiff -u -r1.23 -r1.24 src/usr.bin/make/unit-tests/varmisc.exp \ src/usr.bin/make/unit-tests/varmod-assign.mk cvs rdiff -u -r1.35 -r1.36 src/usr.bin/make/unit-tests/varmisc.mk cvs rdiff -u -r1.27 -r1.28 src/usr.bin/make/unit-tests/varmod-assign.exp cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/varmod-hash.exp cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/varmod-subst-regex.exp cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/varmod-subst-regex.mk cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/varmod-subst.exp cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/unit-tests/varmod-subst.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sat Jul 20 09:22:19 UTC 2024 Modified Files: src/usr.bin/make/unit-tests: moderrs.exp moderrs.mk Log Message: tests/make: remove redundant context information The affected target is already mentioned in the line containing the error message. To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/usr.bin/make/unit-tests/moderrs.exp cvs rdiff -u -r1.38 -r1.39 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/unit-tests/moderrs.exp diff -u src/usr.bin/make/unit-tests/moderrs.exp:1.42 src/usr.bin/make/unit-tests/moderrs.exp:1.43 --- src/usr.bin/make/unit-tests/moderrs.exp:1.42 Tue Jul 9 19:43:01 2024 +++ src/usr.bin/make/unit-tests/moderrs.exp Sat Jul 20 09:22:19 2024 @@ -1,31 +1,21 @@ make: in target "mod-unknown-direct": while evaluating variable "VAR" with value "TheVariable": Unknown modifier "Z" VAR:Z=before--after - make: in target "mod-unknown-indirect": while evaluating variable "VAR" with value "TheVariable": Unknown modifier "Z" VAR:Z=before-inner}-after - -unclosed-direct: make: in target "unclosed-direct": while evaluating variable "VAR" with value "Thevariable": Unclosed expression, expecting '}' for modifier "S,V,v," VAR:S,V,v,=Thevariable - -unclosed-indirect: make: in target "unclosed-indirect": while evaluating variable "VAR" with value "Thevariable": Unclosed expression after indirect modifier, expecting '}' VAR:S,V,v,=Thevariable - make: in target "unfinished-indirect": while evaluating variable "VAR" with value "TheVariable": Unfinished modifier (',' missing) VAR:S,V,v= - make: in target "unfinished-loop": while evaluating variable "UNDEF" with value "1 2 3": Unfinished modifier ('@' missing) make: in target "unfinished-loop": while evaluating variable "UNDEF" with value "1 2 3": Unfinished modifier ('@' missing) 1 2 3 - -loop-close: make: in target "loop-close": while evaluating variable "UNDEF" with value "1}... 2}... 3}...": Unclosed expression, expecting '}' for modifier "@var@${var}}...@" 1}... 2}... 3}... 1}... 2}... 3}... - make: in target "words": while evaluating variable "UNDEF" with value "1 2 3": Unfinished modifier (']' missing) make: in target "words": while evaluating variable "UNDEF" with value "1 2 3": Unfinished modifier (']' missing) @@ -33,12 +23,10 @@ make: in target "words": while evaluatin 13= make: in target "words": while evaluating variable "UNDEF" with value "1 2 3": Bad modifier ":[123451234512345123451234512345]" 12345=S,^ok,:S,^3ok,} - make: in target "exclam": while evaluating variable "VARNAME" with value "": Unfinished modifier ('!' missing) make: in target "exclam": while evaluating variable "!" with value "!": Unfinished modifier ('!' missing) - make: in target "mod-subst-delimiter": while evaluating variable "VAR" with value "TheVariable": Missing delimiter for modifier ':S' 1: make: in target "mod-subst-delimiter": while evaluating variable "VAR" with value "TheVariable": Unfinished modifier (',' missing) @@ -52,7 +40,6 @@ make: in target "mod-subst-delimiter": w make: in target "mod-subst-delimiter": while evaluating variable "VAR" with value "TheVariable": Unclosed expression, expecting '}' for modifier "S,from,to," 6: TheVariable 7: TheVariable - make: in target "mod-regex-delimiter": while evaluating variable "VAR" with value "TheVariable": Missing delimiter for modifier ':C' 1: make: in target "mod-regex-delimiter": while evaluating variable "VAR" with value "TheVariable": Unfinished modifier (',' missing) @@ -66,8 +53,6 @@ make: in target "mod-regex-delimiter": w make: in target "mod-regex-delimiter": while evaluating variable "VAR" with value "TheVariable": Unclosed expression, expecting '}' for modifier "C,from,to," 6: TheVariable 7: TheVariable - -mod-ts-parse: 112358132134 15152535558513521534 make: in target "mod-ts-parse": while evaluating variable "FIB" with value "1 1 2 3 5 8 13 21 34": Bad modifier ":ts\65oct" @@ -76,8 +61,6 @@ make: in target "mod-ts-parse": while ev 65oct} make: in target "mod-ts-parse": while evaluating variable "FIB" with value "1 1 2 3 5 8 13 21 34": Bad modifier ":tsxy" xy} - -mod-t-parse: make: in target "mod-t-parse": while evaluating variable "FIB" with value "1 1 2 3 5 8 13 21 34": Bad modifier ":t" make: in target "mod-t-parse": while evaluating variable "FIB" with value "1 1 2 3 5 8 13 21 34": Bad modifier ":txy" @@ -86,7 +69,6 @@ make: in target "mod-t-parse": while eva make: in target "mod-t-parse": while evaluating variable "FIB" with value "1 1 2 3 5 8 13 21 34": Bad modifier ":t" M*} - make: in target "mod-ifelse-parse": while evaluating then-branch of condition "FIB": Unfinished modifier (':' missing) make: in target "mod-ifelse-parse": while evaluating then-branch of condition "FIB": Unfinished modifier (':' missing)
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sat Jul 20 09:22:19 UTC 2024 Modified Files: src/usr.bin/make/unit-tests: moderrs.exp moderrs.mk Log Message: tests/make: remove redundant context information The affected target is already mentioned in the line containing the error message. To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/usr.bin/make/unit-tests/moderrs.exp cvs rdiff -u -r1.38 -r1.39 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.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Jul 20 08:54:19 UTC 2024 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: varmod-order.exp varmod-order.mk varparse-errors.exp varparse-errors.mk Log Message: make: remove wrong error message about an undefined variable To generate a diff of this commit: cvs rdiff -u -r1.1135 -r1.1136 src/usr.bin/make/var.c cvs rdiff -u -r1.13 -r1.14 src/usr.bin/make/unit-tests/varmod-order.exp cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/unit-tests/varmod-order.mk \ src/usr.bin/make/unit-tests/varparse-errors.exp cvs rdiff -u -r1.17 -r1.18 src/usr.bin/make/unit-tests/varparse-errors.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Jul 20 08:54:19 UTC 2024 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: varmod-order.exp varmod-order.mk varparse-errors.exp varparse-errors.mk Log Message: make: remove wrong error message about an undefined variable To generate a diff of this commit: cvs rdiff -u -r1.1135 -r1.1136 src/usr.bin/make/var.c cvs rdiff -u -r1.13 -r1.14 src/usr.bin/make/unit-tests/varmod-order.exp cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/unit-tests/varmod-order.mk \ src/usr.bin/make/unit-tests/varparse-errors.exp cvs rdiff -u -r1.17 -r1.18 src/usr.bin/make/unit-tests/varparse-errors.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.1135 src/usr.bin/make/var.c:1.1136 --- src/usr.bin/make/var.c:1.1135 Tue Jul 9 17:07:23 2024 +++ src/usr.bin/make/var.c Sat Jul 20 08:54:19 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.1135 2024/07/09 17:07:23 rillig Exp $ */ +/* $NetBSD: var.c,v 1.1136 2024/07/20 08:54:19 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -128,7 +128,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.1135 2024/07/09 17:07:23 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.1136 2024/07/20 08:54:19 rillig Exp $"); /* * Variables are defined using one of the VAR=value assignments. Their @@ -4677,8 +4677,7 @@ VarSubstDollarDollar(const char **pp, Bu } static void -VarSubstExpr(const char **pp, Buffer *buf, GNode *scope, - VarEvalMode emode, bool *inout_errorReported) +VarSubstExpr(const char **pp, Buffer *buf, GNode *scope, VarEvalMode emode) { const char *p = *pp; const char *nested_p = p; @@ -4686,28 +4685,8 @@ VarSubstExpr(const char **pp, Buffer *bu /* TODO: handle errors */ if (val.str == var_Error || val.str == varUndefined) { - if (!VarEvalMode_ShouldKeepUndef(emode)) { - p = nested_p; - } else if (val.str == var_Error) { - - /* - * FIXME: The condition 'val.str == var_Error' doesn't - * mean there was an undefined variable. It could - * equally well be a parse error; see - * unit-tests/varmod-order.mk. - */ - - /* - * If variable is undefined, complain and skip the - * variable. The complaint will stop us from doing - * anything when the file is parsed. - */ - if (!*inout_errorReported) { -Parse_Error(PARSE_FATAL, -"Undefined variable \"%.*s\"", -(int)(nested_p - p), p); -*inout_errorReported = true; - } + if (!VarEvalMode_ShouldKeepUndef(emode) + || val.str == var_Error) { p = nested_p; } else { /* @@ -4761,20 +4740,13 @@ Var_Subst(const char *str, GNode *scope, const char *p = str; Buffer res; - /* - * Set true if an error has already been reported, to prevent a - * plethora of messages when recursing - */ - static bool errorReported; - Buf_Init(); - errorReported = false; while (*p != '\0') { if (p[0] == '$' && p[1] == '$') VarSubstDollarDollar(, , emode); else if (p[0] == '$') - VarSubstExpr(, , scope, emode, ); + VarSubstExpr(, , scope, emode); else VarSubstPlain(, ); } Index: src/usr.bin/make/unit-tests/varmod-order.exp diff -u src/usr.bin/make/unit-tests/varmod-order.exp:1.13 src/usr.bin/make/unit-tests/varmod-order.exp:1.14 --- src/usr.bin/make/unit-tests/varmod-order.exp:1.13 Fri Jul 5 18:59:33 2024 +++ src/usr.bin/make/unit-tests/varmod-order.exp Sat Jul 20 08:54:19 2024 @@ -1,26 +1,24 @@ -make: "varmod-order.mk" line 17: while evaluating variable "WORDS" with value "one two three four five six seven eight nine ten": Bad modifier ":OX" -make: "varmod-order.mk" line 17: Undefined variable "${WORDS:OX" -make: "varmod-order.mk" line 23: while evaluating variable "WORDS" with value "one two three four five six seven eight nine ten": Bad modifier ":OxXX" -make: "varmod-order.mk" line 23: Undefined variable "${WORDS:Ox" -make: "varmod-order.mk" line 27: while evaluating variable "WORDS" with value "eight five four nine one seven six ten three two": Unclosed expression, expecting '}' for modifier "O" -make: "varmod-order.mk" line 29: while evaluating variable "NUMBERS" with value "1 2 3 4 5 6 7 8 9 10": Unclosed expression, expecting '}' for modifier "On" -make: "varmod-order.mk" line 31: while evaluating variable "NUMBERS" with value "10 9 8 7 6 5 4 3 2 1": Unclosed expression, expecting '}' for modifier "Onr" -make: "varmod-order.mk" line 38: while evaluating variable "NUMBERS" with value "8 5 4 9 1 7 6 10 3 2": Bad modifier ":Oxn" -make: "varmod-order.mk" line 38: Malformed conditional (${NUMBERS:Oxn}) -make: "varmod-order.mk" line 48: while evaluating variable "NUMBERS" with value "8 5 4 9 1 7 6 10 3 2": Bad modifier ":On_typo" -make: "varmod-order.mk" line 48: Malformed conditional (${NUMBERS:On_typo}) -make: "varmod-order.mk"
CVS commit: src/usr.bin/ftp
Module Name:src Committed By: lukem Date: Fri Jul 19 03:53:13 UTC 2024 Modified Files: src/usr.bin/ftp: cmds.c progressbar.c ruserpass.c Log Message: ftp: improve units used in comments and errors Use "KiB" instead of "K" in errors. Clarify related comments. To generate a diff of this commit: cvs rdiff -u -r1.141 -r1.142 src/usr.bin/ftp/cmds.c cvs rdiff -u -r1.24 -r1.25 src/usr.bin/ftp/progressbar.c cvs rdiff -u -r1.33 -r1.34 src/usr.bin/ftp/ruserpass.c 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/ftp/cmds.c diff -u src/usr.bin/ftp/cmds.c:1.141 src/usr.bin/ftp/cmds.c:1.142 --- src/usr.bin/ftp/cmds.c:1.141 Wed Jan 6 09:15:59 2021 +++ src/usr.bin/ftp/cmds.c Fri Jul 19 03:53:13 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: cmds.c,v 1.141 2021/01/06 09:15:59 lukem Exp $ */ +/* $NetBSD: cmds.c,v 1.142 2024/07/19 03:53:13 lukem Exp $ */ /*- * Copyright (c) 1996-2021 The NetBSD Foundation, Inc. @@ -96,7 +96,7 @@ #if 0 static char sccsid[] = "@(#)cmds.c 8.6 (Berkeley) 10/9/94"; #else -__RCSID("$NetBSD: cmds.c,v 1.141 2021/01/06 09:15:59 lukem Exp $"); +__RCSID("$NetBSD: cmds.c,v 1.142 2024/07/19 03:53:13 lukem Exp $"); #endif #endif /* not lint */ @@ -2487,7 +2487,7 @@ macdef(int argc, char *argv[]) while ((c = getchar()) != '\n' && c != EOF) /* LOOP */; if (c == EOF || getchar() == '\n') { - fputs("Macro not defined - 4K buffer exceeded.\n", + fputs("Macro not defined - 4 KiB buffer exceeded.\n", ttyout); code = -1; return; Index: src/usr.bin/ftp/progressbar.c diff -u src/usr.bin/ftp/progressbar.c:1.24 src/usr.bin/ftp/progressbar.c:1.25 --- src/usr.bin/ftp/progressbar.c:1.24 Wed Jan 6 04:43:14 2021 +++ src/usr.bin/ftp/progressbar.c Fri Jul 19 03:53:13 2024 @@ -1,7 +1,7 @@ -/* $NetBSD: progressbar.c,v 1.24 2021/01/06 04:43:14 lukem Exp $ */ +/* $NetBSD: progressbar.c,v 1.25 2024/07/19 03:53:13 lukem Exp $ */ /*- - * Copyright (c) 1997-2021 The NetBSD Foundation, Inc. + * Copyright (c) 1997-2024 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation @@ -31,7 +31,7 @@ #include #ifndef lint -__RCSID("$NetBSD: progressbar.c,v 1.24 2021/01/06 04:43:14 lukem Exp $"); +__RCSID("$NetBSD: progressbar.c,v 1.25 2024/07/19 03:53:13 lukem Exp $"); #endif /* not lint */ /* @@ -89,17 +89,17 @@ updateprogressmeter(int dummy) */ #if !defined(NO_PROGRESS) || !defined(STANDALONE_PROGRESS) static const char * const suffixes[] = { - "", /* 2^0 (byte) */ - "KiB", /* 2^10 Kibibyte */ - "MiB", /* 2^20 Mebibyte */ - "GiB", /* 2^30 Gibibyte */ - "TiB", /* 2^40 Tebibyte */ - "PiB", /* 2^50 Pebibyte */ - "EiB", /* 2^60 Exbibyte */ + "", /* 2^0, (byte) */ + "KiB", /* 2^10, Kibibyte */ + "MiB", /* 2^20, Mebibyte */ + "GiB", /* 2^30, Gibibyte */ + "TiB", /* 2^40, Tebibyte */ + "PiB", /* 2^50, Pebibyte */ + "EiB", /* 2^60, Exbibyte */ #if 0 /* The following are not necessary for signed 64-bit off_t */ - "ZiB", /* 2^70 Zebibyte */ - "YiB", /* 2^80 Yobibyte */ + "ZiB", /* 2^70, Zebibyte */ + "YiB", /* 2^80, Yobibyte */ #endif }; #define NSUFFIXES (int)(sizeof(suffixes) / sizeof(suffixes[0])) Index: src/usr.bin/ftp/ruserpass.c diff -u src/usr.bin/ftp/ruserpass.c:1.33 src/usr.bin/ftp/ruserpass.c:1.34 --- src/usr.bin/ftp/ruserpass.c:1.33 Tue Apr 17 05:52:04 2007 +++ src/usr.bin/ftp/ruserpass.c Fri Jul 19 03:53:13 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: ruserpass.c,v 1.33 2007/04/17 05:52:04 lukem Exp $ */ +/* $NetBSD: ruserpass.c,v 1.34 2024/07/19 03:53:13 lukem Exp $ */ /* * Copyright (c) 1985, 1993, 1994 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)ruserpass.c 8.4 (Berkeley) 4/27/95"; #else -__RCSID("$NetBSD: ruserpass.c,v 1.33 2007/04/17 05:52:04 lukem Exp $"); +__RCSID("$NetBSD: ruserpass.c,v 1.34 2024/07/19 03:53:13 lukem Exp $"); #endif #endif /* not lint */ @@ -247,7 +247,7 @@ ruserpass(const char *host, char **aname tmp++; } if (tmp == macbuf + 4096) { -fputs("4K macro buffer exceeded.\n", +fputs("4 KiB macro buffer exceeded.\n", ttyout); goto bad; }
CVS commit: src/usr.bin/ftp
Module Name:src Committed By: lukem Date: Fri Jul 19 03:53:13 UTC 2024 Modified Files: src/usr.bin/ftp: cmds.c progressbar.c ruserpass.c Log Message: ftp: improve units used in comments and errors Use "KiB" instead of "K" in errors. Clarify related comments. To generate a diff of this commit: cvs rdiff -u -r1.141 -r1.142 src/usr.bin/ftp/cmds.c cvs rdiff -u -r1.24 -r1.25 src/usr.bin/ftp/progressbar.c cvs rdiff -u -r1.33 -r1.34 src/usr.bin/ftp/ruserpass.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/ftp
Module Name:src Committed By: lukem Date: Fri Jul 19 03:51:21 UTC 2024 Modified Files: src/usr.bin/ftp: ftp.1 ssl.c Log Message: ftp: improve -b documentation Order -b bufsize in the synopsis. Document the actual default value. To generate a diff of this commit: cvs rdiff -u -r1.154 -r1.155 src/usr.bin/ftp/ftp.1 cvs rdiff -u -r1.18 -r1.19 src/usr.bin/ftp/ssl.c 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/ftp/ftp.1 diff -u src/usr.bin/ftp/ftp.1:1.154 src/usr.bin/ftp/ftp.1:1.155 --- src/usr.bin/ftp/ftp.1:1.154 Wed Apr 17 02:46:03 2024 +++ src/usr.bin/ftp/ftp.1 Fri Jul 19 03:51:21 2024 @@ -1,6 +1,6 @@ -.\" $NetBSD: ftp.1,v 1.154 2024/04/17 02:46:03 gutteridge Exp $ +.\" $NetBSD: ftp.1,v 1.155 2024/07/19 03:51:21 lukem Exp $ .\" -.\" Copyright (c) 1996-2023 The NetBSD Foundation, Inc. +.\" Copyright (c) 1996-2024 The NetBSD Foundation, Inc. .\" All rights reserved. .\" .\" This code is derived from software contributed to The NetBSD Foundation @@ -57,7 +57,7 @@ .\" .\" @(#)ftp.1 8.3 (Berkeley) 10/9/94 .\" -.Dd April 17, 2024 +.Dd July 19, 2024 .Dt FTP 1 .Os .Sh NAME @@ -66,10 +66,10 @@ .Sh SYNOPSIS .Nm .Op Fl 46AadefginpRtVv\&? +.Op Fl b Ar bufsize .Op Fl N Ar netrc .Op Fl o Ar output .Op Fl P Ar port -.Op Fl b Ar bufsize .Op Fl q Ar quittime .Op Fl r Ar retry .Op Fl s Ar srcaddr @@ -205,8 +205,11 @@ to bypass normal login procedure, and us .It Fl b Ar bufsize Change the input buffer size to .Ar bufsize . -The default is -.Dv 16K . +The default +.Ar bufsize +is +.Dv 16384 +(16 KiB). .It Fl d Enables debugging. .It Fl e Index: src/usr.bin/ftp/ssl.c diff -u src/usr.bin/ftp/ssl.c:1.18 src/usr.bin/ftp/ssl.c:1.19 --- src/usr.bin/ftp/ssl.c:1.18 Mon Feb 19 00:15:20 2024 +++ src/usr.bin/ftp/ssl.c Fri Jul 19 03:51:21 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: ssl.c,v 1.18 2024/02/19 00:15:20 christos Exp $ */ +/* $NetBSD: ssl.c,v 1.19 2024/07/19 03:51:21 lukem Exp $ */ /*- * Copyright (c) 1998-2004 Dag-Erling Coïdan Smørgrav @@ -35,7 +35,7 @@ #include #ifndef lint -__RCSID("$NetBSD: ssl.c,v 1.18 2024/02/19 00:15:20 christos Exp $"); +__RCSID("$NetBSD: ssl.c,v 1.19 2024/07/19 03:51:21 lukem Exp $"); #endif #include @@ -579,7 +579,7 @@ fetch_getline(struct fetch_connect *conn break; } if (errormsg) - *errormsg = "Input line is too long (specify -b > 16K)"; + *errormsg = "Input line is too long (specify -b > 16384)"; fetch_clearerr(conn); return -3; }
CVS commit: src/usr.bin/ftp
Module Name:src Committed By: lukem Date: Fri Jul 19 03:51:21 UTC 2024 Modified Files: src/usr.bin/ftp: ftp.1 ssl.c Log Message: ftp: improve -b documentation Order -b bufsize in the synopsis. Document the actual default value. To generate a diff of this commit: cvs rdiff -u -r1.154 -r1.155 src/usr.bin/ftp/ftp.1 cvs rdiff -u -r1.18 -r1.19 src/usr.bin/ftp/ssl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/printf
Module Name:src Committed By: wiz Date: Thu Jul 18 12:08:11 UTC 2024 Modified Files: src/usr.bin/printf: printf.c Log Message: Fix typo in comment. Reported by Emanuele Torre in PR 58439. To generate a diff of this commit: cvs rdiff -u -r1.54 -r1.55 src/usr.bin/printf/printf.c 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/printf/printf.c diff -u src/usr.bin/printf/printf.c:1.54 src/usr.bin/printf/printf.c:1.55 --- src/usr.bin/printf/printf.c:1.54 Thu May 20 02:01:07 2021 +++ src/usr.bin/printf/printf.c Thu Jul 18 12:08:11 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: printf.c,v 1.54 2021/05/20 02:01:07 christos Exp $ */ +/* $NetBSD: printf.c,v 1.55 2024/07/18 12:08:11 wiz Exp $ */ /* * Copyright (c) 1989, 1993 @@ -41,7 +41,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 19 #if 0 static char sccsid[] = "@(#)printf.c 8.2 (Berkeley) 3/22/95"; #else -__RCSID("$NetBSD: printf.c,v 1.54 2021/05/20 02:01:07 christos Exp $"); +__RCSID("$NetBSD: printf.c,v 1.55 2024/07/18 12:08:11 wiz Exp $"); #endif #endif /* not lint */ @@ -146,7 +146,7 @@ main(int argc, char *argv[]) /* * printf does not comply with Posix XBD 12.2 - there are no opts, - * not even the -- end of options marker. Do not run getoot(). + * not even the -- end of options marker. Do not run getopt(). */ if (argc > 2 && strchr(argv[1], '%') == NULL) { int o;
CVS commit: src/usr.bin/printf
Module Name:src Committed By: wiz Date: Thu Jul 18 12:08:11 UTC 2024 Modified Files: src/usr.bin/printf: printf.c Log Message: Fix typo in comment. Reported by Emanuele Torre in PR 58439. To generate a diff of this commit: cvs rdiff -u -r1.54 -r1.55 src/usr.bin/printf/printf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sat Jul 13 15:10:06 UTC 2024 Modified Files: src/usr.bin/make/unit-tests: cmd-interrupt.exp cmd-interrupt.mk Log Message: tests/make: demonstrate interrupting make in compat mode To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/cmd-interrupt.exp cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/cmd-interrupt.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/unit-tests/cmd-interrupt.exp diff -u src/usr.bin/make/unit-tests/cmd-interrupt.exp:1.3 src/usr.bin/make/unit-tests/cmd-interrupt.exp:1.4 --- src/usr.bin/make/unit-tests/cmd-interrupt.exp:1.3 Sat Mar 18 22:20:12 2023 +++ src/usr.bin/make/unit-tests/cmd-interrupt.exp Sat Jul 13 15:10:06 2024 @@ -5,4 +5,5 @@ interrupt-ordinary: ok interrupt-phony: ok > cmd-interrupt-precious interrupt-precious: ok +interrupt-compat expected-fail exit status 0 Index: src/usr.bin/make/unit-tests/cmd-interrupt.mk diff -u src/usr.bin/make/unit-tests/cmd-interrupt.mk:1.4 src/usr.bin/make/unit-tests/cmd-interrupt.mk:1.5 --- src/usr.bin/make/unit-tests/cmd-interrupt.mk:1.4 Sat Mar 18 22:20:12 2023 +++ src/usr.bin/make/unit-tests/cmd-interrupt.mk Sat Jul 13 15:10:06 2024 @@ -1,4 +1,4 @@ -# $NetBSD: cmd-interrupt.mk,v 1.4 2023/03/18 22:20:12 sjg Exp $ +# $NetBSD: cmd-interrupt.mk,v 1.5 2024/07/13 15:10:06 rillig Exp $ # # Tests for interrupting a command. # @@ -17,10 +17,16 @@ # See also: # CompatDeleteTarget -all: clean-before interrupt-ordinary interrupt-phony interrupt-precious clean-after +all: clean-before +all: interrupt-ordinary +all: interrupt-phony +all: interrupt-precious +all: interrupt-compat +all: clean-after clean-before clean-after: .PHONY - @rm -f cmd-interrupt-ordinary cmd-interrupt-phony cmd-interrupt-precious + @rm -f cmd-interrupt-ordinary cmd-interrupt-phony + @rm -f cmd-interrupt-precious cmd-interrupt-compat interrupt-ordinary: @${.MAKE} ${MAKEFLAGS} -f ${MAKEFILE} cmd-interrupt-ordinary || true @@ -37,6 +43,10 @@ interrupt-precious: .PRECIOUS # The ././ is necessary to work around the file cache. @echo ${.TARGET}: ${exists(././cmd-interrupt-precious) :? ok : error } +interrupt-compat: + @${MAKE} -f ${MAKEFILE} cmd-interrupt-compat || true + @echo ${.TARGET} ${exists(././cmd-interrupt-compat) :? expected-fail : unexpected-ok } + cmd-interrupt-ordinary: > ${.TARGET} @kill -INT ${.MAKE.PID} @@ -48,3 +58,11 @@ cmd-interrupt-phony: .PHONY cmd-interrupt-precious: .PRECIOUS > ${.TARGET} @kill -INT ${.MAKE.PID} + +# When the make process (and not the process group) is interrupted in compat +# mode, it first tries to interrupt the process group of the currently running +# child command, but that fails since there is no such process group, rather +# the child command runs in the same process group as make itself. The child +# command then continues, and after sleeping a bit creates the target file. +cmd-interrupt-compat: + @kill -INT ${.MAKE.PID} && sleep 1 && > ${.TARGET}
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sat Jul 13 15:10:06 UTC 2024 Modified Files: src/usr.bin/make/unit-tests: cmd-interrupt.exp cmd-interrupt.mk Log Message: tests/make: demonstrate interrupting make in compat mode To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/cmd-interrupt.exp cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/cmd-interrupt.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/patch
Module Name:src Committed By: manu Date: Fri Jul 12 15:48:39 UTC 2024 Modified Files: src/usr.bin/patch: patch.c pch.c pch.h Log Message: Let patch(1) handle lines of length beyond INT16_MAX Borrowed from OpenBSD https://marc.info/?l=openbsd-bugs=168907249732754 To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/usr.bin/patch/patch.c cvs rdiff -u -r1.33 -r1.34 src/usr.bin/patch/pch.c cvs rdiff -u -r1.10 -r1.11 src/usr.bin/patch/pch.h 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/patch/patch.c diff -u src/usr.bin/patch/patch.c:1.34 src/usr.bin/patch/patch.c:1.35 --- src/usr.bin/patch/patch.c:1.34 Fri Jun 16 11:27:00 2023 +++ src/usr.bin/patch/patch.c Fri Jul 12 15:48:39 2024 @@ -1,7 +1,7 @@ /* * $OpenBSD: patch.c,v 1.45 2007/04/18 21:52:24 sobrado Exp $ * $DragonFly: src/usr.bin/patch/patch.c,v 1.10 2008/08/10 23:39:56 joerg Exp $ - * $NetBSD: patch.c,v 1.34 2023/06/16 11:27:00 wiz Exp $ + * $NetBSD: patch.c,v 1.35 2024/07/12 15:48:39 manu Exp $ */ /* @@ -31,7 +31,7 @@ */ #include -__RCSID("$NetBSD: patch.c,v 1.34 2023/06/16 11:27:00 wiz Exp $"); +__RCSID("$NetBSD: patch.c,v 1.35 2024/07/12 15:48:39 manu Exp $"); #include #include @@ -106,7 +106,7 @@ static void copy_till(LINENUM, bool); static bool spew_output(void); static void dump_line(LINENUM, bool); static bool patch_match(LINENUM, LINENUM, LINENUM); -static bool similar(const char *, const char *, int); +static bool similar(const char *, const char *, ssize_t); __dead static void usage(void); /* true if -E was specified on command line. */ @@ -1027,7 +1027,7 @@ patch_match(LINENUM base, LINENUM offset LINENUM pat_lines = pch_ptrn_lines() - fuzz; const char *ilineptr; const char *plineptr; - short plinelen; + ssize_t plinelen; for (iline = base + offset + fuzz; pline <= pat_lines; pline++, iline++) { ilineptr = ifetch(iline, offset >= 0); @@ -1063,7 +1063,7 @@ patch_match(LINENUM base, LINENUM offset * Do two lines match with canonicalized white space? */ static bool -similar(const char *a, const char *b, int len) +similar(const char *a, const char *b, ssize_t len) { while (len) { if (isspace((unsigned char)*b)) { /* whitespace (or \n) to match? */ Index: src/usr.bin/patch/pch.c diff -u src/usr.bin/patch/pch.c:1.33 src/usr.bin/patch/pch.c:1.34 --- src/usr.bin/patch/pch.c:1.33 Fri Jun 16 23:31:53 2023 +++ src/usr.bin/patch/pch.c Fri Jul 12 15:48:39 2024 @@ -1,7 +1,7 @@ /* * $OpenBSD: pch.c,v 1.37 2007/09/02 15:19:33 deraadt Exp $ * $DragonFly: src/usr.bin/patch/pch.c,v 1.6 2008/08/10 23:35:40 joerg Exp $ - * $NetBSD: pch.c,v 1.33 2023/06/16 23:31:53 wiz Exp $ + * $NetBSD: pch.c,v 1.34 2024/07/12 15:48:39 manu Exp $ */ /* @@ -31,7 +31,7 @@ */ #include -__RCSID("$NetBSD: pch.c,v 1.33 2023/06/16 23:31:53 wiz Exp $"); +__RCSID("$NetBSD: pch.c,v 1.34 2024/07/12 15:48:39 manu Exp $"); #include #include @@ -61,7 +61,7 @@ static LINENUM p_max; /* max allowed va static LINENUM p_context = 3; /* # of context lines */ static LINENUM p_input_line = 0; /* current line # from patch file */ static char **p_line = NULL;/* the text of the hunk */ -static short *p_len = NULL; /* length of each line */ +static ssize_t *p_len = NULL; /* length of each line */ static char *p_char = NULL; /* +, -, and ! */ static int hunkmax = INITHUNKMAX; /* size of above arrays to begin with */ static int p_indent; /* indent to patch */ @@ -135,7 +135,7 @@ set_hunkmax(void) if (p_line == NULL) p_line = calloc((size_t) hunkmax, sizeof(char *)); if (p_len == NULL) - p_len = calloc((size_t) hunkmax, sizeof(short)); + p_len = calloc((size_t) hunkmax, sizeof(ssize_t)); if (p_char == NULL) p_char = calloc((size_t) hunkmax, sizeof(char)); } @@ -148,7 +148,7 @@ grow_hunkmax(void) { int new_hunkmax; char **new_p_line; - short *new_p_len; + ssize_t *new_p_len; char *new_p_char; new_hunkmax = hunkmax * 2; @@ -160,7 +160,7 @@ grow_hunkmax(void) if (new_p_line == NULL) free(p_line); - new_p_len = pch_realloc(p_len, new_hunkmax, sizeof(short)); + new_p_len = pch_realloc(p_len, new_hunkmax, sizeof(ssize_t)); if (new_p_len == NULL) free(p_len); @@ -1207,7 +1207,7 @@ bool pch_swap(void) { char **tp_line; /* the text of the hunk */ - short *tp_len; /* length of each line */ + ssize_t *tp_len; /* length of each line */ char *tp_char; /* +, -, and ! */ LINENUM i; LINENUM n; @@ -1364,7 +1364,7 @@ pch_context(void) /* * Return the length of a particular patch line. */ -short +ssize_t pch_line_len(LINENUM line) { return p_len[line]; Index: src/usr.bin/patch/pch.h diff -u src/usr.bin/patch/pch.h:1.10 src/usr.bin/patch/pch.h:1.11 --- src/usr.bin/patch/pch.h:1.10 Fri Sep 19 18:33:34 2008 +++ src/usr.bin/patch/pch.h Fri Jul 12 15:48:39 2024 @@ -1,7 +1,7 @@ /* * $OpenBSD: pch.h,v 1.9 2003/10/31 20:20:45 millert Exp $
CVS commit: src/usr.bin/patch
Module Name:src Committed By: manu Date: Fri Jul 12 15:48:39 UTC 2024 Modified Files: src/usr.bin/patch: patch.c pch.c pch.h Log Message: Let patch(1) handle lines of length beyond INT16_MAX Borrowed from OpenBSD https://marc.info/?l=openbsd-bugs=168907249732754 To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/usr.bin/patch/patch.c cvs rdiff -u -r1.33 -r1.34 src/usr.bin/patch/pch.c cvs rdiff -u -r1.10 -r1.11 src/usr.bin/patch/pch.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Thu Jul 11 20:09:16 UTC 2024 Modified Files: src/usr.bin/make: compat.c main.c make.h src/usr.bin/make/unit-tests: var-op-shell.mk Log Message: Compat_RunCommand use tempfile if cmd too big Extract the logic recently added to Cmd_Exec to handle long commands via temp file to Cmd_Argv, so it can also be leveraged by Compat_RunCommand Reviewed by: christos To generate a diff of this commit: cvs rdiff -u -r1.259 -r1.260 src/usr.bin/make/compat.c cvs rdiff -u -r1.631 -r1.632 src/usr.bin/make/main.c cvs rdiff -u -r1.343 -r1.344 src/usr.bin/make/make.h cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/var-op-shell.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/compat.c diff -u src/usr.bin/make/compat.c:1.259 src/usr.bin/make/compat.c:1.260 --- src/usr.bin/make/compat.c:1.259 Sat Jun 15 20:02:45 2024 +++ src/usr.bin/make/compat.c Thu Jul 11 20:09:16 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: compat.c,v 1.259 2024/06/15 20:02:45 rillig Exp $ */ +/* $NetBSD: compat.c,v 1.260 2024/07/11 20:09:16 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -91,7 +91,7 @@ #include "pathnames.h" /* "@(#)compat.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: compat.c,v 1.259 2024/06/15 20:02:45 rillig Exp $"); +MAKE_RCSID("$NetBSD: compat.c,v 1.260 2024/07/11 20:09:16 sjg Exp $"); static GNode *curTarg = NULL; static pid_t compatChild; @@ -246,6 +246,8 @@ Compat_RunCommand(const char *cmdp, GNod bool useShell; /* True if command should be executed using a * shell */ const char *cmd = cmdp; + char cmd_file[MAXPATHLEN]; + size_t cmd_len; silent = (gn->type & OP_SILENT) != OP_NONE; errCheck = !(gn->type & OP_IGNORE); @@ -316,20 +318,20 @@ Compat_RunCommand(const char *cmdp, GNod DEBUG1(JOB, "Execute: '%s'\n", cmd); - if (useShell && shellPath == NULL) - Shell_Init(); /* we need shellPath */ + cmd_len = strlen(cmd); + if (cmd_len > MAKE_CMDLEN_LIMIT) + useShell = true; + else + cmd_file[0] = '\0'; if (useShell) { static const char *shargv[5]; - /* The following work for any of the builtin shell specs. */ - int shargc = 0; - shargv[shargc++] = shellPath; - if (errCheck && shellErrFlag != NULL) - shargv[shargc++] = shellErrFlag; - shargv[shargc++] = DEBUG(SHELL) ? "-xc" : "-c"; - shargv[shargc++] = cmd; - shargv[shargc] = NULL; + if (Cmd_Argv(cmd, cmd_len, shargv, 5, + cmd_file, sizeof(cmd_file), + (errCheck && shellErrFlag != NULL), + DEBUG(SHELL)) < 0) + Fatal("cannot run \"%s\"", cmd); av = shargv; bp = NULL; mav = NULL; @@ -422,6 +424,8 @@ Compat_RunCommand(const char *cmdp, GNod } free(cmdStart); + if (cmd_file[0] != '\0') + unlink(cmd_file); compatChild = 0; if (compatSigno != 0) { bmake_signal(compatSigno, SIG_DFL); Index: src/usr.bin/make/main.c diff -u src/usr.bin/make/main.c:1.631 src/usr.bin/make/main.c:1.632 --- src/usr.bin/make/main.c:1.631 Tue Jul 9 19:43:01 2024 +++ src/usr.bin/make/main.c Thu Jul 11 20:09:16 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.631 2024/07/09 19:43:01 rillig Exp $ */ +/* $NetBSD: main.c,v 1.632 2024/07/11 20:09:16 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -111,7 +111,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.631 2024/07/09 19:43:01 rillig Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.632 2024/07/11 20:09:16 sjg Exp $"); #if defined(MAKE_NATIVE) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -1685,6 +1685,56 @@ found: return true; } +/* populate av for Cmd_Exec and Compat_RunCommand */ +int +Cmd_Argv(const char *cmd, size_t cmd_len, const char **av, size_t avsz, +char *cmd_file, size_t cmd_filesz, bool eflag, bool xflag) +{ + int ac = 0; + int cmd_fd = -1; + + if (shellPath == NULL) + Shell_Init(); + + if (cmd_file != NULL) { + if (cmd_len == 0) + cmd_len = strlen(cmd); + + if (cmd_len > MAKE_CMDLEN_LIMIT) { + cmd_fd = mkTempFile(NULL, cmd_file, cmd_filesz); + if (cmd_fd >= 0) { +ssize_t n; + +n = write(cmd_fd, cmd, cmd_len); +close(cmd_fd); +if (n < (ssize_t)cmd_len) { + unlink(cmd_file); + cmd_fd = -1; +} + } + } else + cmd_file[0] = '\0'; + } + + if (avsz < 4 || (eflag && avsz < 5)) + return -1; + + /* The following works for any of the builtin shell specs. */ + av[ac++] = shellPath; + if (eflag) + av[ac++] = shellErrFlag; + if (cmd_fd >= 0) { + if (xflag) + av[ac++] = "-x"; + av[ac++] = cmd_file; + } else { + av[ac++] = xflag ? "-xc" : "-c"; + av[ac++] = cmd; + } + av[ac] = NULL; + return ac; +} + /* * Execute the command in cmd, and return its output (only stdout, not * stderr, possibly empty). In the output, replace newlines with spaces. @@ -1703,40 +1753,11 @@
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Thu Jul 11 20:09:16 UTC 2024 Modified Files: src/usr.bin/make: compat.c main.c make.h src/usr.bin/make/unit-tests: var-op-shell.mk Log Message: Compat_RunCommand use tempfile if cmd too big Extract the logic recently added to Cmd_Exec to handle long commands via temp file to Cmd_Argv, so it can also be leveraged by Compat_RunCommand Reviewed by: christos To generate a diff of this commit: cvs rdiff -u -r1.259 -r1.260 src/usr.bin/make/compat.c cvs rdiff -u -r1.631 -r1.632 src/usr.bin/make/main.c cvs rdiff -u -r1.343 -r1.344 src/usr.bin/make/make.h cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/var-op-shell.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Tue Jul 9 19:43:02 UTC 2024 Modified Files: src/usr.bin/make: main.c make.h parse.c src/usr.bin/make/unit-tests: cmd-errors-jobs.exp cmd-errors-jobs.mk cmd-errors.exp cmd-errors.mk dep-var.exp moderrs.exp varmisc.exp varmod-assign.exp varmod-hash.exp varmod-select-words.exp varmod-subst.exp Log Message: make: error out on parse/evaluation errors in shell commands The expression ${VAR:X} has an unknown modifier ':X'. Previously, this expression errored out when the expression was evaluated at parse time, but not when the expression was evaluated when generating the commands to bring a target up to date. The errors were previously reported, they didn't affect the exit status, though. Now, errors in expressions are handled in the same way, regardless of the time at which they are evaluated. To generate a diff of this commit: cvs rdiff -u -r1.630 -r1.631 src/usr.bin/make/main.c cvs rdiff -u -r1.342 -r1.343 src/usr.bin/make/make.h cvs rdiff -u -r1.733 -r1.734 src/usr.bin/make/parse.c cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/cmd-errors-jobs.exp \ src/usr.bin/make/unit-tests/cmd-errors.mk cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/cmd-errors-jobs.mk \ src/usr.bin/make/unit-tests/dep-var.exp cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/cmd-errors.exp cvs rdiff -u -r1.41 -r1.42 src/usr.bin/make/unit-tests/moderrs.exp cvs rdiff -u -r1.22 -r1.23 src/usr.bin/make/unit-tests/varmisc.exp cvs rdiff -u -r1.26 -r1.27 src/usr.bin/make/unit-tests/varmod-assign.exp cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/varmod-hash.exp cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/varmod-select-words.exp cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/varmod-subst.exp 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/main.c diff -u src/usr.bin/make/main.c:1.630 src/usr.bin/make/main.c:1.631 --- src/usr.bin/make/main.c:1.630 Sun Jul 7 09:54:12 2024 +++ src/usr.bin/make/main.c Tue Jul 9 19:43:01 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.630 2024/07/07 09:54:12 rillig Exp $ */ +/* $NetBSD: main.c,v 1.631 2024/07/09 19:43:01 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -111,7 +111,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.630 2024/07/07 09:54:12 rillig Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.631 2024/07/09 19:43:01 rillig Exp $"); #if defined(MAKE_NATIVE) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -1604,7 +1604,7 @@ main_CleanUp(void) static int main_Exit(bool outOfDate) { - if (opts.strict && (main_errors > 0 || Parse_NumErrors() > 0)) + if ((opts.strict && main_errors > 0) || parseErrors > 0) return 2; /* Not 1 so -q can distinguish error */ return outOfDate ? 1 : 0; } Index: src/usr.bin/make/make.h diff -u src/usr.bin/make/make.h:1.342 src/usr.bin/make/make.h:1.343 --- src/usr.bin/make/make.h:1.342 Sun Jul 7 09:54:12 2024 +++ src/usr.bin/make/make.h Tue Jul 9 19:43:01 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: make.h,v 1.342 2024/07/07 09:54:12 rillig Exp $ */ +/* $NetBSD: make.h,v 1.343 2024/07/09 19:43:01 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -861,6 +861,7 @@ const char *cached_realpath(const char * bool GetBooleanExpr(const char *, bool); /* parse.c */ +extern int parseErrors; void Parse_Init(void); #ifdef CLEANUP void Parse_End(void); @@ -874,7 +875,6 @@ void Parse_File(const char *, int); void Parse_PushInput(const char *, unsigned, unsigned, Buffer, struct ForLoop *); void Parse_MainName(GNodeList *); -int Parse_NumErrors(void) MAKE_ATTR_USE; unsigned int CurFile_CondMinDepth(void) MAKE_ATTR_USE; void Parse_GuardElse(void); void Parse_GuardEndif(void); Index: src/usr.bin/make/parse.c diff -u src/usr.bin/make/parse.c:1.733 src/usr.bin/make/parse.c:1.734 --- src/usr.bin/make/parse.c:1.733 Sun Jul 7 07:50:57 2024 +++ src/usr.bin/make/parse.c Tue Jul 9 19:43:01 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.733 2024/07/07 07:50:57 rillig Exp $ */ +/* $NetBSD: parse.c,v 1.734 2024/07/09 19:43:01 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -105,7 +105,7 @@ #include "pathnames.h" /* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: parse.c,v 1.733 2024/07/07 07:50:57 rillig Exp $"); +MAKE_RCSID("$NetBSD: parse.c,v 1.734 2024/07/09 19:43:01 rillig Exp $"); /* Detects a multiple-inclusion guard in a makefile. */ typedef enum { @@ -231,7 +231,7 @@ static StringList targCmds = LST_INIT; */ static GNode *order_pred; -static int parseErrors; +int parseErrors; /* * The include chain of makefiles. At index 0 is the top-level makefile from @@ -3012,9 +3012,3 @@ Parse_MainName(GNodeList *mainList)
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Tue Jul 9 19:43:02 UTC 2024 Modified Files: src/usr.bin/make: main.c make.h parse.c src/usr.bin/make/unit-tests: cmd-errors-jobs.exp cmd-errors-jobs.mk cmd-errors.exp cmd-errors.mk dep-var.exp moderrs.exp varmisc.exp varmod-assign.exp varmod-hash.exp varmod-select-words.exp varmod-subst.exp Log Message: make: error out on parse/evaluation errors in shell commands The expression ${VAR:X} has an unknown modifier ':X'. Previously, this expression errored out when the expression was evaluated at parse time, but not when the expression was evaluated when generating the commands to bring a target up to date. The errors were previously reported, they didn't affect the exit status, though. Now, errors in expressions are handled in the same way, regardless of the time at which they are evaluated. To generate a diff of this commit: cvs rdiff -u -r1.630 -r1.631 src/usr.bin/make/main.c cvs rdiff -u -r1.342 -r1.343 src/usr.bin/make/make.h cvs rdiff -u -r1.733 -r1.734 src/usr.bin/make/parse.c cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/cmd-errors-jobs.exp \ src/usr.bin/make/unit-tests/cmd-errors.mk cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/cmd-errors-jobs.mk \ src/usr.bin/make/unit-tests/dep-var.exp cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/cmd-errors.exp cvs rdiff -u -r1.41 -r1.42 src/usr.bin/make/unit-tests/moderrs.exp cvs rdiff -u -r1.22 -r1.23 src/usr.bin/make/unit-tests/varmisc.exp cvs rdiff -u -r1.26 -r1.27 src/usr.bin/make/unit-tests/varmod-assign.exp cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/varmod-hash.exp cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/varmod-select-words.exp cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/varmod-subst.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Tue Jul 9 17:07:23 UTC 2024 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: varmod-edge.exp varmod-edge.mk varmod-match-escape.exp varmod-match-escape.mk varmod-match.exp varmod-match.mk Log Message: make: error out on syntax errors in ':M' and ':N' modifiers More than a year ago, the warning has been added. Now it has been promoted to an error. To generate a diff of this commit: cvs rdiff -u -r1.1134 -r1.1135 src/usr.bin/make/var.c cvs rdiff -u -r1.25 -r1.26 src/usr.bin/make/unit-tests/varmod-edge.exp \ src/usr.bin/make/unit-tests/varmod-match.mk cvs rdiff -u -r1.28 -r1.29 src/usr.bin/make/unit-tests/varmod-edge.mk cvs rdiff -u -r1.23 -r1.24 \ src/usr.bin/make/unit-tests/varmod-match-escape.exp cvs rdiff -u -r1.16 -r1.17 src/usr.bin/make/unit-tests/varmod-match-escape.mk cvs rdiff -u -r1.19 -r1.20 src/usr.bin/make/unit-tests/varmod-match.exp 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.1134 src/usr.bin/make/var.c:1.1135 --- src/usr.bin/make/var.c:1.1134 Sun Jul 7 09:54:12 2024 +++ src/usr.bin/make/var.c Tue Jul 9 17:07:23 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.1134 2024/07/07 09:54:12 rillig Exp $ */ +/* $NetBSD: var.c,v 1.1135 2024/07/09 17:07:23 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -128,7 +128,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.1134 2024/07/07 09:54:12 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.1135 2024/07/09 17:07:23 rillig Exp $"); /* * Variables are defined using one of the VAR=value assignments. Their @@ -2801,7 +2801,7 @@ ModifyWord_Match(Substring word, SepBuf res = Str_Match(word.start, args->pattern); if (res.error != NULL && !args->error_reported) { args->error_reported = true; - Parse_Error(PARSE_WARNING, + Parse_Error(PARSE_FATAL, "%s in pattern '%s' of modifier '%s'", res.error, args->pattern, args->neg ? ":N" : ":M"); } Index: src/usr.bin/make/unit-tests/varmod-edge.exp diff -u src/usr.bin/make/unit-tests/varmod-edge.exp:1.25 src/usr.bin/make/unit-tests/varmod-edge.exp:1.26 --- src/usr.bin/make/unit-tests/varmod-edge.exp:1.25 Sat Jul 6 10:36:23 2024 +++ src/usr.bin/make/unit-tests/varmod-edge.exp Tue Jul 9 17:07:23 2024 @@ -1,5 +1,5 @@ make: "varmod-edge.mk" line 60: while evaluating variable "MOD" with value "${INP:M${:U*)}}": while evaluating variable "INP" with value "(parentheses)": while evaluating "${:U*)" with value "*)": Unclosed expression, expecting '}' for modifier "U*)" -make: "varmod-edge.mk" line 88: warning: while evaluating variable "MOD" with value "${INP:M${:U[[}}": while evaluating variable "INP" with value "[ [[ [[[": Unfinished character list in pattern '[[' of modifier ':M' +make: "varmod-edge.mk" line 88: while evaluating variable "MOD" with value "${INP:M${:U[[}}": while evaluating variable "INP" with value "[ [[ [[[": Unfinished character list in pattern '[[' of modifier ':M' make: "varmod-edge.mk" line 178: while evaluating variable "MOD" with value "${INP:a\=b}": while evaluating variable "INP" with value "file.c file...": Unfinished modifier ('=' missing) make: "varmod-edge.mk" line 194: while evaluating variable "MOD" with value "${INP}": while evaluating variable "INP" with value "value": Unknown modifier ":" make: "varmod-edge.mk" line 194: while evaluating variable "MOD" with value "${INP}": while evaluating variable "INP" with value "": Unknown modifier ":" Index: src/usr.bin/make/unit-tests/varmod-match.mk diff -u src/usr.bin/make/unit-tests/varmod-match.mk:1.25 src/usr.bin/make/unit-tests/varmod-match.mk:1.26 --- src/usr.bin/make/unit-tests/varmod-match.mk:1.25 Thu Jul 4 17:47:54 2024 +++ src/usr.bin/make/unit-tests/varmod-match.mk Tue Jul 9 17:07:23 2024 @@ -1,4 +1,4 @@ -# $NetBSD: varmod-match.mk,v 1.25 2024/07/04 17:47:54 rillig Exp $ +# $NetBSD: varmod-match.mk,v 1.26 2024/07/09 17:07:23 rillig Exp $ # # Tests for the ':M' modifier, which keeps only those words that match the # given pattern. @@ -285,7 +285,7 @@ ${:U*}= asterisk # [ Incomplete empty character list, never matches. WORDS= a a[ -# expect+1: warning: while evaluating variable "WORDS" with value "a a[": Unfinished character list in pattern 'a[' of modifier ':M' +# expect+1: while evaluating variable "WORDS" with value "a a[": Unfinished character list in pattern 'a[' of modifier ':M' .if ${WORDS:Ma[} != "" . error .endif @@ -293,7 +293,7 @@ WORDS= a a[ # [^ Incomplete negated empty character list, matches any single # character. WORDS= a a[ aX -# expect+1: warning: while evaluating variable "WORDS" with value "a a[ aX": Unfinished character list in pattern 'a[^' of modifier ':M' +# expect+1: while evaluating variable "WORDS" with value
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Tue Jul 9 17:07:23 UTC 2024 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: varmod-edge.exp varmod-edge.mk varmod-match-escape.exp varmod-match-escape.mk varmod-match.exp varmod-match.mk Log Message: make: error out on syntax errors in ':M' and ':N' modifiers More than a year ago, the warning has been added. Now it has been promoted to an error. To generate a diff of this commit: cvs rdiff -u -r1.1134 -r1.1135 src/usr.bin/make/var.c cvs rdiff -u -r1.25 -r1.26 src/usr.bin/make/unit-tests/varmod-edge.exp \ src/usr.bin/make/unit-tests/varmod-match.mk cvs rdiff -u -r1.28 -r1.29 src/usr.bin/make/unit-tests/varmod-edge.mk cvs rdiff -u -r1.23 -r1.24 \ src/usr.bin/make/unit-tests/varmod-match-escape.exp cvs rdiff -u -r1.16 -r1.17 src/usr.bin/make/unit-tests/varmod-match-escape.mk cvs rdiff -u -r1.19 -r1.20 src/usr.bin/make/unit-tests/varmod-match.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sun Jul 7 11:20:10 UTC 2024 Modified Files: src/usr.bin/make/unit-tests: directive-for-escape.exp directive-for-escape.mk Log Message: tests/make: remove '# expect' lines from .exp file These lines are only supposed to occur in .mk files. To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 \ src/usr.bin/make/unit-tests/directive-for-escape.exp cvs rdiff -u -r1.27 -r1.28 \ src/usr.bin/make/unit-tests/directive-for-escape.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/unit-tests/directive-for-escape.exp diff -u src/usr.bin/make/unit-tests/directive-for-escape.exp:1.29 src/usr.bin/make/unit-tests/directive-for-escape.exp:1.30 --- src/usr.bin/make/unit-tests/directive-for-escape.exp:1.29 Sat Jul 6 10:14:35 2024 +++ src/usr.bin/make/unit-tests/directive-for-escape.exp Sun Jul 7 11:20:10 2024 @@ -1,134 +1,45 @@ For: end for 1 For: loop body with chars = !"#$%&'()*+,-./0-9:;<=>?@A-Z[\]_^a-z{|}~: -# expect+2: while evaluating "${:U!"" with value "!"": Unclosed expression, expecting '}' for modifier "U!"" -# expect+1: !" . info ${:U!"#$%&'()*+,-./0-9\:;<=>?@A-Z[\\]_^a-z{|\}~} make: "directive-for-escape.mk" line 21: while evaluating "${:U!"" with value "!"": Unclosed expression, expecting '}' for modifier "U!"" - in .for loop from directive-for-escape.mk:18 with chars = !"#$%&'()*+,-./0-9:;<=>?@A-Z[\]_^a-z{|}~ + in .for loop from directive-for-escape.mk:20 with chars = !"#$%&'()*+,-./0-9:;<=>?@A-Z[\]_^a-z{|}~ make: "directive-for-escape.mk" line 21: !" For: end for 1 For: loop body with chars = !"\\#$%&'()*+,-./0-9:;<=>?@A-Z[\]_^a-z{|}~: -# expect+2: while evaluating "${:U!"" with value "!"\\": Unclosed expression, expecting '}' for modifier "U!"" -# expect+1: !"\\ . info ${:U!"#$%&'()*+,-./0-9\:;<=>?@A-Z[\\]_^a-z{|\}~} make: "directive-for-escape.mk" line 33: while evaluating "${:U!"" with value "!"\\": Unclosed expression, expecting '}' for modifier "U!"" - in .for loop from directive-for-escape.mk:30 with chars = !"\\#$%&'()*+,-./0-9:;<=>?@A-Z[\]_^a-z{|}~ + in .for loop from directive-for-escape.mk:32 with chars = !"\\#$%&'()*+,-./0-9:;<=>?@A-Z[\]_^a-z{|}~ make: "directive-for-escape.mk" line 33: !"\\ For: end for 1 For: loop body with i = $: -# expect: . info ${:U\$} -# expect+9: $ -# expect: . info ${:U${V}} -# expect+7: value -# expect: . info ${:U${V:=-with-modifier}} -# expect+5: value-with-modifier -# expect: . info ${:U$(V)} -# expect+3: value -# expect: . info ${:U$(V:=-with-modifier)} -# expect+1: value-with-modifier . info ${:U\$} make: "directive-for-escape.mk" line 57: $ For: loop body with i = ${V}: -# expect: . info ${:U\$} -# expect+9: $ -# expect: . info ${:U${V}} -# expect+7: value -# expect: . info ${:U${V:=-with-modifier}} -# expect+5: value-with-modifier -# expect: . info ${:U$(V)} -# expect+3: value -# expect: . info ${:U$(V:=-with-modifier)} -# expect+1: value-with-modifier . info ${:U${V}} make: "directive-for-escape.mk" line 57: value For: loop body with i = ${V:=-with-modifier}: -# expect: . info ${:U\$} -# expect+9: $ -# expect: . info ${:U${V}} -# expect+7: value -# expect: . info ${:U${V:=-with-modifier}} -# expect+5: value-with-modifier -# expect: . info ${:U$(V)} -# expect+3: value -# expect: . info ${:U$(V:=-with-modifier)} -# expect+1: value-with-modifier . info ${:U${V:=-with-modifier}} make: "directive-for-escape.mk" line 57: value-with-modifier For: loop body with i = $(V): -# expect: . info ${:U\$} -# expect+9: $ -# expect: . info ${:U${V}} -# expect+7: value -# expect: . info ${:U${V:=-with-modifier}} -# expect+5: value-with-modifier -# expect: . info ${:U$(V)} -# expect+3: value -# expect: . info ${:U$(V:=-with-modifier)} -# expect+1: value-with-modifier . info ${:U$(V)} make: "directive-for-escape.mk" line 57: value For: loop body with i = $(V:=-with-modifier): -# expect: . info ${:U\$} -# expect+9: $ -# expect: . info ${:U${V}} -# expect+7: value -# expect: . info ${:U${V:=-with-modifier}} -# expect+5: value-with-modifier -# expect: . info ${:U$(V)} -# expect+3: value -# expect: . info ${:U$(V:=-with-modifier)} -# expect+1: value-with-modifier . info ${:U$(V:=-with-modifier)} make: "directive-for-escape.mk" line 57: value-with-modifier For: end for 1 For: loop body with i = $: -# expect: . info ${:U\$} -# expect+6: $ -# expect: . info ${:U${V}} -# expect+4: value -# expect+3: value-with-modifier -# expect+2: value -# expect+1: value-with-modifier . info ${:U\$} make: "directive-for-escape.mk" line 69: $ For: loop body with i = ${V}: -# expect: . info ${:U\$} -# expect+6: $ -# expect: . info ${:U${V}} -# expect+4: value -# expect+3: value-with-modifier -# expect+2: value -# expect+1: value-with-modifier . info ${:U${V}} make: "directive-for-escape.mk" line 69: value For:
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sun Jul 7 11:20:10 UTC 2024 Modified Files: src/usr.bin/make/unit-tests: directive-for-escape.exp directive-for-escape.mk Log Message: tests/make: remove '# expect' lines from .exp file These lines are only supposed to occur in .mk files. To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 \ src/usr.bin/make/unit-tests/directive-for-escape.exp cvs rdiff -u -r1.27 -r1.28 \ src/usr.bin/make/unit-tests/directive-for-escape.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Jul 7 09:54:13 UTC 2024 Modified Files: src/usr.bin/make: main.c make.h targ.c var.c Log Message: make: move initialization of variable scopes to targ.c The variable scopes are freed by Targ_End, so initialize them there as well. Separate printing statistics and freeing memory, which makes Var_End unnecessary. To generate a diff of this commit: cvs rdiff -u -r1.629 -r1.630 src/usr.bin/make/main.c cvs rdiff -u -r1.341 -r1.342 src/usr.bin/make/make.h cvs rdiff -u -r1.183 -r1.184 src/usr.bin/make/targ.c cvs rdiff -u -r1.1133 -r1.1134 src/usr.bin/make/var.c 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/main.c diff -u src/usr.bin/make/main.c:1.629 src/usr.bin/make/main.c:1.630 --- src/usr.bin/make/main.c:1.629 Sun Jul 7 07:50:57 2024 +++ src/usr.bin/make/main.c Sun Jul 7 09:54:12 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.629 2024/07/07 07:50:57 rillig Exp $ */ +/* $NetBSD: main.c,v 1.630 2024/07/07 09:54:12 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -111,7 +111,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.629 2024/07/07 07:50:57 rillig Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.630 2024/07/07 09:54:12 rillig Exp $"); #if defined(MAKE_NATIVE) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -1342,7 +1342,6 @@ main_Init(int argc, char **argv) /* Just in case MAKEOBJDIR wants us to do something tricky. */ Targ_Init(); - Var_Init(); Global_Set_ReadOnly(".MAKE.OS", utsname.sysname); Global_Set("MACHINE", machine); Global_Set("MACHINE_ARCH", machine_arch); @@ -1581,15 +1580,15 @@ main_CleanUp(void) if (opts.enterFlag) printf("%s: Leaving directory `%s'\n", progname, curdir); + Var_Stats(); + Targ_Stats(); + #ifdef USE_META meta_finish(); #endif #ifdef CLEANUP Suff_End(); -#endif - Var_End(); Targ_End(); -#ifdef CLEANUP Arch_End(); Parse_End(); Dir_End(); Index: src/usr.bin/make/make.h diff -u src/usr.bin/make/make.h:1.341 src/usr.bin/make/make.h:1.342 --- src/usr.bin/make/make.h:1.341 Sun Jul 7 07:50:57 2024 +++ src/usr.bin/make/make.h Sun Jul 7 09:54:12 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: make.h,v 1.341 2024/07/07 07:50:57 rillig Exp $ */ +/* $NetBSD: make.h,v 1.342 2024/07/07 09:54:12 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -931,8 +931,6 @@ void Parse_RegisterCommand(char *cmd MAK #endif /* var.c */ -void Var_Init(void); -void Var_End(void); typedef enum VarEvalMode { Index: src/usr.bin/make/targ.c diff -u src/usr.bin/make/targ.c:1.183 src/usr.bin/make/targ.c:1.184 --- src/usr.bin/make/targ.c:1.183 Sat May 25 21:07:48 2024 +++ src/usr.bin/make/targ.c Sun Jul 7 09:54:12 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: targ.c,v 1.183 2024/05/25 21:07:48 rillig Exp $ */ +/* $NetBSD: targ.c,v 1.184 2024/07/07 09:54:12 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -107,7 +107,7 @@ #include "dir.h" /* "@(#)targ.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: targ.c,v 1.183 2024/05/25 21:07:48 rillig Exp $"); +MAKE_RCSID("$NetBSD: targ.c,v 1.184 2024/07/07 09:54:12 rillig Exp $"); /* * All target nodes that appeared on the left-hand side of one of the @@ -126,23 +126,24 @@ void Targ_Init(void) { HashTable_Init(); + SCOPE_INTERNAL = GNode_New("Internal"); + SCOPE_GLOBAL = GNode_New("Global"); + SCOPE_CMDLINE = GNode_New("Command"); } +#ifdef CLEANUP void Targ_End(void) { -#ifdef CLEANUP GNodeListNode *ln; -#endif - Targ_Stats(); -#ifdef CLEANUP + Lst_Done(); HashTable_Done(); for (ln = allNodes.first; ln != NULL; ln = ln->next) GNode_Free(ln->datum); Lst_Done(); -#endif } +#endif void Targ_Stats(void) Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.1133 src/usr.bin/make/var.c:1.1134 --- src/usr.bin/make/var.c:1.1133 Fri Jul 5 20:01:52 2024 +++ src/usr.bin/make/var.c Sun Jul 7 09:54:12 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.1133 2024/07/05 20:01:52 rillig Exp $ */ +/* $NetBSD: var.c,v 1.1134 2024/07/07 09:54:12 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -76,10 +76,6 @@ * expressions like ${VAR}, ${VAR:Modifiers}, ${${VARNAME}} or ${VAR:${MODS}}. * * Interface: - * Var_Init Initialize this module. - * - * Var_End Clean up the module. - * * Var_Set * Var_SetExpand Set the value of the variable, creating it if * necessary. @@ -132,7 +128,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.1133 2024/07/05 20:01:52 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.1134 2024/07/07 09:54:12 rillig Exp $"); /* * Variables are defined using one of the VAR=value assignments. Their @@ -4809,22 +4805,6 @@ Var_Expand(FStr *str, GNode *scope, VarE *str =
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Jul 7 09:54:13 UTC 2024 Modified Files: src/usr.bin/make: main.c make.h targ.c var.c Log Message: make: move initialization of variable scopes to targ.c The variable scopes are freed by Targ_End, so initialize them there as well. Separate printing statistics and freeing memory, which makes Var_End unnecessary. To generate a diff of this commit: cvs rdiff -u -r1.629 -r1.630 src/usr.bin/make/main.c cvs rdiff -u -r1.341 -r1.342 src/usr.bin/make/make.h cvs rdiff -u -r1.183 -r1.184 src/usr.bin/make/targ.c cvs rdiff -u -r1.1133 -r1.1134 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Jul 7 09:37:00 UTC 2024 Modified Files: src/usr.bin/make: hash.c hash.h src/usr.bin/make/unit-tests: Makefile opt-debug-hash.exp Log Message: make: don't track hash table chain lengths during lookup The chain lengths are only used for debugging purposes, so avoid the extra cost at each lookup. Instead, calculate the maximum chain length only when it is actually requested in -dh mode. The reported number changes slightly: Before, it was the length of the chain that was actually traversed to find an entry, up to that entry, now it is the length of the largest chain in the table, no matter if it was actually accessed or not. To generate a diff of this commit: cvs rdiff -u -r1.78 -r1.79 src/usr.bin/make/hash.c cvs rdiff -u -r1.50 -r1.51 src/usr.bin/make/hash.h cvs rdiff -u -r1.349 -r1.350 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/opt-debug-hash.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Jul 7 09:37:00 UTC 2024 Modified Files: src/usr.bin/make: hash.c hash.h src/usr.bin/make/unit-tests: Makefile opt-debug-hash.exp Log Message: make: don't track hash table chain lengths during lookup The chain lengths are only used for debugging purposes, so avoid the extra cost at each lookup. Instead, calculate the maximum chain length only when it is actually requested in -dh mode. The reported number changes slightly: Before, it was the length of the chain that was actually traversed to find an entry, up to that entry, now it is the length of the largest chain in the table, no matter if it was actually accessed or not. To generate a diff of this commit: cvs rdiff -u -r1.78 -r1.79 src/usr.bin/make/hash.c cvs rdiff -u -r1.50 -r1.51 src/usr.bin/make/hash.h cvs rdiff -u -r1.349 -r1.350 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/opt-debug-hash.exp 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/hash.c diff -u src/usr.bin/make/hash.c:1.78 src/usr.bin/make/hash.c:1.79 --- src/usr.bin/make/hash.c:1.78 Wed Jun 5 22:06:53 2024 +++ src/usr.bin/make/hash.c Sun Jul 7 09:37:00 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: hash.c,v 1.78 2024/06/05 22:06:53 rillig Exp $ */ +/* $NetBSD: hash.c,v 1.79 2024/07/07 09:37:00 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -74,7 +74,7 @@ #include "make.h" /* "@(#)hash.c 8.1 (Berkeley) 6/6/93" */ -MAKE_RCSID("$NetBSD: hash.c,v 1.78 2024/06/05 22:06:53 rillig Exp $"); +MAKE_RCSID("$NetBSD: hash.c,v 1.79 2024/07/07 09:37:00 rillig Exp $"); /* * The ratio of # entries to # buckets at which we rebuild the table to @@ -114,7 +114,6 @@ static HashEntry * HashTable_Find(HashTable *t, Substring key, unsigned int h) { HashEntry *he; - unsigned int chainlen = 0; size_t keyLen = Substring_Length(key); #ifdef DEBUG_HASH_LOOKUP @@ -123,16 +122,12 @@ HashTable_Find(HashTable *t, Substring k #endif for (he = t->buckets[h & t->bucketsMask]; he != NULL; he = he->next) { - chainlen++; if (he->hash == h && strncmp(he->key, key.start, keyLen) == 0 && he->key[keyLen] == '\0') break; } - if (chainlen > t->maxchain) - t->maxchain = chainlen; - return he; } @@ -149,7 +144,6 @@ HashTable_Init(HashTable *t) t->bucketsSize = n; t->numEntries = 0; t->bucketsMask = n - 1; - t->maxchain = 0; } /* @@ -205,6 +199,20 @@ HashTable_FindValueBySubstringHash(HashT return he != NULL ? he->value : NULL; } +static unsigned +HashTable_MaxChain(const HashTable *t) +{ + unsigned b, cl, max_cl = 0; + for (b = 0; b < t->bucketsSize; b++) { + const HashEntry *he = t->buckets[b]; + for (cl = 0; he != NULL; he = he->next) + cl++; + if (cl > max_cl) + max_cl = cl; + } + return max_cl; +} + /* * Make the hash table larger. Any bucket numbers from the old table become * invalid; the hash values stay valid though. @@ -238,8 +246,7 @@ HashTable_Enlarge(HashTable *t) t->bucketsMask = newMask; t->buckets = newBuckets; DEBUG4(HASH, "HashTable_Enlarge: %p size=%d entries=%d maxchain=%d\n", - (void *)t, t->bucketsSize, t->numEntries, t->maxchain); - t->maxchain = 0; + (void *)t, t->bucketsSize, t->numEntries, HashTable_MaxChain(t)); } /* @@ -321,8 +328,8 @@ HashIter_Next(HashIter *hi) } void -HashTable_DebugStats(HashTable *t, const char *name) +HashTable_DebugStats(const HashTable *t, const char *name) { - DEBUG4(HASH, "HashTable %s: size=%u numEntries=%u maxchain=%u\n", - name, t->bucketsSize, t->numEntries, t->maxchain); + DEBUG4(HASH, "HashTable \"%s\": size=%u entries=%u maxchain=%u\n", + name, t->bucketsSize, t->numEntries, HashTable_MaxChain(t)); } Index: src/usr.bin/make/hash.h diff -u src/usr.bin/make/hash.h:1.50 src/usr.bin/make/hash.h:1.51 --- src/usr.bin/make/hash.h:1.50 Sat Jun 1 10:10:50 2024 +++ src/usr.bin/make/hash.h Sun Jul 7 09:37:00 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: hash.h,v 1.50 2024/06/01 10:10:50 rillig Exp $ */ +/* $NetBSD: hash.h,v 1.51 2024/07/07 09:37:00 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -92,7 +92,6 @@ typedef struct HashTable { unsigned int bucketsSize; unsigned int numEntries; unsigned int bucketsMask; /* Used to select the bucket for a hash. */ - unsigned int maxchain; /* Maximum length of chain seen. */ } HashTable; /* State of an iteration over all entries in a table. */ @@ -138,7 +137,7 @@ void *HashTable_FindValueBySubstringHash HashEntry *HashTable_CreateEntry(HashTable *, const char *, bool *); void HashTable_Set(HashTable *, const char *, void *); void HashTable_DeleteEntry(HashTable *, HashEntry *); -void HashTable_DebugStats(HashTable *, const char *); +void HashTable_DebugStats(const HashTable *, const char *);
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Jul 7 07:50:58 UTC 2024 Modified Files: src/usr.bin/make: arch.c dir.c dir.h job.c job.h main.c make.h parse.c str.c str.h suff.c Log Message: make: only generate code for cleanup functions in CLEANUP mode To generate a diff of this commit: cvs rdiff -u -r1.220 -r1.221 src/usr.bin/make/arch.c cvs rdiff -u -r1.294 -r1.295 src/usr.bin/make/dir.c cvs rdiff -u -r1.48 -r1.49 src/usr.bin/make/dir.h cvs rdiff -u -r1.479 -r1.480 src/usr.bin/make/job.c cvs rdiff -u -r1.79 -r1.80 src/usr.bin/make/job.h cvs rdiff -u -r1.628 -r1.629 src/usr.bin/make/main.c cvs rdiff -u -r1.340 -r1.341 src/usr.bin/make/make.h cvs rdiff -u -r1.732 -r1.733 src/usr.bin/make/parse.c cvs rdiff -u -r1.104 -r1.105 src/usr.bin/make/str.c cvs rdiff -u -r1.19 -r1.20 src/usr.bin/make/str.h cvs rdiff -u -r1.381 -r1.382 src/usr.bin/make/suff.c 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/arch.c diff -u src/usr.bin/make/arch.c:1.220 src/usr.bin/make/arch.c:1.221 --- src/usr.bin/make/arch.c:1.220 Fri Jul 5 05:11:25 2024 +++ src/usr.bin/make/arch.c Sun Jul 7 07:50:57 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: arch.c,v 1.220 2024/07/05 05:11:25 rillig Exp $ */ +/* $NetBSD: arch.c,v 1.221 2024/07/07 07:50:57 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -126,7 +126,7 @@ #include "config.h" /* "@(#)arch.c 8.2 (Berkeley) 1/2/94" */ -MAKE_RCSID("$NetBSD: arch.c,v 1.220 2024/07/05 05:11:25 rillig Exp $"); +MAKE_RCSID("$NetBSD: arch.c,v 1.221 2024/07/07 07:50:57 rillig Exp $"); typedef struct List ArchList; typedef struct ListNode ArchListNode; @@ -949,18 +949,18 @@ Arch_Init(void) Lst_Init(); } +#ifdef CLEANUP /* Clean up the archives module. */ void Arch_End(void) { -#ifdef CLEANUP ArchListNode *ln; for (ln = archives.first; ln != NULL; ln = ln->next) ArchFree(ln->datum); Lst_Done(); -#endif } +#endif bool Arch_IsLib(GNode *gn) Index: src/usr.bin/make/dir.c diff -u src/usr.bin/make/dir.c:1.294 src/usr.bin/make/dir.c:1.295 --- src/usr.bin/make/dir.c:1.294 Fri May 31 05:50:11 2024 +++ src/usr.bin/make/dir.c Sun Jul 7 07:50:57 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: dir.c,v 1.294 2024/05/31 05:50:11 rillig Exp $ */ +/* $NetBSD: dir.c,v 1.295 2024/07/07 07:50:57 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -132,7 +132,7 @@ #include "job.h" /* "@(#)dir.c 8.2 (Berkeley) 1/2/94" */ -MAKE_RCSID("$NetBSD: dir.c,v 1.294 2024/05/31 05:50:11 rillig Exp $"); +MAKE_RCSID("$NetBSD: dir.c,v 1.295 2024/07/07 07:50:57 rillig Exp $"); /* * A search path is a list of CachedDir structures. A CachedDir has in it the @@ -511,13 +511,11 @@ FreeCachedTable(HashTable *tbl) free(hi.entry->value); HashTable_Done(tbl); } -#endif /* Clean up the directories module. */ void Dir_End(void) { -#ifdef CLEANUP CachedDir_Assign(, NULL); CachedDir_Assign(, NULL); CachedDir_Assign(, NULL); @@ -525,8 +523,8 @@ Dir_End(void) OpenDirs_Done(); FreeCachedTable(); FreeCachedTable(); -#endif } +#endif /* * We want ${.PATH} to indicate the order in which we will actually Index: src/usr.bin/make/dir.h diff -u src/usr.bin/make/dir.h:1.48 src/usr.bin/make/dir.h:1.49 --- src/usr.bin/make/dir.h:1.48 Sun May 19 20:09:40 2024 +++ src/usr.bin/make/dir.h Sun Jul 7 07:50:57 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: dir.h,v 1.48 2024/05/19 20:09:40 sjg Exp $ */ +/* $NetBSD: dir.h,v 1.49 2024/07/07 07:50:57 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -80,7 +80,9 @@ typedef struct CachedDir CachedDir; void Dir_Init(void); void Dir_InitCur(const char *); void Dir_InitDot(void); +#ifdef CLEANUP void Dir_End(void); +#endif void Dir_SetPATH(void); void Dir_SetSYSPATH(void); bool Dir_HasWildcards(const char *) MAKE_ATTR_USE; Index: src/usr.bin/make/job.c diff -u src/usr.bin/make/job.c:1.479 src/usr.bin/make/job.c:1.480 --- src/usr.bin/make/job.c:1.479 Fri Jul 5 05:11:25 2024 +++ src/usr.bin/make/job.c Sun Jul 7 07:50:57 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.479 2024/07/05 05:11:25 rillig Exp $ */ +/* $NetBSD: job.c,v 1.480 2024/07/07 07:50:57 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -141,7 +141,7 @@ #include "trace.h" /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: job.c,v 1.479 2024/07/05 05:11:25 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.480 2024/07/07 07:50:57 rillig Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -2585,14 +2585,14 @@ Job_Finish(void) return job_errors; } +#ifdef CLEANUP /* Clean up any memory used by the jobs module. */ void Job_End(void) { -#ifdef CLEANUP free(shell_freeIt); -#endif } +#endif /* * Waits for all running jobs to finish and returns.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Jul 7 07:50:58 UTC 2024 Modified Files: src/usr.bin/make: arch.c dir.c dir.h job.c job.h main.c make.h parse.c str.c str.h suff.c Log Message: make: only generate code for cleanup functions in CLEANUP mode To generate a diff of this commit: cvs rdiff -u -r1.220 -r1.221 src/usr.bin/make/arch.c cvs rdiff -u -r1.294 -r1.295 src/usr.bin/make/dir.c cvs rdiff -u -r1.48 -r1.49 src/usr.bin/make/dir.h cvs rdiff -u -r1.479 -r1.480 src/usr.bin/make/job.c cvs rdiff -u -r1.79 -r1.80 src/usr.bin/make/job.h cvs rdiff -u -r1.628 -r1.629 src/usr.bin/make/main.c cvs rdiff -u -r1.340 -r1.341 src/usr.bin/make/make.h cvs rdiff -u -r1.732 -r1.733 src/usr.bin/make/parse.c cvs rdiff -u -r1.104 -r1.105 src/usr.bin/make/str.c cvs rdiff -u -r1.19 -r1.20 src/usr.bin/make/str.h cvs rdiff -u -r1.381 -r1.382 src/usr.bin/make/suff.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Jul 6 21:35:48 UTC 2024 Modified Files: src/usr.bin/make: main.c Log Message: make: clean up condition when printing an error To generate a diff of this commit: cvs rdiff -u -r1.627 -r1.628 src/usr.bin/make/main.c 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/main.c diff -u src/usr.bin/make/main.c:1.627 src/usr.bin/make/main.c:1.628 --- src/usr.bin/make/main.c:1.627 Fri Jul 5 05:11:25 2024 +++ src/usr.bin/make/main.c Sat Jul 6 21:35:48 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.627 2024/07/05 05:11:25 rillig Exp $ */ +/* $NetBSD: main.c,v 1.628 2024/07/06 21:35:48 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -111,7 +111,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.627 2024/07/05 05:11:25 rillig Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.628 2024/07/06 21:35:48 rillig Exp $"); #if defined(MAKE_NATIVE) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -2084,8 +2084,7 @@ PrintOnError(GNode *gn, const char *msg) printf("%s", (const char *)ln->datum); for (ln = ln->next; ln != NULL; ln = ln->next) printf(" %s", (const char *)ln->datum); - } - if (opts.create.first == NULL && mainNode != NULL) + } else printf("%s", mainNode->name); printf("\""); }
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Jul 6 21:35:48 UTC 2024 Modified Files: src/usr.bin/make: main.c Log Message: make: clean up condition when printing an error To generate a diff of this commit: cvs rdiff -u -r1.627 -r1.628 src/usr.bin/make/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Jul 6 21:21:10 UTC 2024 Modified Files: src/usr.bin/make: cond.c src/usr.bin/make/unit-tests: cond-func.exp cond-func.mk cond-op-and.exp cond-op-and.mk cond-op-or.exp cond-op-or.mk Log Message: make: error out on conditions containing the operators '&' and '|' These abbreviated variants of the '&&' and '||' operators were never documented, so error out in non-lint mode as well. To generate a diff of this commit: cvs rdiff -u -r1.365 -r1.366 src/usr.bin/make/cond.c cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/cond-func.exp \ src/usr.bin/make/unit-tests/cond-op-and.mk cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/unit-tests/cond-func.mk cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/cond-op-and.exp cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/cond-op-or.exp cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/cond-op-or.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sat Jul 6 11:09:17 UTC 2024 Modified Files: src/usr.bin/make/unit-tests: varmod-edge.mk Log Message: tests/make: sync a comment with reality To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/usr.bin/make/unit-tests/varmod-edge.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/unit-tests/varmod-edge.mk diff -u src/usr.bin/make/unit-tests/varmod-edge.mk:1.27 src/usr.bin/make/unit-tests/varmod-edge.mk:1.28 --- src/usr.bin/make/unit-tests/varmod-edge.mk:1.27 Sat Jul 6 10:36:23 2024 +++ src/usr.bin/make/unit-tests/varmod-edge.mk Sat Jul 6 11:09:17 2024 @@ -1,4 +1,4 @@ -# $NetBSD: varmod-edge.mk,v 1.27 2024/07/06 10:36:23 rillig Exp $ +# $NetBSD: varmod-edge.mk,v 1.28 2024/07/06 11:09:17 rillig Exp $ # # Tests for edge cases in variable modifiers. # @@ -74,8 +74,8 @@ EXP= [ . warning expected "${EXP}", got "${MOD}" .endif + # The pattern in the nested variable has an unclosed character class. -# No error is reported though, and the pattern is closed implicitly. # # Before str.c 1.104 from 2024-07-06, no error was reported. #
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sat Jul 6 11:09:17 UTC 2024 Modified Files: src/usr.bin/make/unit-tests: varmod-edge.mk Log Message: tests/make: sync a comment with reality To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/usr.bin/make/unit-tests/varmod-edge.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Jul 6 10:36:23 UTC 2024 Modified Files: src/usr.bin/make: str.c src/usr.bin/make/unit-tests: varmod-edge.exp varmod-edge.mk Log Message: make: error out on a matching malformed matching pattern '[[' To generate a diff of this commit: cvs rdiff -u -r1.103 -r1.104 src/usr.bin/make/str.c cvs rdiff -u -r1.24 -r1.25 src/usr.bin/make/unit-tests/varmod-edge.exp cvs rdiff -u -r1.26 -r1.27 src/usr.bin/make/unit-tests/varmod-edge.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Jul 6 10:36:23 UTC 2024 Modified Files: src/usr.bin/make: str.c src/usr.bin/make/unit-tests: varmod-edge.exp varmod-edge.mk Log Message: make: error out on a matching malformed matching pattern '[[' To generate a diff of this commit: cvs rdiff -u -r1.103 -r1.104 src/usr.bin/make/str.c cvs rdiff -u -r1.24 -r1.25 src/usr.bin/make/unit-tests/varmod-edge.exp cvs rdiff -u -r1.26 -r1.27 src/usr.bin/make/unit-tests/varmod-edge.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/str.c diff -u src/usr.bin/make/str.c:1.103 src/usr.bin/make/str.c:1.104 --- src/usr.bin/make/str.c:1.103 Sun Apr 14 15:21:20 2024 +++ src/usr.bin/make/str.c Sat Jul 6 10:36:23 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: str.c,v 1.103 2024/04/14 15:21:20 rillig Exp $ */ +/* $NetBSD: str.c,v 1.104 2024/07/06 10:36:23 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -71,7 +71,7 @@ #include "make.h" /* "@(#)str.c 5.8 (Berkeley) 6/1/90" */ -MAKE_RCSID("$NetBSD: str.c,v 1.103 2024/04/14 15:21:20 rillig Exp $"); +MAKE_RCSID("$NetBSD: str.c,v 1.104 2024/07/06 10:36:23 rillig Exp $"); static HashTable interned_strings; @@ -356,8 +356,10 @@ match_fixed_length: goto no_match; while (*pat != ']' && *pat != '\0') pat++; - if (*pat == '\0') + if (*pat == '\0') { +res.error = "Unfinished character list"; pat--; + } continue; } Index: src/usr.bin/make/unit-tests/varmod-edge.exp diff -u src/usr.bin/make/unit-tests/varmod-edge.exp:1.24 src/usr.bin/make/unit-tests/varmod-edge.exp:1.25 --- src/usr.bin/make/unit-tests/varmod-edge.exp:1.24 Sat Jul 6 10:14:35 2024 +++ src/usr.bin/make/unit-tests/varmod-edge.exp Sat Jul 6 10:36:23 2024 @@ -1,4 +1,5 @@ make: "varmod-edge.mk" line 60: while evaluating variable "MOD" with value "${INP:M${:U*)}}": while evaluating variable "INP" with value "(parentheses)": while evaluating "${:U*)" with value "*)": Unclosed expression, expecting '}' for modifier "U*)" +make: "varmod-edge.mk" line 88: warning: while evaluating variable "MOD" with value "${INP:M${:U[[}}": while evaluating variable "INP" with value "[ [[ [[[": Unfinished character list in pattern '[[' of modifier ':M' make: "varmod-edge.mk" line 178: while evaluating variable "MOD" with value "${INP:a\=b}": while evaluating variable "INP" with value "file.c file...": Unfinished modifier ('=' missing) make: "varmod-edge.mk" line 194: while evaluating variable "MOD" with value "${INP}": while evaluating variable "INP" with value "value": Unknown modifier ":" make: "varmod-edge.mk" line 194: while evaluating variable "MOD" with value "${INP}": while evaluating variable "INP" with value "": Unknown modifier ":" Index: src/usr.bin/make/unit-tests/varmod-edge.mk diff -u src/usr.bin/make/unit-tests/varmod-edge.mk:1.26 src/usr.bin/make/unit-tests/varmod-edge.mk:1.27 --- src/usr.bin/make/unit-tests/varmod-edge.mk:1.26 Sat Jul 6 10:14:35 2024 +++ src/usr.bin/make/unit-tests/varmod-edge.mk Sat Jul 6 10:36:23 2024 @@ -1,4 +1,4 @@ -# $NetBSD: varmod-edge.mk,v 1.26 2024/07/06 10:14:35 rillig Exp $ +# $NetBSD: varmod-edge.mk,v 1.27 2024/07/06 10:36:23 rillig Exp $ # # Tests for edge cases in variable modifiers. # @@ -77,14 +77,14 @@ EXP= [ # The pattern in the nested variable has an unclosed character class. # No error is reported though, and the pattern is closed implicitly. # -# XXX: It is unexpected that no error is reported. -# See str.c, function Str_Match. +# Before str.c 1.104 from 2024-07-06, no error was reported. # # Before 2019-12-02, this test case triggered an out-of-bounds read # in Str_Match. INP= [ [[ [[[ MOD= ${INP:M${:U[[}} EXP= [ +# expect+1: warning: while evaluating variable "MOD" with value "${INP:M${:U[[}}": while evaluating variable "INP" with value "[ [[ [[[": Unfinished character list in pattern '[[' of modifier ':M' .if ${MOD} != ${EXP} . warning expected "${EXP}", got "${MOD}" .endif
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sat Jul 6 10:14:35 UTC 2024 Modified Files: src/usr.bin/make/unit-tests: deptgt.exp deptgt.mk directive-for-errors.exp directive-for-errors.mk directive-for-escape.exp directive-for-escape.mk directive-for.exp directive-for.mk varmod-edge.exp varmod-edge.mk Log Message: tests/make: clean up tests Prefer "expect+X" directives to be above the code generating them, instead of "expect-X" directives below the code. In varmod-edge.mk, separate the tests, as the common loop does not pull its weight. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/usr.bin/make/unit-tests/deptgt.exp cvs rdiff -u -r1.19 -r1.20 src/usr.bin/make/unit-tests/deptgt.mk cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/directive-for-errors.exp cvs rdiff -u -r1.12 -r1.13 \ src/usr.bin/make/unit-tests/directive-for-errors.mk cvs rdiff -u -r1.28 -r1.29 \ src/usr.bin/make/unit-tests/directive-for-escape.exp cvs rdiff -u -r1.26 -r1.27 \ src/usr.bin/make/unit-tests/directive-for-escape.mk \ src/usr.bin/make/unit-tests/directive-for.mk cvs rdiff -u -r1.24 -r1.25 src/usr.bin/make/unit-tests/directive-for.exp cvs rdiff -u -r1.23 -r1.24 src/usr.bin/make/unit-tests/varmod-edge.exp cvs rdiff -u -r1.25 -r1.26 src/usr.bin/make/unit-tests/varmod-edge.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/unit-tests/deptgt.exp diff -u src/usr.bin/make/unit-tests/deptgt.exp:1.16 src/usr.bin/make/unit-tests/deptgt.exp:1.17 --- src/usr.bin/make/unit-tests/deptgt.exp:1.16 Fri Jul 5 20:01:52 2024 +++ src/usr.bin/make/unit-tests/deptgt.exp Sat Jul 6 10:14:35 2024 @@ -8,6 +8,7 @@ ParseDependency(: empty-source) Parsing line 39: : command for empty targets list Parsing line 40: .MAKEFLAGS: -d0 ParseDependency(.MAKEFLAGS: -d0) +make: "deptgt.mk" line 45: while evaluating "${:U:Z}:" with value "": Unknown modifier "Z" make: "deptgt.mk" line 49: while parsing "${:U:Z}:": Unknown modifier "Z" make: "deptgt.mk" line 52: warning: Extra target 'ordinary' ignored make: "deptgt.mk" line 55: warning: Extra target (ordinary) ignored Index: src/usr.bin/make/unit-tests/deptgt.mk diff -u src/usr.bin/make/unit-tests/deptgt.mk:1.19 src/usr.bin/make/unit-tests/deptgt.mk:1.20 --- src/usr.bin/make/unit-tests/deptgt.mk:1.19 Fri Jul 5 20:01:52 2024 +++ src/usr.bin/make/unit-tests/deptgt.mk Sat Jul 6 10:14:35 2024 @@ -1,4 +1,4 @@ -# $NetBSD: deptgt.mk,v 1.19 2024/07/05 20:01:52 rillig Exp $ +# $NetBSD: deptgt.mk,v 1.20 2024/07/06 10:14:35 rillig Exp $ # # Tests for special targets like .BEGIN or .SUFFIXES in dependency # declarations. @@ -39,14 +39,14 @@ ${:U}: empty-source : command for empty targets list .MAKEFLAGS: -d0 -# Just to show that a malformed expression is only expanded once in -# ParseDependencyTargetWord. The only way to produce an expression that -# is well-formed on the first expansion and ill-formed on the second -# expansion would be to use the variable modifier '::=' to modify the -# targets. This in turn would be such an extreme and unreliable edge case -# that nobody uses it. +# In a dependency declaration, the whole line is expanded before interpreting +# the line. +# expect+1: while evaluating "${:U:Z}:" with value "": Unknown modifier "Z" +${:U:Z}: +# After expanding the line as a whole, each target is parsed but not +# evaluated, separately, in ParseDependencyTargetWord. # expect+1: while parsing "${:U:Z}:": Unknown modifier "Z" -{:U:Z}: +$${:U:Z}: # expect+1: warning: Extra target 'ordinary' ignored .END ordinary: @@ -56,6 +56,3 @@ {:U:Z}: # expect+1: warning: Special and mundane targets don't mix. Mundane ones ignored ordinary .PATH: - -all: - @:; Index: src/usr.bin/make/unit-tests/directive-for-errors.exp diff -u src/usr.bin/make/unit-tests/directive-for-errors.exp:1.7 src/usr.bin/make/unit-tests/directive-for-errors.exp:1.8 --- src/usr.bin/make/unit-tests/directive-for-errors.exp:1.7 Fri Jul 5 19:47:22 2024 +++ src/usr.bin/make/unit-tests/directive-for-errors.exp Sat Jul 6 10:14:35 2024 @@ -1,17 +1,17 @@ make: "directive-for-errors.mk" line 9: Unknown directive "fori" -make: "directive-for-errors.mk" line 10: warning: <> -make: "directive-for-errors.mk" line 11: for-less endfor +make: "directive-for-errors.mk" line 11: warning: <> +make: "directive-for-errors.mk" line 13: for-less endfor make: "directive-for-errors.mk" line 25: Unknown directive "for" -make: "directive-for-errors.mk" line 26: warning: <> -make: "directive-for-errors.mk" line 27: for-less endfor +make: "directive-for-errors.mk" line 27: warning: <> +make: "directive-for-errors.mk" line 29: for-less endfor make: "directive-for-errors.mk" line 44: invalid character '$' in .for loop variable name make: "directive-for-errors.mk" line 52: no iteration variables in for make:
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sat Jul 6 10:14:35 UTC 2024 Modified Files: src/usr.bin/make/unit-tests: deptgt.exp deptgt.mk directive-for-errors.exp directive-for-errors.mk directive-for-escape.exp directive-for-escape.mk directive-for.exp directive-for.mk varmod-edge.exp varmod-edge.mk Log Message: tests/make: clean up tests Prefer "expect+X" directives to be above the code generating them, instead of "expect-X" directives below the code. In varmod-edge.mk, separate the tests, as the common loop does not pull its weight. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/usr.bin/make/unit-tests/deptgt.exp cvs rdiff -u -r1.19 -r1.20 src/usr.bin/make/unit-tests/deptgt.mk cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/directive-for-errors.exp cvs rdiff -u -r1.12 -r1.13 \ src/usr.bin/make/unit-tests/directive-for-errors.mk cvs rdiff -u -r1.28 -r1.29 \ src/usr.bin/make/unit-tests/directive-for-escape.exp cvs rdiff -u -r1.26 -r1.27 \ src/usr.bin/make/unit-tests/directive-for-escape.mk \ src/usr.bin/make/unit-tests/directive-for.mk cvs rdiff -u -r1.24 -r1.25 src/usr.bin/make/unit-tests/directive-for.exp cvs rdiff -u -r1.23 -r1.24 src/usr.bin/make/unit-tests/varmod-edge.exp cvs rdiff -u -r1.25 -r1.26 src/usr.bin/make/unit-tests/varmod-edge.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Fri Jul 5 20:01:53 UTC 2024 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: deptgt.exp deptgt.mk var-eval-short.exp var-eval-short.mk varmod-ifelse.exp varmod-ifelse.mk Log Message: make: in error messages, distinguish parsing from evaluating To generate a diff of this commit: cvs rdiff -u -r1.1132 -r1.1133 src/usr.bin/make/var.c cvs rdiff -u -r1.15 -r1.16 src/usr.bin/make/unit-tests/deptgt.exp cvs rdiff -u -r1.18 -r1.19 src/usr.bin/make/unit-tests/deptgt.mk cvs rdiff -u -r1.28 -r1.29 src/usr.bin/make/unit-tests/var-eval-short.exp cvs rdiff -u -r1.13 -r1.14 src/usr.bin/make/unit-tests/var-eval-short.mk cvs rdiff -u -r1.22 -r1.23 src/usr.bin/make/unit-tests/varmod-ifelse.exp cvs rdiff -u -r1.31 -r1.32 src/usr.bin/make/unit-tests/varmod-ifelse.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Fri Jul 5 19:47:22 UTC 2024 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: cond-token-string.exp cond-token-string.mk deptgt.exp deptgt.mk directive-for-errors.exp directive-for-errors.mk directive-for-escape.exp directive-for-escape.mk directive-for.exp directive-for.mk directive-include.exp directive-include.mk moderrs.exp moderrs.mk var-eval-short.exp var-eval-short.mk vardebug.exp vardebug.mk varmod-assign.exp varmod-edge.exp varmod-edge.mk varmod-gmtime.exp varmod-gmtime.mk varmod-ifelse.exp varmod-ifelse.mk varmod-localtime.exp varmod-localtime.mk varmod-loop-delete.exp varmod-loop-delete.mk varmod-loop-varname.exp varmod-loop-varname.mk varmod-match-escape.exp varmod-match-escape.mk varmod-range.exp varmod-range.mk varmod-shell.exp varmod-shell.mk varmod-subst-regex.exp varmod-subst.exp varmod-to-separator.exp varmod-to-separator.mk varmod.exp varmod.mk varparse-errors.exp varparse-errors.mk Log Message: make: in error messages for anonymous variables, log the value To generate a diff of this commit: cvs rdiff -u -r1.1131 -r1.1132 src/usr.bin/make/var.c cvs rdiff -u -r1.13 -r1.14 src/usr.bin/make/unit-tests/cond-token-string.exp \ src/usr.bin/make/unit-tests/directive-include.exp \ src/usr.bin/make/unit-tests/varparse-errors.exp cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/cond-token-string.mk \ src/usr.bin/make/unit-tests/vardebug.mk cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/unit-tests/deptgt.exp \ src/usr.bin/make/unit-tests/directive-include.mk \ src/usr.bin/make/unit-tests/varmod-range.exp \ src/usr.bin/make/unit-tests/varmod.exp cvs rdiff -u -r1.17 -r1.18 src/usr.bin/make/unit-tests/deptgt.mk \ src/usr.bin/make/unit-tests/varmod-to-separator.mk \ src/usr.bin/make/unit-tests/varmod.mk cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/directive-for-errors.exp \ src/usr.bin/make/unit-tests/varmod-loop-delete.exp cvs rdiff -u -r1.11 -r1.12 \ src/usr.bin/make/unit-tests/directive-for-errors.mk cvs rdiff -u -r1.27 -r1.28 \ src/usr.bin/make/unit-tests/directive-for-escape.exp \ src/usr.bin/make/unit-tests/var-eval-short.exp cvs rdiff -u -r1.25 -r1.26 \ src/usr.bin/make/unit-tests/directive-for-escape.mk \ src/usr.bin/make/unit-tests/directive-for.mk \ src/usr.bin/make/unit-tests/varmod-assign.exp cvs rdiff -u -r1.23 -r1.24 src/usr.bin/make/unit-tests/directive-for.exp \ src/usr.bin/make/unit-tests/varmod-gmtime.mk cvs rdiff -u -r1.40 -r1.41 src/usr.bin/make/unit-tests/moderrs.exp cvs rdiff -u -r1.37 -r1.38 src/usr.bin/make/unit-tests/moderrs.mk cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/var-eval-short.mk \ src/usr.bin/make/unit-tests/varmod-range.mk cvs rdiff -u -r1.35 -r1.36 src/usr.bin/make/unit-tests/vardebug.exp cvs rdiff -u -r1.22 -r1.23 src/usr.bin/make/unit-tests/varmod-edge.exp \ src/usr.bin/make/unit-tests/varmod-match-escape.exp cvs rdiff -u -r1.24 -r1.25 src/usr.bin/make/unit-tests/varmod-edge.mk cvs rdiff -u -r1.19 -r1.20 src/usr.bin/make/unit-tests/varmod-gmtime.exp cvs rdiff -u -r1.21 -r1.22 src/usr.bin/make/unit-tests/varmod-ifelse.exp cvs rdiff -u -r1.30 -r1.31 src/usr.bin/make/unit-tests/varmod-ifelse.mk cvs rdiff -u -r1.16 -r1.17 src/usr.bin/make/unit-tests/varmod-localtime.exp \ src/usr.bin/make/unit-tests/varmod-localtime.mk \ src/usr.bin/make/unit-tests/varparse-errors.mk cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/varmod-loop-delete.mk \ src/usr.bin/make/unit-tests/varmod-subst.exp cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/varmod-loop-varname.exp \ src/usr.bin/make/unit-tests/varmod-shell.mk \ src/usr.bin/make/unit-tests/varmod-subst-regex.exp cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/varmod-loop-varname.mk cvs rdiff -u -r1.15 -r1.16 src/usr.bin/make/unit-tests/varmod-match-escape.mk \ src/usr.bin/make/unit-tests/varmod-to-separator.exp cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/varmod-shell.exp 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.1131 src/usr.bin/make/var.c:1.1132 --- src/usr.bin/make/var.c:1.1131 Fri Jul 5 18:59:33 2024 +++ src/usr.bin/make/var.c Fri Jul 5 19:47:22 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.1131 2024/07/05 18:59:33 rillig Exp $ */ +/* $NetBSD: var.c,v 1.1132 2024/07/05 19:47:22 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -132,7 +132,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.1131 2024/07/05 18:59:33 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.1132 2024/07/05 19:47:22 rillig Exp $"); /*
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Fri Jul 5 19:47:22 UTC 2024 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: cond-token-string.exp cond-token-string.mk deptgt.exp deptgt.mk directive-for-errors.exp directive-for-errors.mk directive-for-escape.exp directive-for-escape.mk directive-for.exp directive-for.mk directive-include.exp directive-include.mk moderrs.exp moderrs.mk var-eval-short.exp var-eval-short.mk vardebug.exp vardebug.mk varmod-assign.exp varmod-edge.exp varmod-edge.mk varmod-gmtime.exp varmod-gmtime.mk varmod-ifelse.exp varmod-ifelse.mk varmod-localtime.exp varmod-localtime.mk varmod-loop-delete.exp varmod-loop-delete.mk varmod-loop-varname.exp varmod-loop-varname.mk varmod-match-escape.exp varmod-match-escape.mk varmod-range.exp varmod-range.mk varmod-shell.exp varmod-shell.mk varmod-subst-regex.exp varmod-subst.exp varmod-to-separator.exp varmod-to-separator.mk varmod.exp varmod.mk varparse-errors.exp varparse-errors.mk Log Message: make: in error messages for anonymous variables, log the value To generate a diff of this commit: cvs rdiff -u -r1.1131 -r1.1132 src/usr.bin/make/var.c cvs rdiff -u -r1.13 -r1.14 src/usr.bin/make/unit-tests/cond-token-string.exp \ src/usr.bin/make/unit-tests/directive-include.exp \ src/usr.bin/make/unit-tests/varparse-errors.exp cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/cond-token-string.mk \ src/usr.bin/make/unit-tests/vardebug.mk cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/unit-tests/deptgt.exp \ src/usr.bin/make/unit-tests/directive-include.mk \ src/usr.bin/make/unit-tests/varmod-range.exp \ src/usr.bin/make/unit-tests/varmod.exp cvs rdiff -u -r1.17 -r1.18 src/usr.bin/make/unit-tests/deptgt.mk \ src/usr.bin/make/unit-tests/varmod-to-separator.mk \ src/usr.bin/make/unit-tests/varmod.mk cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/directive-for-errors.exp \ src/usr.bin/make/unit-tests/varmod-loop-delete.exp cvs rdiff -u -r1.11 -r1.12 \ src/usr.bin/make/unit-tests/directive-for-errors.mk cvs rdiff -u -r1.27 -r1.28 \ src/usr.bin/make/unit-tests/directive-for-escape.exp \ src/usr.bin/make/unit-tests/var-eval-short.exp cvs rdiff -u -r1.25 -r1.26 \ src/usr.bin/make/unit-tests/directive-for-escape.mk \ src/usr.bin/make/unit-tests/directive-for.mk \ src/usr.bin/make/unit-tests/varmod-assign.exp cvs rdiff -u -r1.23 -r1.24 src/usr.bin/make/unit-tests/directive-for.exp \ src/usr.bin/make/unit-tests/varmod-gmtime.mk cvs rdiff -u -r1.40 -r1.41 src/usr.bin/make/unit-tests/moderrs.exp cvs rdiff -u -r1.37 -r1.38 src/usr.bin/make/unit-tests/moderrs.mk cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/var-eval-short.mk \ src/usr.bin/make/unit-tests/varmod-range.mk cvs rdiff -u -r1.35 -r1.36 src/usr.bin/make/unit-tests/vardebug.exp cvs rdiff -u -r1.22 -r1.23 src/usr.bin/make/unit-tests/varmod-edge.exp \ src/usr.bin/make/unit-tests/varmod-match-escape.exp cvs rdiff -u -r1.24 -r1.25 src/usr.bin/make/unit-tests/varmod-edge.mk cvs rdiff -u -r1.19 -r1.20 src/usr.bin/make/unit-tests/varmod-gmtime.exp cvs rdiff -u -r1.21 -r1.22 src/usr.bin/make/unit-tests/varmod-ifelse.exp cvs rdiff -u -r1.30 -r1.31 src/usr.bin/make/unit-tests/varmod-ifelse.mk cvs rdiff -u -r1.16 -r1.17 src/usr.bin/make/unit-tests/varmod-localtime.exp \ src/usr.bin/make/unit-tests/varmod-localtime.mk \ src/usr.bin/make/unit-tests/varparse-errors.mk cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/varmod-loop-delete.mk \ src/usr.bin/make/unit-tests/varmod-subst.exp cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/varmod-loop-varname.exp \ src/usr.bin/make/unit-tests/varmod-shell.mk \ src/usr.bin/make/unit-tests/varmod-subst-regex.exp cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/varmod-loop-varname.mk cvs rdiff -u -r1.15 -r1.16 src/usr.bin/make/unit-tests/varmod-match-escape.mk \ src/usr.bin/make/unit-tests/varmod-to-separator.exp cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/varmod-shell.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Fri Jul 5 18:59:33 UTC 2024 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: cmd-errors-jobs.exp cmd-errors-jobs.mk cmd-errors-lint.exp cmd-errors-lint.mk cmd-errors.exp cmd-errors.mk directive-for-escape.exp directive-for-escape.mk moderrs.exp moderrs.mk varmisc.exp varmisc.mk varmod-edge.exp varmod-edge.mk varmod-order.exp varmod-order.mk varparse-errors.exp varparse-errors.mk Log Message: make: error out on unclosed expressions during parse time In exchange, this adds location information. For unnamed expressions, the value is no longer printed. This will be added back in a follow-up commit. To generate a diff of this commit: cvs rdiff -u -r1.1130 -r1.1131 src/usr.bin/make/var.c cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/cmd-errors-jobs.exp \ src/usr.bin/make/unit-tests/cmd-errors-lint.exp \ src/usr.bin/make/unit-tests/cmd-errors.mk cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/cmd-errors-jobs.mk cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/cmd-errors-lint.mk cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/cmd-errors.exp cvs rdiff -u -r1.26 -r1.27 \ src/usr.bin/make/unit-tests/directive-for-escape.exp cvs rdiff -u -r1.24 -r1.25 \ src/usr.bin/make/unit-tests/directive-for-escape.mk cvs rdiff -u -r1.39 -r1.40 src/usr.bin/make/unit-tests/moderrs.exp cvs rdiff -u -r1.36 -r1.37 src/usr.bin/make/unit-tests/moderrs.mk cvs rdiff -u -r1.21 -r1.22 src/usr.bin/make/unit-tests/varmisc.exp \ src/usr.bin/make/unit-tests/varmod-edge.exp cvs rdiff -u -r1.34 -r1.35 src/usr.bin/make/unit-tests/varmisc.mk cvs rdiff -u -r1.23 -r1.24 src/usr.bin/make/unit-tests/varmod-edge.mk cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/varmod-order.exp \ src/usr.bin/make/unit-tests/varparse-errors.exp cvs rdiff -u -r1.13 -r1.14 src/usr.bin/make/unit-tests/varmod-order.mk cvs rdiff -u -r1.15 -r1.16 src/usr.bin/make/unit-tests/varparse-errors.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.1130 src/usr.bin/make/var.c:1.1131 --- src/usr.bin/make/var.c:1.1130 Fri Jul 5 05:11:25 2024 +++ src/usr.bin/make/var.c Fri Jul 5 18:59:33 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.1130 2024/07/05 05:11:25 rillig Exp $ */ +/* $NetBSD: var.c,v 1.1131 2024/07/05 18:59:33 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -132,7 +132,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.1130 2024/07/05 05:11:25 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.1131 2024/07/05 18:59:33 rillig Exp $"); /* * Variables are defined using one of the VAR=value assignments. Their @@ -3964,9 +3964,10 @@ ApplyModifiersIndirect(ModChain *ch, con if (*p == ':') p++; else if (*p == '\0' && ch->endc != '\0') { - Error("Unclosed expression after indirect modifier, " - "expecting '%c' for variable \"%s\"", - ch->endc, expr->name); + Parse_Error(PARSE_FATAL, + "Unclosed expression after indirect modifier, " + "expecting '%c'", + ch->endc); *pp = p; return AMIR_OUT; } @@ -4014,12 +4015,10 @@ ApplySingleModifier(const char **pp, Mod LogAfterApply(ch, p, mod); if (*p == '\0' && ch->endc != '\0') { - Error( + Parse_Error(PARSE_FATAL, "Unclosed expression, expecting '%c' for " - "modifier \"%.*s\" of variable \"%s\" with value \"%s\"", - ch->endc, - (int)(p - mod), mod, - ch->expr->name, Expr_Str(ch->expr)); + "modifier \"%.*s\"", + ch->endc, (int)(p - mod), mod); } else if (*p == ':') { p++; } else if (opts.strict && *p != '\0' && *p != ch->endc) { @@ -4072,9 +4071,8 @@ ApplyModifiers( p = *pp; if (*p == '\0' && endc != '\0') { - Error( - "Unclosed expression, expecting '%c' for \"%s\"", - ch.endc, expr->name); + Parse_Error(PARSE_FATAL, + "Unclosed expression, expecting '%c'", ch.endc); goto cleanup; } Index: src/usr.bin/make/unit-tests/cmd-errors-jobs.exp diff -u src/usr.bin/make/unit-tests/cmd-errors-jobs.exp:1.7 src/usr.bin/make/unit-tests/cmd-errors-jobs.exp:1.8 --- src/usr.bin/make/unit-tests/cmd-errors-jobs.exp:1.7 Thu Jul 4 17:47:54 2024 +++ src/usr.bin/make/unit-tests/cmd-errors-jobs.exp Fri Jul 5 18:59:33 2024 @@ -1,7 +1,7 @@ : undefined--eol make: in target "unclosed-expression": Unclosed variable "UNCLOSED" : unclosed-expression- -make: Unclosed expression, expecting '}' for "UNCLOSED" +make: in target "unclosed-modifier": while evaluating variable "UNCLOSED" with value "": Unclosed expression, expecting '}' : unclosed-modifier- make: in target "unknown-modifier": while evaluating variable "UNKNOWN" with value "": Unknown modifier "Z" : unknown-modifier--eol Index:
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Fri Jul 5 18:59:33 UTC 2024 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: cmd-errors-jobs.exp cmd-errors-jobs.mk cmd-errors-lint.exp cmd-errors-lint.mk cmd-errors.exp cmd-errors.mk directive-for-escape.exp directive-for-escape.mk moderrs.exp moderrs.mk varmisc.exp varmisc.mk varmod-edge.exp varmod-edge.mk varmod-order.exp varmod-order.mk varparse-errors.exp varparse-errors.mk Log Message: make: error out on unclosed expressions during parse time In exchange, this adds location information. For unnamed expressions, the value is no longer printed. This will be added back in a follow-up commit. To generate a diff of this commit: cvs rdiff -u -r1.1130 -r1.1131 src/usr.bin/make/var.c cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/cmd-errors-jobs.exp \ src/usr.bin/make/unit-tests/cmd-errors-lint.exp \ src/usr.bin/make/unit-tests/cmd-errors.mk cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/cmd-errors-jobs.mk cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/cmd-errors-lint.mk cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/cmd-errors.exp cvs rdiff -u -r1.26 -r1.27 \ src/usr.bin/make/unit-tests/directive-for-escape.exp cvs rdiff -u -r1.24 -r1.25 \ src/usr.bin/make/unit-tests/directive-for-escape.mk cvs rdiff -u -r1.39 -r1.40 src/usr.bin/make/unit-tests/moderrs.exp cvs rdiff -u -r1.36 -r1.37 src/usr.bin/make/unit-tests/moderrs.mk cvs rdiff -u -r1.21 -r1.22 src/usr.bin/make/unit-tests/varmisc.exp \ src/usr.bin/make/unit-tests/varmod-edge.exp cvs rdiff -u -r1.34 -r1.35 src/usr.bin/make/unit-tests/varmisc.mk cvs rdiff -u -r1.23 -r1.24 src/usr.bin/make/unit-tests/varmod-edge.mk cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/varmod-order.exp \ src/usr.bin/make/unit-tests/varparse-errors.exp cvs rdiff -u -r1.13 -r1.14 src/usr.bin/make/unit-tests/varmod-order.mk cvs rdiff -u -r1.15 -r1.16 src/usr.bin/make/unit-tests/varparse-errors.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Fri Jul 5 17:41:50 UTC 2024 Modified Files: src/usr.bin/make/unit-tests: cmd-errors-jobs.mk cmd-errors-lint.mk cmd-errors.mk directive-for-escape.exp directive-for-escape.mk moderrs.mk varmisc.mk varmod-edge.exp varmod-edge.mk varmod-order.exp varmod-order.mk varparse-errors.mk Log Message: tests/make: add expected messages for "Unclosed expression" To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/cmd-errors-jobs.mk cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/cmd-errors-lint.mk cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/cmd-errors.mk cvs rdiff -u -r1.25 -r1.26 \ src/usr.bin/make/unit-tests/directive-for-escape.exp cvs rdiff -u -r1.23 -r1.24 \ src/usr.bin/make/unit-tests/directive-for-escape.mk cvs rdiff -u -r1.35 -r1.36 src/usr.bin/make/unit-tests/moderrs.mk cvs rdiff -u -r1.33 -r1.34 src/usr.bin/make/unit-tests/varmisc.mk cvs rdiff -u -r1.20 -r1.21 src/usr.bin/make/unit-tests/varmod-edge.exp cvs rdiff -u -r1.22 -r1.23 src/usr.bin/make/unit-tests/varmod-edge.mk cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/varmod-order.exp cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/varmod-order.mk cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/unit-tests/varparse-errors.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/unit-tests/cmd-errors-jobs.mk diff -u src/usr.bin/make/unit-tests/cmd-errors-jobs.mk:1.5 src/usr.bin/make/unit-tests/cmd-errors-jobs.mk:1.6 --- src/usr.bin/make/unit-tests/cmd-errors-jobs.mk:1.5 Thu Jul 4 17:47:54 2024 +++ src/usr.bin/make/unit-tests/cmd-errors-jobs.mk Fri Jul 5 17:41:50 2024 @@ -1,4 +1,4 @@ -# $NetBSD: cmd-errors-jobs.mk,v 1.5 2024/07/04 17:47:54 rillig Exp $ +# $NetBSD: cmd-errors-jobs.mk,v 1.6 2024/07/05 17:41:50 rillig Exp $ # # Demonstrate how errors in expressions affect whether the commands # are actually executed in jobs mode. @@ -13,22 +13,22 @@ all: undefined unclosed-expression unclo undefined: : $@-${UNDEFINED}-eol -# XXX: This command is executed even though it contains parse errors. +unclosed-expression: # expect: make: in target "unclosed-expression": Unclosed variable "UNCLOSED" +# XXX: This command is executed even though it contains parse errors. # expect: : unclosed-expression- -unclosed-expression: : $@-${UNCLOSED -# XXX: This command is executed even though it contains parse errors. +unclosed-modifier: # expect: make: Unclosed expression, expecting '}' for "UNCLOSED" +# XXX: This command is executed even though it contains parse errors. # expect: : unclosed-modifier- -unclosed-modifier: : $@-${UNCLOSED: -# XXX: This command is executed even though it contains parse errors. +unknown-modifier: # expect: make: in target "unknown-modifier": while evaluating variable "UNKNOWN" with value "": Unknown modifier "Z" +# XXX: This command is executed even though it contains parse errors. # expect: : unknown-modifier--eol -unknown-modifier: : $@-${UNKNOWN:Z}-eol # expect: : end-eol Index: src/usr.bin/make/unit-tests/cmd-errors-lint.mk diff -u src/usr.bin/make/unit-tests/cmd-errors-lint.mk:1.2 src/usr.bin/make/unit-tests/cmd-errors-lint.mk:1.3 --- src/usr.bin/make/unit-tests/cmd-errors-lint.mk:1.2 Tue Apr 23 22:51:28 2024 +++ src/usr.bin/make/unit-tests/cmd-errors-lint.mk Fri Jul 5 17:41:50 2024 @@ -1,4 +1,4 @@ -# $NetBSD: cmd-errors-lint.mk,v 1.2 2024/04/23 22:51:28 rillig Exp $ +# $NetBSD: cmd-errors-lint.mk,v 1.3 2024/07/05 17:41:50 rillig Exp $ # # Demonstrate how errors in expressions affect whether the commands # are actually executed. @@ -10,24 +10,29 @@ all: undefined unclosed-expression unclo # Undefined variables in expressions are not an error. They expand to empty # strings. undefined: +# expect: : undefined : $@ ${UNDEFINED} -# XXX: As of 2020-11-01, this obvious syntax error is not detected. -# XXX: As of 2020-11-01, this command is executed even though it contains -# parse errors. unclosed-expression: +# expect: make: in target "unclosed-expression": Unclosed variable "UNCLOSED" +# XXX: This command is executed even though it contains parse errors. +# expect: : unclosed-expression : $@ ${UNCLOSED -# XXX: As of 2020-11-01, this obvious syntax error is not detected. -# XXX: As of 2020-11-01, this command is executed even though it contains -# parse errors. unclosed-modifier: +# expect: make: Unclosed expression, expecting '}' for "UNCLOSED" +# XXX: This command is executed even though it contains parse errors. +# expect: : unclosed-modifier : $@ ${UNCLOSED: -# XXX: As of 2020-11-01, this command is executed even though it contains -# parse errors. unknown-modifier: +# expect: make: in target "unknown-modifier": while evaluating variable "UNKNOWN" with value "": Unknown modifier "Z" +# XXX: This command is executed even
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Fri Jul 5 17:41:50 UTC 2024 Modified Files: src/usr.bin/make/unit-tests: cmd-errors-jobs.mk cmd-errors-lint.mk cmd-errors.mk directive-for-escape.exp directive-for-escape.mk moderrs.mk varmisc.mk varmod-edge.exp varmod-edge.mk varmod-order.exp varmod-order.mk varparse-errors.mk Log Message: tests/make: add expected messages for "Unclosed expression" To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/cmd-errors-jobs.mk cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/cmd-errors-lint.mk cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/cmd-errors.mk cvs rdiff -u -r1.25 -r1.26 \ src/usr.bin/make/unit-tests/directive-for-escape.exp cvs rdiff -u -r1.23 -r1.24 \ src/usr.bin/make/unit-tests/directive-for-escape.mk cvs rdiff -u -r1.35 -r1.36 src/usr.bin/make/unit-tests/moderrs.mk cvs rdiff -u -r1.33 -r1.34 src/usr.bin/make/unit-tests/varmisc.mk cvs rdiff -u -r1.20 -r1.21 src/usr.bin/make/unit-tests/varmod-edge.exp cvs rdiff -u -r1.22 -r1.23 src/usr.bin/make/unit-tests/varmod-edge.mk cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/varmod-order.exp cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/varmod-order.mk cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/unit-tests/varparse-errors.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Fri Jul 5 05:11:25 UTC 2024 Modified Files: src/usr.bin/make: arch.c job.c main.c make.h suff.c var.c Log Message: make: reduce lint-specific comments about ARGSUSED To generate a diff of this commit: cvs rdiff -u -r1.219 -r1.220 src/usr.bin/make/arch.c cvs rdiff -u -r1.478 -r1.479 src/usr.bin/make/job.c cvs rdiff -u -r1.626 -r1.627 src/usr.bin/make/main.c cvs rdiff -u -r1.339 -r1.340 src/usr.bin/make/make.h cvs rdiff -u -r1.380 -r1.381 src/usr.bin/make/suff.c cvs rdiff -u -r1.1129 -r1.1130 src/usr.bin/make/var.c 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/arch.c diff -u src/usr.bin/make/arch.c:1.219 src/usr.bin/make/arch.c:1.220 --- src/usr.bin/make/arch.c:1.219 Sun Jun 2 15:31:25 2024 +++ src/usr.bin/make/arch.c Fri Jul 5 05:11:25 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: arch.c,v 1.219 2024/06/02 15:31:25 rillig Exp $ */ +/* $NetBSD: arch.c,v 1.220 2024/07/05 05:11:25 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -126,7 +126,7 @@ #include "config.h" /* "@(#)arch.c 8.2 (Berkeley) 1/2/94" */ -MAKE_RCSID("$NetBSD: arch.c,v 1.219 2024/06/02 15:31:25 rillig Exp $"); +MAKE_RCSID("$NetBSD: arch.c,v 1.220 2024/07/05 05:11:25 rillig Exp $"); typedef struct List ArchList; typedef struct ListNode ArchListNode; @@ -770,7 +770,6 @@ Arch_Touch(GNode *gn) * Both the modification time of the library and of the RANLIBMAG member are * set to 'now'. */ -/*ARGSUSED*/ void Arch_TouchLib(GNode *gn MAKE_ATTR_UNUSED) { @@ -871,7 +870,6 @@ Arch_FindLib(GNode *gn, SearchPath *path Var_Set(gn, TARGET, gn->name); } -/* ARGSUSED */ static bool RanlibOODate(const GNode *gn MAKE_ATTR_UNUSED) { Index: src/usr.bin/make/job.c diff -u src/usr.bin/make/job.c:1.478 src/usr.bin/make/job.c:1.479 --- src/usr.bin/make/job.c:1.478 Fri Jun 28 15:20:57 2024 +++ src/usr.bin/make/job.c Fri Jul 5 05:11:25 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.478 2024/06/28 15:20:57 rillig Exp $ */ +/* $NetBSD: job.c,v 1.479 2024/07/05 05:11:25 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -141,7 +141,7 @@ #include "trace.h" /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: job.c,v 1.478 2024/06/28 15:20:57 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.479 2024/07/05 05:11:25 rillig Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -594,7 +594,6 @@ JobCondPassSig(int signo) * * Sends a token on the child exit pipe to wake us up from select()/poll(). */ -/*ARGSUSED*/ static void JobChildSig(int signo MAKE_ATTR_UNUSED) { @@ -606,7 +605,6 @@ JobChildSig(int signo MAKE_ATTR_UNUSED) /* Resume all stopped jobs. */ -/*ARGSUSED*/ static void JobContinueSig(int signo MAKE_ATTR_UNUSED) { Index: src/usr.bin/make/main.c diff -u src/usr.bin/make/main.c:1.626 src/usr.bin/make/main.c:1.627 --- src/usr.bin/make/main.c:1.626 Thu Jul 4 20:18:40 2024 +++ src/usr.bin/make/main.c Fri Jul 5 05:11:25 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.626 2024/07/04 20:18:40 rillig Exp $ */ +/* $NetBSD: main.c,v 1.627 2024/07/05 05:11:25 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -111,7 +111,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.626 2024/07/04 20:18:40 rillig Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.627 2024/07/05 05:11:25 rillig Exp $"); #if defined(MAKE_NATIVE) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -789,7 +789,6 @@ AppendWords(StringList *lp, char *str) } #ifdef SIGINFO -/*ARGSUSED*/ static void siginfo(int signo MAKE_ATTR_UNUSED) { Index: src/usr.bin/make/make.h diff -u src/usr.bin/make/make.h:1.339 src/usr.bin/make/make.h:1.340 --- src/usr.bin/make/make.h:1.339 Sat Jun 15 20:02:45 2024 +++ src/usr.bin/make/make.h Fri Jul 5 05:11:25 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: make.h,v 1.339 2024/06/15 20:02:45 rillig Exp $ */ +/* $NetBSD: make.h,v 1.340 2024/07/05 05:11:25 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -109,7 +109,7 @@ #define MAKE_GNUC_PREREQ(x, y) 0 #endif -#if MAKE_GNUC_PREREQ(2, 7) +#if MAKE_GNUC_PREREQ(2, 7) || lint #define MAKE_ATTR_UNUSED __attribute__((__unused__)) #else #define MAKE_ATTR_UNUSED /* delete */ @@ -918,7 +918,6 @@ const char *GNodeMade_Name(GNodeMade) MA #ifdef CLEANUP void Parse_RegisterCommand(char *); #else -/* ARGSUSED */ MAKE_INLINE void Parse_RegisterCommand(char *cmd MAKE_ATTR_UNUSED) { Index: src/usr.bin/make/suff.c diff -u src/usr.bin/make/suff.c:1.380 src/usr.bin/make/suff.c:1.381 --- src/usr.bin/make/suff.c:1.380 Sun Jun 2 15:31:26 2024 +++ src/usr.bin/make/suff.c Fri Jul 5 05:11:25 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.380 2024/06/02 15:31:26 rillig Exp $ */ +/* $NetBSD:
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Fri Jul 5 05:11:25 UTC 2024 Modified Files: src/usr.bin/make: arch.c job.c main.c make.h suff.c var.c Log Message: make: reduce lint-specific comments about ARGSUSED To generate a diff of this commit: cvs rdiff -u -r1.219 -r1.220 src/usr.bin/make/arch.c cvs rdiff -u -r1.478 -r1.479 src/usr.bin/make/job.c cvs rdiff -u -r1.626 -r1.627 src/usr.bin/make/main.c cvs rdiff -u -r1.339 -r1.340 src/usr.bin/make/make.h cvs rdiff -u -r1.380 -r1.381 src/usr.bin/make/suff.c cvs rdiff -u -r1.1129 -r1.1130 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Thu Jul 4 20:18:40 UTC 2024 Modified Files: src/usr.bin/make: main.c src/usr.bin/make/unit-tests: Makefile compat-error.exp cond-cmp-numeric.exp cond-func-defined.exp cond-late.exp cond-op-not.exp cond-op-parentheses.exp cond-op.exp cond-short.exp cond-token-number.exp cond-token-string.exp dep-percent.exp dep.exp depsrc-ignore.exp deptgt-begin-fail-indirect.exp deptgt-begin-fail.exp deptgt-delete_on_error.exp deptgt-end-fail-all.exp deptgt-end-fail-indirect.exp deptgt-end-fail.exp deptgt-error.exp deptgt-ignore.exp deptgt-path-suffix.exp deptgt.exp directive-dinclude.exp directive-elif.exp directive-else.exp directive-for-generating-endif.exp directive-for-if.exp directive-for-null.exp directive-hyphen-include.exp directive-ifmake.exp directive-include-fatal.exp directive-include.exp directive-info.exp directive-sinclude.exp directive-undef.exp directive-unexport-env.exp directive-warning.exp directive.exp doterror.exp jobs-empty-commands-error.exp jobs-error-indirect.exp jobs-error-nested-make.exp jobs-error-nested.exp opt-debug-errors-jobs.exp opt-debug-errors.exp opt-debug-graph2.exp opt-debug-graph3.exp opt-file.exp opt-keep-going-indirect.exp opt-keep-going-multiple.exp opt-keep-going.exp opt-warnings-as-errors.exp opt.exp parse.exp posix.exp sh-jobs.exp suff-add-later.exp suff-clear-regular.exp suff-clear-single.exp suff-main-several.exp suff-self.exp suff-transform-endless.exp suff-transform-expand.exp suff-transform-select.exp suff-use.exp use-inference.exp var-eval-short.exp var-op-assign.exp var-op-expand.exp var-recursive.exp varmod-edge.exp varmod-gmtime.exp varmod-localtime.exp varmod-loop-delete.exp varmod-loop-varname.exp varmod-match-escape.exp varmod-order.exp varmod-range.exp varmod-sysv.exp varname-dot-newline.exp varname-make_print_var_on_error-jobs.exp varname-make_print_var_on_error.exp varname.exp Log Message: make: on error, print the targets to be made This helps to understand situations with several nested sub-makes in varying directories. To generate a diff of this commit: cvs rdiff -u -r1.625 -r1.626 src/usr.bin/make/main.c cvs rdiff -u -r1.348 -r1.349 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/compat-error.exp \ src/usr.bin/make/unit-tests/depsrc-ignore.exp \ src/usr.bin/make/unit-tests/directive-include-fatal.exp \ src/usr.bin/make/unit-tests/opt-debug-errors.exp \ src/usr.bin/make/unit-tests/varname-make_print_var_on_error.exp cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/cond-cmp-numeric.exp \ src/usr.bin/make/unit-tests/cond-func-defined.exp \ src/usr.bin/make/unit-tests/directive.exp \ src/usr.bin/make/unit-tests/opt-file.exp cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/cond-late.exp \ src/usr.bin/make/unit-tests/cond-token-number.exp \ src/usr.bin/make/unit-tests/directive-elif.exp \ src/usr.bin/make/unit-tests/directive-ifmake.exp \ src/usr.bin/make/unit-tests/var-op-assign.exp cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/cond-op-not.exp \ src/usr.bin/make/unit-tests/opt-debug-errors-jobs.exp \ src/usr.bin/make/unit-tests/opt-warnings-as-errors.exp \ src/usr.bin/make/unit-tests/varmod-loop-delete.exp cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/cond-op-parentheses.exp \ src/usr.bin/make/unit-tests/deptgt-end-fail.exp \ src/usr.bin/make/unit-tests/directive-else.exp \ src/usr.bin/make/unit-tests/directive-warning.exp \ src/usr.bin/make/unit-tests/parse.exp \ src/usr.bin/make/unit-tests/varname-dot-newline.exp cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/cond-op.exp \ src/usr.bin/make/unit-tests/cond-token-string.exp \ src/usr.bin/make/unit-tests/directive-include.exp \ src/usr.bin/make/unit-tests/suff-main-several.exp cvs rdiff -u -r1.13 -r1.14 src/usr.bin/make/unit-tests/cond-short.exp \ src/usr.bin/make/unit-tests/deptgt.exp \ src/usr.bin/make/unit-tests/directive-unexport-env.exp \ src/usr.bin/make/unit-tests/varmod-range.exp \ src/usr.bin/make/unit-tests/varmod-sysv.exp cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/dep-percent.exp \ src/usr.bin/make/unit-tests/dep.exp \ src/usr.bin/make/unit-tests/deptgt-begin-fail-indirect.exp \ src/usr.bin/make/unit-tests/deptgt-end-fail-all.exp \ src/usr.bin/make/unit-tests/deptgt-end-fail-indirect.exp \ src/usr.bin/make/unit-tests/deptgt-error.exp \ src/usr.bin/make/unit-tests/deptgt-ignore.exp \ src/usr.bin/make/unit-tests/deptgt-path-suffix.exp \
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Thu Jul 4 20:18:40 UTC 2024 Modified Files: src/usr.bin/make: main.c src/usr.bin/make/unit-tests: Makefile compat-error.exp cond-cmp-numeric.exp cond-func-defined.exp cond-late.exp cond-op-not.exp cond-op-parentheses.exp cond-op.exp cond-short.exp cond-token-number.exp cond-token-string.exp dep-percent.exp dep.exp depsrc-ignore.exp deptgt-begin-fail-indirect.exp deptgt-begin-fail.exp deptgt-delete_on_error.exp deptgt-end-fail-all.exp deptgt-end-fail-indirect.exp deptgt-end-fail.exp deptgt-error.exp deptgt-ignore.exp deptgt-path-suffix.exp deptgt.exp directive-dinclude.exp directive-elif.exp directive-else.exp directive-for-generating-endif.exp directive-for-if.exp directive-for-null.exp directive-hyphen-include.exp directive-ifmake.exp directive-include-fatal.exp directive-include.exp directive-info.exp directive-sinclude.exp directive-undef.exp directive-unexport-env.exp directive-warning.exp directive.exp doterror.exp jobs-empty-commands-error.exp jobs-error-indirect.exp jobs-error-nested-make.exp jobs-error-nested.exp opt-debug-errors-jobs.exp opt-debug-errors.exp opt-debug-graph2.exp opt-debug-graph3.exp opt-file.exp opt-keep-going-indirect.exp opt-keep-going-multiple.exp opt-keep-going.exp opt-warnings-as-errors.exp opt.exp parse.exp posix.exp sh-jobs.exp suff-add-later.exp suff-clear-regular.exp suff-clear-single.exp suff-main-several.exp suff-self.exp suff-transform-endless.exp suff-transform-expand.exp suff-transform-select.exp suff-use.exp use-inference.exp var-eval-short.exp var-op-assign.exp var-op-expand.exp var-recursive.exp varmod-edge.exp varmod-gmtime.exp varmod-localtime.exp varmod-loop-delete.exp varmod-loop-varname.exp varmod-match-escape.exp varmod-order.exp varmod-range.exp varmod-sysv.exp varname-dot-newline.exp varname-make_print_var_on_error-jobs.exp varname-make_print_var_on_error.exp varname.exp Log Message: make: on error, print the targets to be made This helps to understand situations with several nested sub-makes in varying directories. To generate a diff of this commit: cvs rdiff -u -r1.625 -r1.626 src/usr.bin/make/main.c cvs rdiff -u -r1.348 -r1.349 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/compat-error.exp \ src/usr.bin/make/unit-tests/depsrc-ignore.exp \ src/usr.bin/make/unit-tests/directive-include-fatal.exp \ src/usr.bin/make/unit-tests/opt-debug-errors.exp \ src/usr.bin/make/unit-tests/varname-make_print_var_on_error.exp cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/cond-cmp-numeric.exp \ src/usr.bin/make/unit-tests/cond-func-defined.exp \ src/usr.bin/make/unit-tests/directive.exp \ src/usr.bin/make/unit-tests/opt-file.exp cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/cond-late.exp \ src/usr.bin/make/unit-tests/cond-token-number.exp \ src/usr.bin/make/unit-tests/directive-elif.exp \ src/usr.bin/make/unit-tests/directive-ifmake.exp \ src/usr.bin/make/unit-tests/var-op-assign.exp cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/cond-op-not.exp \ src/usr.bin/make/unit-tests/opt-debug-errors-jobs.exp \ src/usr.bin/make/unit-tests/opt-warnings-as-errors.exp \ src/usr.bin/make/unit-tests/varmod-loop-delete.exp cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/cond-op-parentheses.exp \ src/usr.bin/make/unit-tests/deptgt-end-fail.exp \ src/usr.bin/make/unit-tests/directive-else.exp \ src/usr.bin/make/unit-tests/directive-warning.exp \ src/usr.bin/make/unit-tests/parse.exp \ src/usr.bin/make/unit-tests/varname-dot-newline.exp cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/cond-op.exp \ src/usr.bin/make/unit-tests/cond-token-string.exp \ src/usr.bin/make/unit-tests/directive-include.exp \ src/usr.bin/make/unit-tests/suff-main-several.exp cvs rdiff -u -r1.13 -r1.14 src/usr.bin/make/unit-tests/cond-short.exp \ src/usr.bin/make/unit-tests/deptgt.exp \ src/usr.bin/make/unit-tests/directive-unexport-env.exp \ src/usr.bin/make/unit-tests/varmod-range.exp \ src/usr.bin/make/unit-tests/varmod-sysv.exp cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/dep-percent.exp \ src/usr.bin/make/unit-tests/dep.exp \ src/usr.bin/make/unit-tests/deptgt-begin-fail-indirect.exp \ src/usr.bin/make/unit-tests/deptgt-end-fail-all.exp \ src/usr.bin/make/unit-tests/deptgt-end-fail-indirect.exp \ src/usr.bin/make/unit-tests/deptgt-error.exp \ src/usr.bin/make/unit-tests/deptgt-ignore.exp \ src/usr.bin/make/unit-tests/deptgt-path-suffix.exp \
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Thu Jul 4 18:53:38 UTC 2024 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: moderrs.exp moderrs.mk varmod-assign.exp varmod-order.exp varmod-order.mk varmod-select-words.exp varmod-to-separator.exp varmod-to-separator.mk varmod.exp varmod.mk varparse-errors.exp varparse-errors.mk Log Message: make: error out on the "Bad modifier" error message Previously, the "Bad modifier" error message did not affect make's exit status. As a side effect, this kind of error now gets more context information. To generate a diff of this commit: cvs rdiff -u -r1.1128 -r1.1129 src/usr.bin/make/var.c cvs rdiff -u -r1.38 -r1.39 src/usr.bin/make/unit-tests/moderrs.exp cvs rdiff -u -r1.34 -r1.35 src/usr.bin/make/unit-tests/moderrs.mk cvs rdiff -u -r1.24 -r1.25 src/usr.bin/make/unit-tests/varmod-assign.exp cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/varmod-order.exp cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/varmod-order.mk \ src/usr.bin/make/unit-tests/varparse-errors.exp cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/varmod-select-words.exp cvs rdiff -u -r1.14 -r1.15 \ src/usr.bin/make/unit-tests/varmod-to-separator.exp cvs rdiff -u -r1.16 -r1.17 src/usr.bin/make/unit-tests/varmod-to-separator.mk \ src/usr.bin/make/unit-tests/varmod.mk cvs rdiff -u -r1.13 -r1.14 src/usr.bin/make/unit-tests/varmod.exp \ src/usr.bin/make/unit-tests/varparse-errors.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.1128 src/usr.bin/make/var.c:1.1129 --- src/usr.bin/make/var.c:1.1128 Thu Jul 4 17:47:53 2024 +++ src/usr.bin/make/var.c Thu Jul 4 18:53:37 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.1128 2024/07/04 17:47:53 rillig Exp $ */ +/* $NetBSD: var.c,v 1.1129 2024/07/04 18:53:37 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -132,7 +132,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.1128 2024/07/04 17:47:53 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.1129 2024/07/04 18:53:37 rillig Exp $"); /* * Variables are defined using one of the VAR=value assignments. Their @@ -1965,11 +1965,9 @@ FormatTime(const char *fmt, time_t t, bo * and stores the result back in ch->expr->value via Expr_SetValueOwn or * Expr_SetValueRefer. * - * If evaluating fails, the fallback error message "Bad modifier" is printed - * using Error. This function has no side effects, it really just prints the - * error message, continuing as if nothing had happened. TODO: This should be - * fixed by adding proper error handling to Var_Subst, Var_Parse, - * ApplyModifiers and ModifyWords. + * If evaluating fails, the fallback error message "Bad modifier" is printed. + * TODO: Add proper error handling to Var_Subst, Var_Parse, ApplyModifiers and + * ModifyWords. * * Some modifiers such as :D and :U turn undefined expressions into defined * expressions using Expr_Define. @@ -4118,8 +4116,8 @@ ApplyModifiers( bad_modifier: /* Take a guess at where the modifier ends. */ - Error("Bad modifier \":%.*s\" for variable \"%s\"", - (int)strcspn(mod, ":)}"), mod, expr->name); + Parse_Error(PARSE_FATAL, "Bad modifier \":%.*s\"", + (int)strcspn(mod, ":)}"), mod); cleanup: /* Index: src/usr.bin/make/unit-tests/moderrs.exp diff -u src/usr.bin/make/unit-tests/moderrs.exp:1.38 src/usr.bin/make/unit-tests/moderrs.exp:1.39 --- src/usr.bin/make/unit-tests/moderrs.exp:1.38 Thu Jul 4 17:47:54 2024 +++ src/usr.bin/make/unit-tests/moderrs.exp Thu Jul 4 18:53:37 2024 @@ -31,7 +31,7 @@ make: in target "words": while evaluatin make: in target "words": while evaluating variable "UNDEF" with value "1 2 3": Unfinished modifier (']' missing) 13= -make: Bad modifier ":[123451234512345123451234512345]" for variable "UNDEF" +make: in target "words": while evaluating variable "UNDEF" with value "1 2 3": Bad modifier ":[123451234512345123451234512345]" 12345=S,^ok,:S,^3ok,} make: in target "exclam": while evaluating variable "VARNAME" with value "": Unfinished modifier ('!' missing) @@ -70,21 +70,21 @@ make: Unclosed expression, expecting '}' mod-ts-parse: 112358132134 15152535558513521534 -make: Bad modifier ":ts\65oct" for variable "FIB" +make: in target "mod-ts-parse": while evaluating variable "FIB" with value "1 1 2 3 5 8 13 21 34": Bad modifier ":ts\65oct" 65oct} -make: Bad modifier ":ts\65oct" for variable "" +make: in target "mod-ts-parse": while evaluating "${:U${FIB}:ts\65oct} # bad modifier, variable name is """: Bad modifier ":ts\65oct" 65oct} -make: Bad modifier ":tsxy" for variable "FIB" +make: in target "mod-ts-parse": while evaluating variable "FIB" with value "1 1 2 3 5 8 13 21 34": Bad modifier ":tsxy" xy} mod-t-parse: -make: Bad modifier
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Thu Jul 4 18:53:38 UTC 2024 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: moderrs.exp moderrs.mk varmod-assign.exp varmod-order.exp varmod-order.mk varmod-select-words.exp varmod-to-separator.exp varmod-to-separator.mk varmod.exp varmod.mk varparse-errors.exp varparse-errors.mk Log Message: make: error out on the "Bad modifier" error message Previously, the "Bad modifier" error message did not affect make's exit status. As a side effect, this kind of error now gets more context information. To generate a diff of this commit: cvs rdiff -u -r1.1128 -r1.1129 src/usr.bin/make/var.c cvs rdiff -u -r1.38 -r1.39 src/usr.bin/make/unit-tests/moderrs.exp cvs rdiff -u -r1.34 -r1.35 src/usr.bin/make/unit-tests/moderrs.mk cvs rdiff -u -r1.24 -r1.25 src/usr.bin/make/unit-tests/varmod-assign.exp cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/varmod-order.exp cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/varmod-order.mk \ src/usr.bin/make/unit-tests/varparse-errors.exp cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/varmod-select-words.exp cvs rdiff -u -r1.14 -r1.15 \ src/usr.bin/make/unit-tests/varmod-to-separator.exp cvs rdiff -u -r1.16 -r1.17 src/usr.bin/make/unit-tests/varmod-to-separator.mk \ src/usr.bin/make/unit-tests/varmod.mk cvs rdiff -u -r1.13 -r1.14 src/usr.bin/make/unit-tests/varmod.exp \ src/usr.bin/make/unit-tests/varparse-errors.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Thu Jul 4 17:47:54 UTC 2024 Modified Files: src/usr.bin/make: parse.c var.c src/usr.bin/make/unit-tests: cmd-errors-jobs.exp cmd-errors-jobs.mk cmd-errors-lint.exp cmd-errors.exp cond-late.exp cond-late.mk dep-op-missing.exp directive-dinclude.exp directive-export-gmake.exp directive-for-break.exp directive-for-escape.exp directive-for-generating-endif.exp directive-for-if.exp directive-for-null.exp directive-for.exp directive-hyphen-include.exp directive-sinclude.exp directive-undef.exp directive-undef.mk lint.exp moderrs.exp moderrs.mk opt-debug-lint.exp opt-debug-lint.mk opt-file.exp var-op-expand.exp var-op-expand.mk var-recursive.exp varmisc.exp varmod-assign-shell.exp varmod-assign-shell.mk varmod-assign.exp varmod-assign.mk varmod-edge.exp varmod-edge.mk varmod-gmtime.exp varmod-gmtime.mk varmod-hash.exp varmod-indirect.exp varmod-indirect.mk varmod-localtime.exp varmod-localtime.mk varmod-loop-delete.exp varmod-loop-delete.mk varmod-loop-varname.exp varmod-loop-varname.mk varmod-match-escape.exp varmod-match-escape.mk varmod-match.exp varmod-match.mk varmod-mtime.exp varmod-mtime.mk varmod-range.exp varmod-range.mk varmod-subst-regex.exp varmod-sun-shell.exp varmod-sun-shell.mk varmod-sysv.exp varmod-sysv.mk varmod-to-separator.exp varmod-to-separator.mk varmod.exp varmod.mk varname-dot-newline.exp Log Message: make: add more context information to error messages In case of a parse error or evaluation error, print the variable value in addition to the variable name, to see the effects of previous expression modifiers. In nested make calls, print the current directory at the bottom of a stack trace, as that information is otherwise hard to get in a parallel build spanning multiple directories. To generate a diff of this commit: cvs rdiff -u -r1.731 -r1.732 src/usr.bin/make/parse.c cvs rdiff -u -r1.1127 -r1.1128 src/usr.bin/make/var.c cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/cmd-errors-jobs.exp \ src/usr.bin/make/unit-tests/cmd-errors-lint.exp \ src/usr.bin/make/unit-tests/cond-late.exp \ src/usr.bin/make/unit-tests/directive-export-gmake.exp cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/cmd-errors-jobs.mk \ src/usr.bin/make/unit-tests/directive-for-break.exp \ src/usr.bin/make/unit-tests/lint.exp \ src/usr.bin/make/unit-tests/varmod-hash.exp \ src/usr.bin/make/unit-tests/varmod-loop-delete.exp \ src/usr.bin/make/unit-tests/varmod-loop-delete.mk \ src/usr.bin/make/unit-tests/varmod-sun-shell.mk cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/cmd-errors.exp \ src/usr.bin/make/unit-tests/var-op-expand.exp cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/cond-late.mk \ src/usr.bin/make/unit-tests/var-recursive.exp \ src/usr.bin/make/unit-tests/varmod-assign-shell.exp \ src/usr.bin/make/unit-tests/varmod-assign-shell.mk \ src/usr.bin/make/unit-tests/varmod-loop-varname.exp \ src/usr.bin/make/unit-tests/varmod-loop-varname.mk cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/dep-op-missing.exp cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/directive-dinclude.exp \ src/usr.bin/make/unit-tests/directive-for-generating-endif.exp \ src/usr.bin/make/unit-tests/directive-for-if.exp \ src/usr.bin/make/unit-tests/directive-for-null.exp \ src/usr.bin/make/unit-tests/directive-hyphen-include.exp \ src/usr.bin/make/unit-tests/directive-sinclude.exp cvs rdiff -u -r1.24 -r1.25 \ src/usr.bin/make/unit-tests/directive-for-escape.exp \ src/usr.bin/make/unit-tests/varmod-match.mk cvs rdiff -u -r1.22 -r1.23 src/usr.bin/make/unit-tests/directive-for.exp \ src/usr.bin/make/unit-tests/varmod-assign.mk \ src/usr.bin/make/unit-tests/varmod-gmtime.mk cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/directive-undef.exp \ src/usr.bin/make/unit-tests/varmod-mtime.mk cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/unit-tests/directive-undef.mk \ src/usr.bin/make/unit-tests/varmod-localtime.exp \ src/usr.bin/make/unit-tests/varmod-match-escape.mk cvs rdiff -u -r1.37 -r1.38 src/usr.bin/make/unit-tests/moderrs.exp cvs rdiff -u -r1.33 -r1.34 src/usr.bin/make/unit-tests/moderrs.mk cvs rdiff -u -r1.19 -r1.20 src/usr.bin/make/unit-tests/opt-debug-lint.exp \ src/usr.bin/make/unit-tests/varmod-indirect.mk cvs rdiff -u -r1.17 -r1.18 src/usr.bin/make/unit-tests/opt-debug-lint.mk \ src/usr.bin/make/unit-tests/varmod-gmtime.exp cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/opt-file.exp \ src/usr.bin/make/unit-tests/varmod-mtime.exp \ src/usr.bin/make/unit-tests/varmod-subst-regex.exp cvs rdiff -u -r1.20 -r1.21
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Thu Jul 4 17:47:54 UTC 2024 Modified Files: src/usr.bin/make: parse.c var.c src/usr.bin/make/unit-tests: cmd-errors-jobs.exp cmd-errors-jobs.mk cmd-errors-lint.exp cmd-errors.exp cond-late.exp cond-late.mk dep-op-missing.exp directive-dinclude.exp directive-export-gmake.exp directive-for-break.exp directive-for-escape.exp directive-for-generating-endif.exp directive-for-if.exp directive-for-null.exp directive-for.exp directive-hyphen-include.exp directive-sinclude.exp directive-undef.exp directive-undef.mk lint.exp moderrs.exp moderrs.mk opt-debug-lint.exp opt-debug-lint.mk opt-file.exp var-op-expand.exp var-op-expand.mk var-recursive.exp varmisc.exp varmod-assign-shell.exp varmod-assign-shell.mk varmod-assign.exp varmod-assign.mk varmod-edge.exp varmod-edge.mk varmod-gmtime.exp varmod-gmtime.mk varmod-hash.exp varmod-indirect.exp varmod-indirect.mk varmod-localtime.exp varmod-localtime.mk varmod-loop-delete.exp varmod-loop-delete.mk varmod-loop-varname.exp varmod-loop-varname.mk varmod-match-escape.exp varmod-match-escape.mk varmod-match.exp varmod-match.mk varmod-mtime.exp varmod-mtime.mk varmod-range.exp varmod-range.mk varmod-subst-regex.exp varmod-sun-shell.exp varmod-sun-shell.mk varmod-sysv.exp varmod-sysv.mk varmod-to-separator.exp varmod-to-separator.mk varmod.exp varmod.mk varname-dot-newline.exp Log Message: make: add more context information to error messages In case of a parse error or evaluation error, print the variable value in addition to the variable name, to see the effects of previous expression modifiers. In nested make calls, print the current directory at the bottom of a stack trace, as that information is otherwise hard to get in a parallel build spanning multiple directories. To generate a diff of this commit: cvs rdiff -u -r1.731 -r1.732 src/usr.bin/make/parse.c cvs rdiff -u -r1.1127 -r1.1128 src/usr.bin/make/var.c cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/cmd-errors-jobs.exp \ src/usr.bin/make/unit-tests/cmd-errors-lint.exp \ src/usr.bin/make/unit-tests/cond-late.exp \ src/usr.bin/make/unit-tests/directive-export-gmake.exp cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/cmd-errors-jobs.mk \ src/usr.bin/make/unit-tests/directive-for-break.exp \ src/usr.bin/make/unit-tests/lint.exp \ src/usr.bin/make/unit-tests/varmod-hash.exp \ src/usr.bin/make/unit-tests/varmod-loop-delete.exp \ src/usr.bin/make/unit-tests/varmod-loop-delete.mk \ src/usr.bin/make/unit-tests/varmod-sun-shell.mk cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/cmd-errors.exp \ src/usr.bin/make/unit-tests/var-op-expand.exp cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/cond-late.mk \ src/usr.bin/make/unit-tests/var-recursive.exp \ src/usr.bin/make/unit-tests/varmod-assign-shell.exp \ src/usr.bin/make/unit-tests/varmod-assign-shell.mk \ src/usr.bin/make/unit-tests/varmod-loop-varname.exp \ src/usr.bin/make/unit-tests/varmod-loop-varname.mk cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/dep-op-missing.exp cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/directive-dinclude.exp \ src/usr.bin/make/unit-tests/directive-for-generating-endif.exp \ src/usr.bin/make/unit-tests/directive-for-if.exp \ src/usr.bin/make/unit-tests/directive-for-null.exp \ src/usr.bin/make/unit-tests/directive-hyphen-include.exp \ src/usr.bin/make/unit-tests/directive-sinclude.exp cvs rdiff -u -r1.24 -r1.25 \ src/usr.bin/make/unit-tests/directive-for-escape.exp \ src/usr.bin/make/unit-tests/varmod-match.mk cvs rdiff -u -r1.22 -r1.23 src/usr.bin/make/unit-tests/directive-for.exp \ src/usr.bin/make/unit-tests/varmod-assign.mk \ src/usr.bin/make/unit-tests/varmod-gmtime.mk cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/directive-undef.exp \ src/usr.bin/make/unit-tests/varmod-mtime.mk cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/unit-tests/directive-undef.mk \ src/usr.bin/make/unit-tests/varmod-localtime.exp \ src/usr.bin/make/unit-tests/varmod-match-escape.mk cvs rdiff -u -r1.37 -r1.38 src/usr.bin/make/unit-tests/moderrs.exp cvs rdiff -u -r1.33 -r1.34 src/usr.bin/make/unit-tests/moderrs.mk cvs rdiff -u -r1.19 -r1.20 src/usr.bin/make/unit-tests/opt-debug-lint.exp \ src/usr.bin/make/unit-tests/varmod-indirect.mk cvs rdiff -u -r1.17 -r1.18 src/usr.bin/make/unit-tests/opt-debug-lint.mk \ src/usr.bin/make/unit-tests/varmod-gmtime.exp cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/opt-file.exp \ src/usr.bin/make/unit-tests/varmod-mtime.exp \ src/usr.bin/make/unit-tests/varmod-subst-regex.exp cvs rdiff -u -r1.20 -r1.21
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Tue Jul 2 20:10:45 UTC 2024 Modified Files: src/usr.bin/make: var.c Log Message: make: trim trailing whitespace To generate a diff of this commit: cvs rdiff -u -r1.1126 -r1.1127 src/usr.bin/make/var.c 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.1126 src/usr.bin/make/var.c:1.1127 --- src/usr.bin/make/var.c:1.1126 Mon Jul 1 21:02:26 2024 +++ src/usr.bin/make/var.c Tue Jul 2 20:10:45 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.1126 2024/07/01 21:02:26 sjg Exp $ */ +/* $NetBSD: var.c,v 1.1127 2024/07/02 20:10:45 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -132,7 +132,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.1126 2024/07/01 21:02:26 sjg Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.1127 2024/07/02 20:10:45 rillig Exp $"); /* * Variables are defined using one of the VAR=value assignments. Their @@ -3209,7 +3209,7 @@ ApplyModifier_To(const char **pp, ModCha Expr_SetValueOwn(expr, str_totitle(Expr_Str(expr))); return AMR_OK; } - + if (mod[1] == 'u') {/* :tu */ *pp = mod + 2; if (Expr_ShouldEval(expr))
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Tue Jul 2 20:10:45 UTC 2024 Modified Files: src/usr.bin/make: var.c Log Message: make: trim trailing whitespace To generate a diff of this commit: cvs rdiff -u -r1.1126 -r1.1127 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Mon Jul 1 21:02:26 UTC 2024 Modified Files: src/usr.bin/make: make.1 var.c src/usr.bin/make/unit-tests: Makefile Added Files: src/usr.bin/make/unit-tests: varmod-to-title.exp varmod-to-title.mk Log Message: make: add :tc to capitalize first letter of each word This is very hard to do without :tc Reviewed by: rillig To generate a diff of this commit: cvs rdiff -u -r1.377 -r1.378 src/usr.bin/make/make.1 cvs rdiff -u -r1.1125 -r1.1126 src/usr.bin/make/var.c cvs rdiff -u -r1.347 -r1.348 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/varmod-to-title.exp \ src/usr.bin/make/unit-tests/varmod-to-title.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/make.1 diff -u src/usr.bin/make/make.1:1.377 src/usr.bin/make/make.1:1.378 --- src/usr.bin/make/make.1:1.377 Sat Jun 1 06:26:36 2024 +++ src/usr.bin/make/make.1 Mon Jul 1 21:02:26 2024 @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.377 2024/06/01 06:26:36 sjg Exp $ +.\" $NetBSD: make.1,v 1.378 2024/07/01 21:02:26 sjg Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd June 1, 2024 +.Dd July 1, 2024 .Dt MAKE 1 .Os .Sh NAME @@ -1574,6 +1574,9 @@ If .Ar c is omitted, no separator is used. The common escapes (including octal numeric codes) work as expected. +.It Cm \&:tt +Converts the first character of each word to upper-case, +and the rest to lower-case letters. .It Cm \&:tu Converts the value to upper-case letters. .It Cm \&:tW Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.1125 src/usr.bin/make/var.c:1.1126 --- src/usr.bin/make/var.c:1.1125 Sun Jun 30 15:21:23 2024 +++ src/usr.bin/make/var.c Mon Jul 1 21:02:26 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.1125 2024/06/30 15:21:23 rillig Exp $ */ +/* $NetBSD: var.c,v 1.1126 2024/07/01 21:02:26 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -132,7 +132,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.1125 2024/06/30 15:21:23 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.1126 2024/07/01 21:02:26 sjg Exp $"); /* * Variables are defined using one of the VAR=value assignments. Their @@ -3142,6 +3142,21 @@ ok: } static char * +str_totitle(const char *str) +{ + size_t i, n = strlen(str) + 1; + char *res = bmake_malloc(n); + for (i = 0; i < n; i++) { + if (i == 0 || ch_isspace(res[i - 1])) + res[i] = ch_toupper(str[i]); + else + res[i] = ch_tolower(str[i]); + } + return res; +} + + +static char * str_toupper(const char *str) { size_t i, n = strlen(str) + 1; @@ -3188,6 +3203,13 @@ ApplyModifier_To(const char **pp, ModCha return AMR_OK; } + if (mod[1] == 't') {/* :tt */ + *pp = mod + 2; + if (Expr_ShouldEval(expr)) + Expr_SetValueOwn(expr, str_totitle(Expr_Str(expr))); + return AMR_OK; + } + if (mod[1] == 'u') {/* :tu */ *pp = mod + 2; if (Expr_ShouldEval(expr)) Index: src/usr.bin/make/unit-tests/Makefile diff -u src/usr.bin/make/unit-tests/Makefile:1.347 src/usr.bin/make/unit-tests/Makefile:1.348 --- src/usr.bin/make/unit-tests/Makefile:1.347 Sat Jun 1 15:54:40 2024 +++ src/usr.bin/make/unit-tests/Makefile Mon Jul 1 21:02:26 2024 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.347 2024/06/01 15:54:40 sjg Exp $ +# $NetBSD: Makefile,v 1.348 2024/07/01 21:02:26 sjg Exp $ # # Unit tests for make(1) # @@ -397,6 +397,7 @@ TESTS+= varmod-to-lower TESTS+= varmod-to-many-words TESTS+= varmod-to-one-word TESTS+= varmod-to-separator +TESTS+= varmod-to-title TESTS+= varmod-to-upper TESTS+= varmod-undefined TESTS+= varmod-unique Added files: Index: src/usr.bin/make/unit-tests/varmod-to-title.exp diff -u /dev/null src/usr.bin/make/unit-tests/varmod-to-title.exp:1.1 --- /dev/null Mon Jul 1 21:02:26 2024 +++ src/usr.bin/make/unit-tests/varmod-to-title.exp Mon Jul 1 21:02:26 2024 @@ -0,0 +1 @@ +exit status 0 Index: src/usr.bin/make/unit-tests/varmod-to-title.mk diff -u /dev/null src/usr.bin/make/unit-tests/varmod-to-title.mk:1.1 --- /dev/null Mon Jul 1 21:02:26 2024 +++ src/usr.bin/make/unit-tests/varmod-to-title.mk Mon Jul 1 21:02:26 2024 @@ -0,0 +1,31 @@ +# $NetBSD: varmod-to-title.mk,v 1.1 2024/07/01 21:02:26 sjg Exp $ +# +# Tests for the :tc variable modifier, which converts the expression value +# to lowercase. +# +# TODO: What about non-ASCII characters? ISO-8859-1, UTF-8? + +.if ${:UUPPER:tt} != "Upper" +. error +.endif + +.if ${:Ulower:tt} != "Lower" +. error +.endif + +.if ${:UMixeD case.:tt} != "Mixed Case." +. error +.endif + +# The ':tt' modifier works on the whole string, without splitting it into +# words. +.if ${:Umultiple spaces:tt} != "Multiple Spaces" +. error +.endif + +# Note words only
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Mon Jul 1 21:02:26 UTC 2024 Modified Files: src/usr.bin/make: make.1 var.c src/usr.bin/make/unit-tests: Makefile Added Files: src/usr.bin/make/unit-tests: varmod-to-title.exp varmod-to-title.mk Log Message: make: add :tc to capitalize first letter of each word This is very hard to do without :tc Reviewed by: rillig To generate a diff of this commit: cvs rdiff -u -r1.377 -r1.378 src/usr.bin/make/make.1 cvs rdiff -u -r1.1125 -r1.1126 src/usr.bin/make/var.c cvs rdiff -u -r1.347 -r1.348 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/varmod-to-title.exp \ src/usr.bin/make/unit-tests/varmod-to-title.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Jun 30 15:21:24 UTC 2024 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: moderrs.exp moderrs.mk opt-debug-file.exp opt-debug-file.mk varmod-assign.exp varmod-assign.mk varmod-edge.exp varmod-edge.mk varmod-subst-regex.exp varmod-sysv.exp varmod-sysv.mk Log Message: make: error out on some more syntax errors Previously, these errors only produced a message on stderr. They only affected make's exit status when they were evaluated at parse time, but not when evaluating the commands for a specific target right before executing them. The affected syntax errors are: * invalid regular expressions in the ':C' modifier * out-of-range references to regex groups in the ':C' modifier * unfinished modifiers To generate a diff of this commit: cvs rdiff -u -r1.1124 -r1.1125 src/usr.bin/make/var.c cvs rdiff -u -r1.36 -r1.37 src/usr.bin/make/unit-tests/moderrs.exp cvs rdiff -u -r1.32 -r1.33 src/usr.bin/make/unit-tests/moderrs.mk cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/opt-debug-file.exp \ src/usr.bin/make/unit-tests/varmod-subst-regex.exp cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/opt-debug-file.mk cvs rdiff -u -r1.22 -r1.23 src/usr.bin/make/unit-tests/varmod-assign.exp cvs rdiff -u -r1.21 -r1.22 src/usr.bin/make/unit-tests/varmod-assign.mk cvs rdiff -u -r1.17 -r1.18 src/usr.bin/make/unit-tests/varmod-edge.exp \ src/usr.bin/make/unit-tests/varmod-sysv.mk cvs rdiff -u -r1.20 -r1.21 src/usr.bin/make/unit-tests/varmod-edge.mk cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/varmod-sysv.exp 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.1124 src/usr.bin/make/var.c:1.1125 --- src/usr.bin/make/var.c:1.1124 Sun Jun 30 13:01:01 2024 +++ src/usr.bin/make/var.c Sun Jun 30 15:21:23 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.1124 2024/06/30 13:01:01 rillig Exp $ */ +/* $NetBSD: var.c,v 1.1125 2024/06/30 15:21:23 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -132,7 +132,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.1124 2024/06/30 13:01:01 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.1125 2024/06/30 15:21:23 rillig Exp $"); /* * Variables are defined using one of the VAR=value assignments. Their @@ -1567,7 +1567,7 @@ RegexError(int reerr, const regex_t *pat size_t errlen = regerror(reerr, pat, NULL, 0); char *errbuf = bmake_malloc(errlen); regerror(reerr, pat, errbuf, errlen); - Error("%s: %s", str, errbuf); + Parse_Error(PARSE_FATAL, "%s: %s", str, errbuf); free(errbuf); } @@ -1579,7 +1579,7 @@ RegexReplaceBackref(char ref, SepBuf *bu unsigned int n = (unsigned)ref - '0'; if (n >= nsub) - Error("No subexpression \\%u", n); + Parse_Error(PARSE_FATAL, "No subexpression \\%u", n); else if (m[n].rm_so == -1) { if (opts.strict) Error("No match for subexpression \\%u", n); @@ -2230,8 +2230,8 @@ ParseModifierPart( *pp = p; if (*p != end1 && *p != end2) { - Error("Unfinished modifier for \"%s\" ('%c' missing)", - ch->expr->name, end2); + Parse_Error(PARSE_FATAL, + "Unfinished modifier ('%c' missing)", end2); LazyBuf_Done(part); return false; } @@ -2933,7 +2933,8 @@ ApplyModifier_Subst(const char **pp, Mod char delim = (*pp)[1]; if (delim == '\0') { - Error("Missing delimiter for modifier ':S'"); + Parse_Error(PARSE_FATAL, + "Missing delimiter for modifier ':S'"); (*pp)++; return AMR_CLEANUP; } @@ -2982,7 +2983,8 @@ ApplyModifier_Regex(const char **pp, Mod char delim = (*pp)[1]; if (delim == '\0') { - Error("Missing delimiter for :C modifier"); + Parse_Error(PARSE_FATAL, + "Missing delimiter for modifier ':C'"); (*pp)++; return AMR_CLEANUP; } Index: src/usr.bin/make/unit-tests/moderrs.exp diff -u src/usr.bin/make/unit-tests/moderrs.exp:1.36 src/usr.bin/make/unit-tests/moderrs.exp:1.37 --- src/usr.bin/make/unit-tests/moderrs.exp:1.36 Sun Jun 30 14:23:18 2024 +++ src/usr.bin/make/unit-tests/moderrs.exp Sun Jun 30 15:21:24 2024 @@ -1,8 +1,6 @@ -mod-unknown-direct: make: in target "mod-unknown-direct": while evaluating variable "VAR": Unknown modifier "Z" VAR:Z=before--after -mod-unknown-indirect: make: in target "mod-unknown-indirect": while evaluating variable "VAR": Unknown modifier "Z" VAR:Z=before-inner}-after @@ -14,14 +12,12 @@ unclosed-indirect: make: Unclosed expression after indirect modifier, expecting '}' for variable "VAR" VAR:S,V,v,=Thevariable -unfinished-indirect: -make: Unfinished modifier for "VAR" (',' missing) +make: in target "unfinished-indirect": while evaluating variable "VAR": Unfinished modifier (',' missing) VAR:S,V,v= -unfinished-loop: -make: Unfinished modifier for "UNDEF" ('@' missing) +make: in
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Jun 30 15:21:24 UTC 2024 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: moderrs.exp moderrs.mk opt-debug-file.exp opt-debug-file.mk varmod-assign.exp varmod-assign.mk varmod-edge.exp varmod-edge.mk varmod-subst-regex.exp varmod-sysv.exp varmod-sysv.mk Log Message: make: error out on some more syntax errors Previously, these errors only produced a message on stderr. They only affected make's exit status when they were evaluated at parse time, but not when evaluating the commands for a specific target right before executing them. The affected syntax errors are: * invalid regular expressions in the ':C' modifier * out-of-range references to regex groups in the ':C' modifier * unfinished modifiers To generate a diff of this commit: cvs rdiff -u -r1.1124 -r1.1125 src/usr.bin/make/var.c cvs rdiff -u -r1.36 -r1.37 src/usr.bin/make/unit-tests/moderrs.exp cvs rdiff -u -r1.32 -r1.33 src/usr.bin/make/unit-tests/moderrs.mk cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/opt-debug-file.exp \ src/usr.bin/make/unit-tests/varmod-subst-regex.exp cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/opt-debug-file.mk cvs rdiff -u -r1.22 -r1.23 src/usr.bin/make/unit-tests/varmod-assign.exp cvs rdiff -u -r1.21 -r1.22 src/usr.bin/make/unit-tests/varmod-assign.mk cvs rdiff -u -r1.17 -r1.18 src/usr.bin/make/unit-tests/varmod-edge.exp \ src/usr.bin/make/unit-tests/varmod-sysv.mk cvs rdiff -u -r1.20 -r1.21 src/usr.bin/make/unit-tests/varmod-edge.mk cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/varmod-sysv.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sun Jun 30 14:23:18 UTC 2024 Modified Files: src/usr.bin/make/unit-tests: moderrs.exp moderrs.mk Log Message: tests/make: replace 'want' comments with 'expect' directives The 'want' comments needed to be cross-checked manually, which was error-prone, as can be seen in the "Unknown modifier" messages that got out of sync. To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/usr.bin/make/unit-tests/moderrs.exp cvs rdiff -u -r1.31 -r1.32 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/unit-tests/moderrs.exp diff -u src/usr.bin/make/unit-tests/moderrs.exp:1.35 src/usr.bin/make/unit-tests/moderrs.exp:1.36 --- src/usr.bin/make/unit-tests/moderrs.exp:1.35 Sat Apr 20 10:18:55 2024 +++ src/usr.bin/make/unit-tests/moderrs.exp Sun Jun 30 14:23:18 2024 @@ -1,33 +1,26 @@ mod-unknown-direct: -want: Unknown modifier 'Z' make: in target "mod-unknown-direct": while evaluating variable "VAR": Unknown modifier "Z" VAR:Z=before--after mod-unknown-indirect: -want: Unknown modifier 'Z' make: in target "mod-unknown-indirect": while evaluating variable "VAR": Unknown modifier "Z" VAR:Z=before-inner}-after unclosed-direct: -want: Unclosed expression, expecting '}' for modifier "S,V,v," of variable "VAR" with value "Thevariable" make: Unclosed expression, expecting '}' for modifier "S,V,v," of variable "VAR" with value "Thevariable" VAR:S,V,v,=Thevariable unclosed-indirect: -want: Unclosed expression after indirect modifier, expecting '}' for variable "VAR" make: Unclosed expression after indirect modifier, expecting '}' for variable "VAR" VAR:S,V,v,=Thevariable unfinished-indirect: -want: Unfinished modifier for VAR (',' missing) make: Unfinished modifier for "VAR" (',' missing) VAR:S,V,v= unfinished-loop: -want: Unfinished modifier for UNDEF ('@' missing) make: Unfinished modifier for "UNDEF" ('@' missing) -want: Unfinished modifier for UNDEF ('@' missing) make: Unfinished modifier for "UNDEF" ('@' missing) 1 2 3 @@ -38,10 +31,8 @@ make: Unclosed expression, expecting '}' 1}... 2}... 3}... words: -want: Unfinished modifier for UNDEF (']' missing) make: Unfinished modifier for "UNDEF" (']' missing) -want: Unfinished modifier for UNDEF (']' missing) make: Unfinished modifier for "UNDEF" (']' missing) 13= @@ -49,10 +40,8 @@ make: Bad modifier ":[123451234512345123 12345=S,^ok,:S,^3ok,} exclam: -want: Unfinished modifier for VARNAME ('!' missing) make: Unfinished modifier for "VARNAME" ('!' missing) -want: Unfinished modifier for ! ('!' missing) make: Unfinished modifier for "!" ('!' missing) Index: src/usr.bin/make/unit-tests/moderrs.mk diff -u src/usr.bin/make/unit-tests/moderrs.mk:1.31 src/usr.bin/make/unit-tests/moderrs.mk:1.32 --- src/usr.bin/make/unit-tests/moderrs.mk:1.31 Sun Nov 19 22:32:44 2023 +++ src/usr.bin/make/unit-tests/moderrs.mk Sun Jun 30 14:23:18 2024 @@ -1,8 +1,7 @@ -# $NetBSD: moderrs.mk,v 1.31 2023/11/19 22:32:44 rillig Exp $ +# $NetBSD: moderrs.mk,v 1.32 2024/06/30 14:23:18 rillig Exp $ # # various modifier error tests -'= '\'' VAR= TheVariable # in case we have to change it ;-) MOD_UNKN= Z @@ -26,29 +25,29 @@ all: mod-remember-parse all: mod-sysv-parse mod-unknown-direct: print-header print-footer - @echo 'want: Unknown modifier $'Z$'' +# expect: make: in target "mod-unknown-direct": while evaluating variable "VAR": Unknown modifier "Z" @echo 'VAR:Z=before-${VAR:Z}-after' mod-unknown-indirect: print-header print-footer - @echo 'want: Unknown modifier $'Z$'' +# expect: make: in target "mod-unknown-indirect": while evaluating variable "VAR": Unknown modifier "Z" @echo 'VAR:${MOD_UNKN}=before-${VAR:${MOD_UNKN}:inner}-after' unclosed-direct: print-header print-footer - @echo 'want: Unclosed expression, expecting $'}$' for modifier "S,V,v," of variable "VAR" with value "Thevariable"' +# expect: make: Unclosed expression, expecting '}' for modifier "S,V,v," of variable "VAR" with value "Thevariable" @echo VAR:S,V,v,=${VAR:S,V,v, unclosed-indirect: print-header print-footer - @echo 'want: Unclosed expression after indirect modifier, expecting $'}$' for variable "VAR"' +# expect: make: Unclosed expression after indirect modifier, expecting '}' for variable "VAR" @echo VAR:${MOD_TERM},=${VAR:${MOD_S} unfinished-indirect: print-header print-footer - @echo 'want: Unfinished modifier for VAR ($',$' missing)' +# expect: make: Unfinished modifier for "VAR" (',' missing) -@echo "VAR:${MOD_TERM}=${VAR:${MOD_TERM}}" unfinished-loop: print-header print-footer - @echo 'want: Unfinished modifier for UNDEF ($'@$' missing)' +# expect: make: Unfinished modifier for "UNDEF" ('@' missing) @echo ${UNDEF:U1 2 3:@var} - @echo 'want: Unfinished modifier for UNDEF ($'@$' missing)' +# expect: make: Unfinished modifier
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sun Jun 30 14:23:18 UTC 2024 Modified Files: src/usr.bin/make/unit-tests: moderrs.exp moderrs.mk Log Message: tests/make: replace 'want' comments with 'expect' directives The 'want' comments needed to be cross-checked manually, which was error-prone, as can be seen in the "Unknown modifier" messages that got out of sync. To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/usr.bin/make/unit-tests/moderrs.exp cvs rdiff -u -r1.31 -r1.32 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.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Jun 30 13:01:01 UTC 2024 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: cond-late.exp cond-late.mk varmod-ifelse.exp varmod-ifelse.mk Log Message: make: error out on syntax error in conditions in ':?then:else' modifier The 'Error' function only reports errors but does not affect the exit status, the 'Parse_Error' function does, while providing more details to find the cause of the syntax error. To generate a diff of this commit: cvs rdiff -u -r1.1123 -r1.1124 src/usr.bin/make/var.c cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/cond-late.exp cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/cond-late.mk cvs rdiff -u -r1.20 -r1.21 src/usr.bin/make/unit-tests/varmod-ifelse.exp cvs rdiff -u -r1.29 -r1.30 src/usr.bin/make/unit-tests/varmod-ifelse.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.1123 src/usr.bin/make/var.c:1.1124 --- src/usr.bin/make/var.c:1.1123 Sun Jun 30 11:44:14 2024 +++ src/usr.bin/make/var.c Sun Jun 30 13:01:01 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.1123 2024/06/30 11:44:14 rillig Exp $ */ +/* $NetBSD: var.c,v 1.1124 2024/06/30 13:01:01 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -132,7 +132,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.1123 2024/06/30 11:44:14 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.1124 2024/06/30 13:01:01 rillig Exp $"); /* * Variables are defined using one of the VAR=value assignments. Their @@ -262,6 +262,9 @@ typedef struct SepBuf { typedef enum { VSK_TARGET, VSK_VARNAME, + VSK_COND, + VSK_COND_THEN, + VSK_COND_ELSE, VSK_EXPR } EvalStackElementKind; @@ -375,11 +378,17 @@ EvalStack_Details(void) buf->len = 0; for (i = 0; i < evalStack.len; i++) { + static const char descr[][42] = { + "in target", + "while evaluating variable", + "while evaluating condition", + "while evaluating then-branch of condition", + "while evaluating else-branch of condition", + "while evaluating", + }; EvalStackElement *elem = evalStack.elems + i; - Buf_AddStr(buf, - elem->kind == VSK_TARGET ? "in target \"" : - elem->kind == VSK_EXPR ? "while evaluating \"" : - "while evaluating variable \""); + Buf_AddStr(buf, descr[elem->kind]); + Buf_AddStr(buf, " \""); Buf_AddStr(buf, elem->str); Buf_AddStr(buf, "\": "); } @@ -3443,6 +3452,7 @@ ApplyModifier_IfElse(const char **pp, Mo CondResult cond_rc = CR_TRUE; /* just not CR_ERROR */ if (Expr_ShouldEval(expr)) { + evalStack.elems[evalStack.len - 1].kind = VSK_COND; cond_rc = Cond_EvalCondition(expr->name); if (cond_rc == CR_TRUE) then_emode = expr->emode; @@ -3450,11 +3460,13 @@ ApplyModifier_IfElse(const char **pp, Mo else_emode = expr->emode; } + evalStack.elems[evalStack.len - 1].kind = VSK_COND_THEN; (*pp)++; /* skip past the '?' */ if (!ParseModifierPart(pp, ':', ':', then_emode, ch, , NULL, NULL)) return AMR_CLEANUP; + evalStack.elems[evalStack.len - 1].kind = VSK_COND_ELSE; if (!ParseModifierPart(pp, ch->endc, ch->endc, else_emode, ch, , NULL, NULL)) { LazyBuf_Done(); @@ -3464,12 +3476,8 @@ ApplyModifier_IfElse(const char **pp, Mo (*pp)--; /* Go back to the ch->endc. */ if (cond_rc == CR_ERROR) { - Substring thenExpr = LazyBuf_Get(); - Substring elseExpr = LazyBuf_Get(); - Error("Bad conditional expression '%s' before '?%.*s:%.*s'", - expr->name, - (int)Substring_Length(thenExpr), thenExpr.start, - (int)Substring_Length(elseExpr), elseExpr.start); + evalStack.elems[evalStack.len - 1].kind = VSK_COND; + Parse_Error(PARSE_FATAL, "Bad condition"); LazyBuf_Done(); LazyBuf_Done(); return AMR_CLEANUP; Index: src/usr.bin/make/unit-tests/cond-late.exp diff -u src/usr.bin/make/unit-tests/cond-late.exp:1.5 src/usr.bin/make/unit-tests/cond-late.exp:1.6 --- src/usr.bin/make/unit-tests/cond-late.exp:1.5 Sun Dec 10 20:12:28 2023 +++ src/usr.bin/make/unit-tests/cond-late.exp Sun Jun 30 13:01:01 2024 @@ -1,4 +1,6 @@ -make: Bad conditional expression ' != "no"' before '?:' +make: "cond-late.mk" line 38: while evaluating variable "VAR": while evaluating condition " != "no"": Bad condition +make: Fatal errors encountered -- cannot continue +make: stopped in unit-tests yes no exit status 0 Index: src/usr.bin/make/unit-tests/cond-late.mk diff -u src/usr.bin/make/unit-tests/cond-late.mk:1.6 src/usr.bin/make/unit-tests/cond-late.mk:1.7 --- src/usr.bin/make/unit-tests/cond-late.mk:1.6 Sun Dec 10 20:12:28 2023 +++ src/usr.bin/make/unit-tests/cond-late.mk Sun Jun 30 13:01:01 2024 @@ -1,4 +1,4 @@ -# $NetBSD: cond-late.mk,v 1.6 2023/12/10 20:12:28 rillig Exp $ +# $NetBSD: cond-late.mk,v 1.7 2024/06/30 13:01:01 rillig Exp $ # # Using the :? modifier,
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Jun 30 13:01:01 UTC 2024 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: cond-late.exp cond-late.mk varmod-ifelse.exp varmod-ifelse.mk Log Message: make: error out on syntax error in conditions in ':?then:else' modifier The 'Error' function only reports errors but does not affect the exit status, the 'Parse_Error' function does, while providing more details to find the cause of the syntax error. To generate a diff of this commit: cvs rdiff -u -r1.1123 -r1.1124 src/usr.bin/make/var.c cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/cond-late.exp cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/cond-late.mk cvs rdiff -u -r1.20 -r1.21 src/usr.bin/make/unit-tests/varmod-ifelse.exp cvs rdiff -u -r1.29 -r1.30 src/usr.bin/make/unit-tests/varmod-ifelse.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Jun 30 11:44:14 UTC 2024 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: varmod-assign-shell.exp varmod-assign-shell.mk varmod-assign.exp Log Message: make: sync error handling between '!=' assignment and '::!=' modifier To generate a diff of this commit: cvs rdiff -u -r1.1122 -r1.1123 src/usr.bin/make/var.c cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/varmod-assign-shell.exp \ src/usr.bin/make/unit-tests/varmod-assign-shell.mk cvs rdiff -u -r1.21 -r1.22 src/usr.bin/make/unit-tests/varmod-assign.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Jun 30 11:44:14 UTC 2024 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: varmod-assign-shell.exp varmod-assign-shell.mk varmod-assign.exp Log Message: make: sync error handling between '!=' assignment and '::!=' modifier To generate a diff of this commit: cvs rdiff -u -r1.1122 -r1.1123 src/usr.bin/make/var.c cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/varmod-assign-shell.exp \ src/usr.bin/make/unit-tests/varmod-assign-shell.mk cvs rdiff -u -r1.21 -r1.22 src/usr.bin/make/unit-tests/varmod-assign.exp 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.1122 src/usr.bin/make/var.c:1.1123 --- src/usr.bin/make/var.c:1.1122 Sun Jun 30 11:00:06 2024 +++ src/usr.bin/make/var.c Sun Jun 30 11:44:14 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.1122 2024/06/30 11:00:06 rillig Exp $ */ +/* $NetBSD: var.c,v 1.1123 2024/06/30 11:44:14 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -132,7 +132,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.1122 2024/06/30 11:00:06 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.1123 2024/06/30 11:44:14 rillig Exp $"); /* * Variables are defined using one of the VAR=value assignments. Their @@ -3557,7 +3557,7 @@ found_op: char *output, *error; output = Cmd_Exec(val.str, ); if (error != NULL) { - Error("%s", error); + Parse_Error(PARSE_WARNING, "%s", error); free(error); } else Var_Set(scope, expr->name, output); Index: src/usr.bin/make/unit-tests/varmod-assign-shell.exp diff -u src/usr.bin/make/unit-tests/varmod-assign-shell.exp:1.6 src/usr.bin/make/unit-tests/varmod-assign-shell.exp:1.7 --- src/usr.bin/make/unit-tests/varmod-assign-shell.exp:1.6 Sun Jun 30 11:37:21 2024 +++ src/usr.bin/make/unit-tests/varmod-assign-shell.exp Sun Jun 30 11:44:14 2024 @@ -1,10 +1,10 @@ -make: "varmod-assign-shell.mk" line 28: warning: Command "echo output; (exit 13)" exited with status 13 +make: "varmod-assign-shell.mk" line 21: warning: Command "echo output; (exit 13)" exited with status 13 Global: _ = # (empty) Var_Parse: ${ASSIGNED::!=echo output; ${:U(exit 13)}} (eval-keep-dollar-and-undefined) Evaluating modifier ${ASSIGNED::...} on value "previous" (eval-keep-dollar-and-undefined, regular) Modifier part: "echo output; (exit 13)" Capturing the output of command "echo output; (exit 13)" -make: Command "echo output; (exit 13)" exited with status 13 +make: "varmod-assign-shell.mk" line 26: warning: while evaluating variable "ASSIGNED": Command "echo output; (exit 13)" exited with status 13 Result of ${ASSIGNED::!=echo output; ${:U(exit 13)}} is "" (eval-keep-dollar-and-undefined, regular) Global: _ = # (empty) Global: .MAKEFLAGS = -r -k -d v -d Index: src/usr.bin/make/unit-tests/varmod-assign-shell.mk diff -u src/usr.bin/make/unit-tests/varmod-assign-shell.mk:1.6 src/usr.bin/make/unit-tests/varmod-assign-shell.mk:1.7 --- src/usr.bin/make/unit-tests/varmod-assign-shell.mk:1.6 Sun Jun 30 11:37:21 2024 +++ src/usr.bin/make/unit-tests/varmod-assign-shell.mk Sun Jun 30 11:44:14 2024 @@ -1,4 +1,4 @@ -# $NetBSD: varmod-assign-shell.mk,v 1.6 2024/06/30 11:37:21 rillig Exp $ +# $NetBSD: varmod-assign-shell.mk,v 1.7 2024/06/30 11:44:14 rillig Exp $ # # Tests for the variable modifier '::!=', which assigns the output of a shell # command to the variable, but only if the command exited successfully. This @@ -15,20 +15,14 @@ # error message instead of the command that was executed. That's where the # counterintuitive error message 'make: "previous" returned non-zero status' # comes from. -# -# BUGS -# Even though the variable modifier '::!=' produces an error message, -# the exit status of make is still 0. -# -# Having an error message instead of a warning like for the variable -# assignment operator '!=' is another unnecessary inconsistency. DIRECT= previous # expect+1: warning: Command "echo output; (exit 13)" exited with status 13 DIRECT!= echo output; (exit 13) ASSIGNED= previous -.MAKEFLAGS: -dv # to see the actual command +.MAKEFLAGS: -dv # to see the "Capturing" debug output +# expect+1: warning: while evaluating variable "ASSIGNED": Command "echo output; (exit 13)" exited with status 13 _:= ${ASSIGNED::!=echo output; ${:U(exit 13)}} .MAKEFLAGS: -d0 Index: src/usr.bin/make/unit-tests/varmod-assign.exp diff -u src/usr.bin/make/unit-tests/varmod-assign.exp:1.21 src/usr.bin/make/unit-tests/varmod-assign.exp:1.22 --- src/usr.bin/make/unit-tests/varmod-assign.exp:1.21 Sun Jun 30 11:37:21 2024 +++ src/usr.bin/make/unit-tests/varmod-assign.exp Sun Jun 30 11:44:14 2024 @@ -48,7 +48,7 @@ sysv:y make: Unfinished modifier for "ASSIGN" ('}' missing) ok=word -make: Command " echo word; (exit 13) " exited with status
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Jun 30 11:37:21 UTC 2024 Modified Files: src/usr.bin/make: main.c src/usr.bin/make/unit-tests: var-op-shell.exp var-op-shell.mk varmod-assign-shell.exp varmod-assign-shell.mk varmod-assign.exp varmod-assign.mk varmod-shell.exp varmod-shell.mk varmod-sun-shell.exp varmod-sun-shell.mk Log Message: make: add detailed exit status to message for failed sub-commands Several commands communicate via the exit status and not only distinguish between zero and non-zero, so make this information available to ease investigations. The command "false" is not guaranteed to exit with a consistent status, so use "(exit 13)" instead in the tests, to keep these tests portable across different operating systems. The exit status 127 is required for a shell that cannot find a command, so keep that one. To generate a diff of this commit: cvs rdiff -u -r1.624 -r1.625 src/usr.bin/make/main.c cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/var-op-shell.exp \ src/usr.bin/make/unit-tests/varmod-shell.exp cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/var-op-shell.mk \ src/usr.bin/make/unit-tests/varmod-shell.mk cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/varmod-assign-shell.exp \ src/usr.bin/make/unit-tests/varmod-assign-shell.mk cvs rdiff -u -r1.20 -r1.21 src/usr.bin/make/unit-tests/varmod-assign.exp \ src/usr.bin/make/unit-tests/varmod-assign.mk cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/varmod-sun-shell.exp cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/varmod-sun-shell.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/main.c diff -u src/usr.bin/make/main.c:1.624 src/usr.bin/make/main.c:1.625 --- src/usr.bin/make/main.c:1.624 Sun Jun 2 15:31:26 2024 +++ src/usr.bin/make/main.c Sun Jun 30 11:37:21 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.624 2024/06/02 15:31:26 rillig Exp $ */ +/* $NetBSD: main.c,v 1.625 2024/06/30 11:37:21 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -111,7 +111,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.624 2024/06/02 15:31:26 rillig Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.625 2024/06/30 11:37:21 rillig Exp $"); #if defined(MAKE_NATIVE) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -1784,10 +1784,15 @@ Cmd_Exec(const char *cmd, char **error) if (WIFSIGNALED(status)) *error = str_concat3("\"", cmd, "\" exited on a signal"); - else if (WEXITSTATUS(status) != 0) - *error = str_concat3( - "\"", cmd, "\" returned non-zero status"); - else if (saved_errno != 0) + else if (WEXITSTATUS(status) != 0) { + Buffer errBuf; + Buf_Init(); + Buf_AddStr(, "Command \""); + Buf_AddStr(, cmd); + Buf_AddStr(, "\" exited with status "); + Buf_AddInt(, WEXITSTATUS(status)); + *error = Buf_DoneData(); + } else if (saved_errno != 0) *error = str_concat3( "Couldn't read shell's output for \"", cmd, "\""); else Index: src/usr.bin/make/unit-tests/var-op-shell.exp diff -u src/usr.bin/make/unit-tests/var-op-shell.exp:1.6 src/usr.bin/make/unit-tests/var-op-shell.exp:1.7 --- src/usr.bin/make/unit-tests/var-op-shell.exp:1.6 Thu Jun 1 20:56:35 2023 +++ src/usr.bin/make/unit-tests/var-op-shell.exp Sun Jun 30 11:37:21 2024 @@ -1,8 +1,8 @@ -make: "var-op-shell.mk" line 32: warning: "echo "failed"; false" returned non-zero status -make: "var-op-shell.mk" line 39: warning: "false" returned non-zero status +make: "var-op-shell.mk" line 32: warning: Command "echo "failed"; (exit 13)" exited with status 13 +make: "var-op-shell.mk" line 39: warning: Command "exit 13" exited with status 13 make: "var-op-shell.mk" line 62: warning: "kill $$" exited on a signal /bin/no/such/command: not found -make: "var-op-shell.mk" line 69: warning: "/bin/no/such/command" returned non-zero status +make: "var-op-shell.mk" line 69: warning: Command "/bin/no/such/command" exited with status 127 stderr Capturing the output of command "echo ''" Global: OUTPUT = Index: src/usr.bin/make/unit-tests/varmod-shell.exp diff -u src/usr.bin/make/unit-tests/varmod-shell.exp:1.6 src/usr.bin/make/unit-tests/varmod-shell.exp:1.7 --- src/usr.bin/make/unit-tests/varmod-shell.exp:1.6 Sun Jun 30 11:00:06 2024 +++ src/usr.bin/make/unit-tests/varmod-shell.exp Sun Jun 30 11:37:21 2024 @@ -1,12 +1,12 @@ -make: "varmod-shell.mk" line 25: warning: while evaluating "${:!echo word; false!} != "word"": "echo word; false" returned non-zero status -make: "varmod-shell.mk" line 29: warning: while evaluating "${:Uprevious value:!echo word; false!} != "word"": "echo word; false" returned non-zero status +make: "varmod-shell.mk" line 25: warning: while evaluating "${:!echo word; (exit 13)!} != "word"": Command "echo word; (exit
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Jun 30 11:37:21 UTC 2024 Modified Files: src/usr.bin/make: main.c src/usr.bin/make/unit-tests: var-op-shell.exp var-op-shell.mk varmod-assign-shell.exp varmod-assign-shell.mk varmod-assign.exp varmod-assign.mk varmod-shell.exp varmod-shell.mk varmod-sun-shell.exp varmod-sun-shell.mk Log Message: make: add detailed exit status to message for failed sub-commands Several commands communicate via the exit status and not only distinguish between zero and non-zero, so make this information available to ease investigations. The command "false" is not guaranteed to exit with a consistent status, so use "(exit 13)" instead in the tests, to keep these tests portable across different operating systems. The exit status 127 is required for a shell that cannot find a command, so keep that one. To generate a diff of this commit: cvs rdiff -u -r1.624 -r1.625 src/usr.bin/make/main.c cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/var-op-shell.exp \ src/usr.bin/make/unit-tests/varmod-shell.exp cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/var-op-shell.mk \ src/usr.bin/make/unit-tests/varmod-shell.mk cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/varmod-assign-shell.exp \ src/usr.bin/make/unit-tests/varmod-assign-shell.mk cvs rdiff -u -r1.20 -r1.21 src/usr.bin/make/unit-tests/varmod-assign.exp \ src/usr.bin/make/unit-tests/varmod-assign.mk cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/varmod-sun-shell.exp cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/varmod-sun-shell.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Jun 30 11:00:06 UTC 2024 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: varmod-shell.exp varmod-shell.mk varmod-sun-shell.exp varmod-sun-shell.mk Log Message: make: add more context to "returned non-zero status" message Previously, this message was an "error" but had no influence on the exit status, so make it a warning instead. In the seldom used -W mode that treats warnings as errors, this change influences the exit status. To generate a diff of this commit: cvs rdiff -u -r1.1121 -r1.1122 src/usr.bin/make/var.c cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/varmod-shell.exp cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/varmod-shell.mk cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/varmod-sun-shell.exp cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/varmod-sun-shell.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.1121 src/usr.bin/make/var.c:1.1122 --- src/usr.bin/make/var.c:1.1121 Sat Jun 15 22:06:30 2024 +++ src/usr.bin/make/var.c Sun Jun 30 11:00:06 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.1121 2024/06/15 22:06:30 rillig Exp $ */ +/* $NetBSD: var.c,v 1.1122 2024/06/30 11:00:06 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -132,7 +132,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.1121 2024/06/15 22:06:30 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.1122 2024/06/30 11:00:06 rillig Exp $"); /* * Variables are defined using one of the VAR=value assignments. Their @@ -2632,8 +2632,7 @@ ApplyModifier_ShellCommand(const char ** output = Cmd_Exec(cmd.str, ); Expr_SetValueOwn(expr, output); if (error != NULL) { - /* XXX: why still return AMR_OK? */ - Error("%s", error); + Parse_Error(PARSE_WARNING, "%s", error); free(error); } } else @@ -3746,7 +3745,7 @@ ApplyModifier_SunShell(const char **pp, char *output, *error; output = Cmd_Exec(Expr_Str(expr), ); if (error != NULL) { - Error("%s", error); + Parse_Error(PARSE_WARNING, "%s", error); free(error); } Expr_SetValueOwn(expr, output); Index: src/usr.bin/make/unit-tests/varmod-shell.exp diff -u src/usr.bin/make/unit-tests/varmod-shell.exp:1.5 src/usr.bin/make/unit-tests/varmod-shell.exp:1.6 --- src/usr.bin/make/unit-tests/varmod-shell.exp:1.5 Sat Mar 26 14:34:07 2022 +++ src/usr.bin/make/unit-tests/varmod-shell.exp Sun Jun 30 11:00:06 2024 @@ -1,11 +1,11 @@ -make: "echo word; false" returned non-zero status -make: "echo word; false" returned non-zero status +make: "varmod-shell.mk" line 25: warning: while evaluating "${:!echo word; false!} != "word"": "echo word; false" returned non-zero status +make: "varmod-shell.mk" line 29: warning: while evaluating "${:Uprevious value:!echo word; false!} != "word"": "echo word; false" returned non-zero status Global: _ = # (empty) Var_Parse: ${:!echo word; ${:Ufalse}!} (eval-keep-dollar-and-undefined) Evaluating modifier ${:!...} on value "" (eval-keep-dollar-and-undefined, undefined) Modifier part: "echo word; false" Capturing the output of command "echo word; false" -make: "echo word; false" returned non-zero status +make: "varmod-shell.mk" line 36: warning: while evaluating "${:!echo word; ${:Ufalse}!}": "echo word; false" returned non-zero status Result of ${:!echo word; ${:Ufalse}!} is "word" (eval-keep-dollar-and-undefined, defined) Global: _ = word Global: .MAKEFLAGS = -r -k -d v -d Index: src/usr.bin/make/unit-tests/varmod-shell.mk diff -u src/usr.bin/make/unit-tests/varmod-shell.mk:1.7 src/usr.bin/make/unit-tests/varmod-shell.mk:1.8 --- src/usr.bin/make/unit-tests/varmod-shell.mk:1.7 Mon Jan 10 20:32:29 2022 +++ src/usr.bin/make/unit-tests/varmod-shell.mk Sun Jun 30 11:00:06 2024 @@ -1,4 +1,4 @@ -# $NetBSD: varmod-shell.mk,v 1.7 2022/01/10 20:32:29 rillig Exp $ +# $NetBSD: varmod-shell.mk,v 1.8 2024/06/30 11:00:06 rillig Exp $ # # Tests for the ':!cmd!' variable modifier, which runs the shell command # given by the variable modifier and returns its output. @@ -21,16 +21,20 @@ # Between 2000-04-29 and 2020-11-17, the error message mentioned the previous # value of the expression (which is usually an empty string) instead of the # command that was executed. +# expect+1: warning: while evaluating "${:!echo word; false!} != "word"": "echo word; false" returned non-zero status .if ${:!echo word; false!} != "word" . error .endif +# expect+1: warning: while evaluating "${:Uprevious value:!echo word; false!} != "word"": "echo word; false" returned non-zero status .if ${:Uprevious value:!echo word; false!} != "word" . error .endif -.MAKEFLAGS: -dv # to see the actual command +.MAKEFLAGS: -dv # to see the "Capturing" debug output +# expect+1: warning: while evaluating
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Jun 30 11:00:06 UTC 2024 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: varmod-shell.exp varmod-shell.mk varmod-sun-shell.exp varmod-sun-shell.mk Log Message: make: add more context to "returned non-zero status" message Previously, this message was an "error" but had no influence on the exit status, so make it a warning instead. In the seldom used -W mode that treats warnings as errors, this change influences the exit status. To generate a diff of this commit: cvs rdiff -u -r1.1121 -r1.1122 src/usr.bin/make/var.c cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/varmod-shell.exp cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/varmod-shell.mk cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/varmod-sun-shell.exp cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/varmod-sun-shell.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Fri Jun 28 15:20:57 UTC 2024 Modified Files: src/usr.bin/make: job.c job.h Log Message: make: reduce usage of the UNCONST hack To generate a diff of this commit: cvs rdiff -u -r1.477 -r1.478 src/usr.bin/make/job.c cvs rdiff -u -r1.78 -r1.79 src/usr.bin/make/job.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Fri Jun 28 15:20:57 UTC 2024 Modified Files: src/usr.bin/make: job.c job.h Log Message: make: reduce usage of the UNCONST hack To generate a diff of this commit: cvs rdiff -u -r1.477 -r1.478 src/usr.bin/make/job.c cvs rdiff -u -r1.78 -r1.79 src/usr.bin/make/job.h 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/job.c diff -u src/usr.bin/make/job.c:1.477 src/usr.bin/make/job.c:1.478 --- src/usr.bin/make/job.c:1.477 Tue Jun 25 05:18:38 2024 +++ src/usr.bin/make/job.c Fri Jun 28 15:20:57 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.477 2024/06/25 05:18:38 rillig Exp $ */ +/* $NetBSD: job.c,v 1.478 2024/06/28 15:20:57 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -141,7 +141,7 @@ #include "trace.h" /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: job.c,v 1.477 2024/06/25 05:18:38 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.478 2024/06/28 15:20:57 rillig Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -399,7 +399,7 @@ static Shell shells[] = { * It is set by the Job_ParseShell function. */ static Shell *shell = [DEFSHELL_INDEX]; -const char *shellPath = NULL; /* full pathname of executable image */ +char *shellPath; /* full pathname of executable image */ const char *shellName = NULL; /* last component of shellPath */ char *shellErrFlag = NULL; static char *shell_freeIt = NULL; /* Allocated memory for custom .SHELL */ @@ -2473,13 +2473,13 @@ Job_ParseShell(char *line) * Shell_Init has already been called! * Do it again. */ -free(UNCONST(shellPath)); +free(shellPath); shellPath = NULL; Shell_Init(); } } } else { - free(UNCONST(shellPath)); + free(shellPath); shellPath = bmake_strdup(path); shellName = newShell.name != NULL ? newShell.name : str_basename(path); Index: src/usr.bin/make/job.h diff -u src/usr.bin/make/job.h:1.78 src/usr.bin/make/job.h:1.79 --- src/usr.bin/make/job.h:1.78 Tue Dec 19 19:33:39 2023 +++ src/usr.bin/make/job.h Fri Jun 28 15:20:57 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: job.h,v 1.78 2023/12/19 19:33:39 rillig Exp $ */ +/* $NetBSD: job.h,v 1.79 2024/06/28 15:20:57 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -179,7 +179,7 @@ typedef struct Job { #endif } Job; -extern const char *shellPath; +extern char *shellPath; extern const char *shellName; extern char *shellErrFlag;