Merge bmake-20240711

Merge commit '84691af93185c692058ba55fa81a04103f5bf71b'
This commit is contained in:
Simon J. Gerraty 2024-07-20 12:43:11 -07:00
commit 226192822c
197 changed files with 2573 additions and 2033 deletions

View File

@ -1,3 +1,86 @@
2024-07-13 Simon J Gerraty <sjg@beast.crufty.net>
* cleanup redundant differences from NetBSD make
o parse.c: no longer uses mmap
o var.c: check __STDC_VERSION__ not __STDC__
2024-07-12 Simon J Gerraty <sjg@beast.crufty.net>
* Apply some patches from NetBSD pkgsrc to reduce divergence
o meta.c: requires sys/select.h if available
o var.c: ensure SIZE_MAX has a value
o util.c: ensure SA_RESTART is defined
* configure.in: use *ksh* rather than just *ksh to match
ksh shell specification.
* unit-tests/Makefile: expand BROKEN_TESTS for ksh and
mksh in particular
2024-07-11 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20240711
Merge with NetBSD make, pick up
o compat.c: allow Compat_RunCommand to also handle very long
commands by writing to a temp file when needed.
o main.c: extract the temp file logic recently added to Cmd_Exec
to Cmd_Argv so it can be leveraged by Compat_RunCommand.
2024-07-09 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20240709
Merge with NetBSD make, pick up
o error out on parse/evaluation errors in shell commands
o var.c: error out on syntax errors in ':M' and ':N' modifiers
2024-07-07 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20240707
Merge with NetBSD make, pick up
o only generate code for cleanup functions in CLEANUP mode
o hash.c: don't track hash table chain lengths during lookup
unless debugging
o main.c: move initialization of variable scopes to targ.c
o var.c: remove Var_End as it is now unnecessary
2024-07-06 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20240706
Merge with NetBSD make, pick up
o reduce lint comments about ARGSUSED
o cond.c: error out on conditions containing the operators '&' and '|'
o str.c: error out on a matching malformed matching pattern '[['
o var.c: in error messages, distinguish parsing from evaluating
in error messages for anonymous variables, log the value
error out on unclosed expressions during parse time
2024-07-04 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20240704
Merge with NetBSD make, pick up
o add more context information to error messages
o main.c: on error, print the targets to be made
add detailed exit status to message for failed sub-commands
o var.c: error out on the "Bad modifier" error message
2024-07-01 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20240701
Merge with NetBSD make, pick up
o var.c: add :tt for Title case
2024-06-30 Simon J Gerraty <sjg@beast.crufty.net>
* configure.in: 20240630 further refine check for whether
TZ=Europe/Berlin works
* VERSION (_MAKE_VERSION): 20240630
Merge with NetBSD make, pick up
o job.c: reduce use of UNCONST
o main.c: add detailed exit status to message for failed sub-commands
o var.c: error out on some more syntax errors
add more context to "returned non-zero status" message
2024-06-25 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20240625

View File

@ -759,6 +759,8 @@ unit-tests/varmod-to-one-word.exp
unit-tests/varmod-to-one-word.mk
unit-tests/varmod-to-separator.exp
unit-tests/varmod-to-separator.mk
unit-tests/varmod-to-title.exp
unit-tests/varmod-to-title.mk
unit-tests/varmod-to-upper.exp
unit-tests/varmod-to-upper.mk
unit-tests/varmod-undefined.exp

View File

@ -1,2 +1,2 @@
# keep this compatible with sh and make
_MAKE_VERSION=20240625
_MAKE_VERSION=20240711

View File

@ -1,4 +1,4 @@
/* $NetBSD: arch.c,v 1.219 2024/06/02 15:31:25 rillig Exp $ */
/* $NetBSD: arch.c,v 1.221 2024/07/07 07:50:57 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -147,7 +147,7 @@ struct ar_hdr {
#include "dir.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.221 2024/07/07 07:50:57 rillig Exp $");
typedef struct List ArchList;
typedef struct ListNode ArchListNode;
@ -818,7 +818,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)
{
@ -919,7 +918,6 @@ Arch_FindLib(GNode *gn, SearchPath *path)
Var_Set(gn, TARGET, gn->name);
}
/* ARGSUSED */
static bool
RanlibOODate(const GNode *gn MAKE_ATTR_UNUSED)
{
@ -999,18 +997,18 @@ Arch_Init(void)
Lst_Init(&archives);
}
#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(&archives);
#endif
}
#endif
bool
Arch_IsLib(GNode *gn)

View File

@ -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 BMAKE 1
.Os
.Sh NAME
@ -1575,6 +1575,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

View File

@ -506,27 +506,27 @@ VVAARRIIAABBLLEE AASSSSIIGGNNMMEENNTTSS
The seven built-in local variables are:
_._A_L_L_S_R_C The list of all sources for this target; also known
as `_>'.
_._A_L_L_S_R_C The list of all sources for this target; also known as
`_>'.
_._A_R_C_H_I_V_E The name of the archive file; also known as `_!'.
_._A_R_C_H_I_V_E The name of the archive file; also known as `_!'.
_._I_M_P_S_R_C In suffix-transformation rules, the name/path of the
source from which the target is to be transformed
(the "implied" source); also known as `_<'. It is not
defined in explicit rules.
_._I_M_P_S_R_C In suffix-transformation rules, the name/path of the
source from which the target is to be transformed (the
"implied" source); also known as `_<'. It is not defined
in explicit rules.
_._M_E_M_B_E_R The name of the archive member; also known as `_%'.
_._M_E_M_B_E_R The name of the archive member; also known as `_%'.
_._O_O_D_A_T_E The list of sources for this target that were deemed
out-of-date; also known as `_?'.
_._O_O_D_A_T_E The list of sources for this target that were deemed out-
of-date; also known as `_?'.
_._P_R_E_F_I_X The name of the target with suffix (if declared in
..SSUUFFFFIIXXEESS) removed; also known as `_*'.
_._P_R_E_F_I_X The name of the target with suffix (if declared in
..SSUUFFFFIIXXEESS) removed; also known as `_*'.
_._T_A_R_G_E_T The name of the target; also known as `_@'. For
compatibility with other makes this is an alias for
_._A_R_C_H_I_V_E in archive member rules.
_._T_A_R_G_E_T The name of the target; also known as `_@'. For
compatibility with other makes this is an alias for
_._A_R_C_H_I_V_E in archive member rules.
The shorter forms (`_>', `_!', `_<', `_%', `_?', `_*', and `_@') are permitted
for backward compatibility with historical makefiles and legacy POSIX
@ -1021,6 +1021,9 @@ VVAARRIIAABBLLEE AASSSSIIGGNNMMEENNTTSS
separator is used. The common escapes (including octal numeric
codes) work as expected.
::tttt Converts the first character of each word to upper-case, and the
rest to lower-case letters.
::ttuu Converts the value to upper-case letters.
::ttWW Causes subsequent modifiers to treat the value as a single word
@ -1625,37 +1628,33 @@ SSPPEECCIIAALL TTAARRGGEETTSS
..SSHHEELLLL Sets the shell that bbmmaakkee uses to execute commands. The sources
are a set of _f_i_e_l_d==_v_a_l_u_e pairs.
name This is the minimal specification, used to
select one of the built-in shell specs; sh, ksh,
and csh.
name This is the minimal specification, used to select
one of the built-in shell specs; sh, ksh, and csh.
path Specifies the absolute path to the shell.
path Specifies the absolute path to the shell.
hasErrCtl Indicates whether the shell supports exit on
error.
hasErrCtl Indicates whether the shell supports exit on error.
check The command to turn on error checking.
check The command to turn on error checking.
ignore The command to disable error checking.
ignore The command to disable error checking.
echo The command to turn on echoing of commands
executed.
echo The command to turn on echoing of commands executed.
quiet The command to turn off echoing of commands
executed.
quiet The command to turn off echoing of commands
executed.
filter The output to filter after issuing the quiet
command. It is typically identical to quiet.
filter The output to filter after issuing the quiet
command. It is typically identical to quiet.
errFlag The flag to pass the shell to enable error
checking.
errFlag The flag to pass the shell to enable error checking.
echoFlag The flag to pass the shell to enable command
echoing.
echoFlag The flag to pass the shell to enable command
echoing.
newline The string literal to pass the shell that
results in a single newline character when used
outside of any quoting characters.
newline The string literal to pass the shell that results in
a single newline character when used outside of any
quoting characters.
Example:
.SHELL: name=ksh path=/bin/ksh hasErrCtl=true \
@ -1788,4 +1787,4 @@ BBUUGGSS
attempt to suppress a cascade of unnecessary errors, can result in a
seemingly unexplained `*** Error code 6'
FreeBSD 13.2-RELEASE-p11 June 1, 2024 FreeBSD 13.2-RELEASE-p11
FreeBSD 14.1-RELEASE July 1, 2024 FreeBSD 14.1-RELEASE

Before

Width:  |  Height:  |  Size: 90 KiB

After

Width:  |  Height:  |  Size: 90 KiB

View File

@ -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.
@ -94,7 +94,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;
@ -249,6 +249,8 @@ Compat_RunCommand(const char *cmdp, GNode *gn, StringListNode *ln)
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);
@ -319,20 +321,20 @@ Compat_RunCommand(const char *cmdp, GNode *gn, StringListNode *ln)
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;
@ -425,6 +427,8 @@ Compat_RunCommand(const char *cmdp, GNode *gn, StringListNode *ln)
}
free(cmdStart);
if (cmd_file[0] != '\0')
unlink(cmd_file);
compatChild = 0;
if (compatSigno != 0) {
bmake_signal(compatSigno, SIG_DFL);

View File

@ -1,4 +1,4 @@
/* $NetBSD: cond.c,v 1.365 2024/06/02 15:31:25 rillig Exp $ */
/* $NetBSD: cond.c,v 1.366 2024/07/06 21:21:09 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.365 2024/06/02 15:31:25 rillig Exp $");
MAKE_RCSID("$NetBSD: cond.c,v 1.366 2024/07/06 21:21:09 rillig Exp $");
/*
* Conditional expressions conform to this grammar:
@ -780,7 +780,7 @@ CondParser_Token(CondParser *par, bool doEval)
par->p++;
if (par->p[0] == '|')
par->p++;
else if (opts.strict) {
else {
Parse_Error(PARSE_FATAL, "Unknown operator '|'");
par->printedError = true;
return TOK_ERROR;
@ -791,7 +791,7 @@ CondParser_Token(CondParser *par, bool doEval)
par->p++;
if (par->p[0] == '&')
par->p++;
else if (opts.strict) {
else {
Parse_Error(PARSE_FATAL, "Unknown operator '&'");
par->printedError = true;
return TOK_ERROR;

View File

@ -15,24 +15,24 @@
/* Define to 1 if you have the <ar.h> header file. */
#undef HAVE_AR_H
/* Define to 1 if you have the declaration of `sys_siglist', and to 0 if you
/* Define to 1 if you have the declaration of 'sys_siglist', and to 0 if you
don't. */
#undef HAVE_DECL_SYS_SIGLIST
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
/* Define to 1 if you have the <dirent.h> header file, and it defines 'DIR'.
*/
#undef HAVE_DIRENT_H
/* Define to 1 if you have the `dirname' function. */
/* Define to 1 if you have the 'dirname' function. */
#undef HAVE_DIRNAME
/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
/* Define to 1 if you don't have 'vprintf' but do have '_doprnt.' */
#undef HAVE_DOPRNT
/* Define to 1 if you have the `err' function. */
/* Define to 1 if you have the 'err' function. */
#undef HAVE_ERR
/* Define to 1 if you have the `errx' function. */
/* Define to 1 if you have the 'errx' function. */
#undef HAVE_ERRX
/* Define to 1 if you have the <err.h> header file. */
@ -41,25 +41,25 @@
/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define to 1 if you have the `fork' function. */
/* Define to 1 if you have the 'fork' function. */
#undef HAVE_FORK
/* Define to 1 if you have the `getcwd' function. */
/* Define to 1 if you have the 'getcwd' function. */
#undef HAVE_GETCWD
/* Define to 1 if you have the `getenv' function. */
/* Define to 1 if you have the 'getenv' function. */
#undef HAVE_GETENV
/* Define to 1 if you have the `getopt' function. */
/* Define to 1 if you have the 'getopt' function. */
#undef HAVE_GETOPT
/* Define to 1 if you have the `getwd' function. */
/* Define to 1 if you have the 'getwd' function. */
#undef HAVE_GETWD
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the `killpg' function. */
/* Define to 1 if you have the 'killpg' function. */
#undef HAVE_KILLPG
/* Define to 1 if you have the <libgen.h> header file. */
@ -68,16 +68,13 @@
/* Define to 1 if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
/* Define to 1 if the system has the type `long long int'. */
/* Define to 1 if the system has the type 'long long int'. */
#undef HAVE_LONG_LONG_INT
/* Define to 1 if you have the <minix/config.h> header file. */
#undef HAVE_MINIX_CONFIG_H
/* Define to 1 if you have the `mmap' function. */
#undef HAVE_MMAP
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
/* Define to 1 if you have the <ndir.h> header file, and it defines 'DIR'. */
#undef HAVE_NDIR_H
/* Define to 1 if you have the <paths.h> header file. */
@ -86,58 +83,58 @@
/* Define to 1 if you have the <poll.h> header file. */
#undef HAVE_POLL_H
/* Define to 1 if you have the `putenv' function. */
/* Define to 1 if you have the 'putenv' function. */
#undef HAVE_PUTENV
/* Define to 1 if you have the <ranlib.h> header file. */
#undef HAVE_RANLIB_H
/* Define to 1 if you have the `realpath' function. */
/* Define to 1 if you have the 'realpath' function. */
#undef HAVE_REALPATH
/* Define to 1 if you have the <regex.h> header file. */
#undef HAVE_REGEX_H
/* Define to 1 if you have the `select' function. */
/* Define to 1 if you have the 'select' function. */
#undef HAVE_SELECT
/* Define to 1 if you have the `setenv' function. */
/* Define to 1 if you have the 'setenv' function. */
#undef HAVE_SETENV
/* Define to 1 if you have the `setpgid' function. */
/* Define to 1 if you have the 'setpgid' function. */
#undef HAVE_SETPGID
/* Define to 1 if you have the `setrlimit' function. */
/* Define to 1 if you have the 'setrlimit' function. */
#undef HAVE_SETRLIMIT
/* Define to 1 if you have the `setsid' function. */
/* Define to 1 if you have the 'setsid' function. */
#undef HAVE_SETSID
/* Define to 1 if you have the `sigaction' function. */
/* Define to 1 if you have the 'sigaction' function. */
#undef HAVE_SIGACTION
/* Define to 1 if you have the `sigaddset' function. */
/* Define to 1 if you have the 'sigaddset' function. */
#undef HAVE_SIGADDSET
/* Define to 1 if you have the `sigpending' function. */
/* Define to 1 if you have the 'sigpending' function. */
#undef HAVE_SIGPENDING
/* Define to 1 if you have the `sigprocmask' function. */
/* Define to 1 if you have the 'sigprocmask' function. */
#undef HAVE_SIGPROCMASK
/* Define to 1 if you have the `sigsetmask' function. */
/* Define to 1 if you have the 'sigsetmask' function. */
#undef HAVE_SIGSETMASK
/* Define to 1 if you have the `sigsuspend' function. */
/* Define to 1 if you have the 'sigsuspend' function. */
#undef HAVE_SIGSUSPEND
/* Define to 1 if you have the `sigvec' function. */
/* Define to 1 if you have the 'sigvec' function. */
#undef HAVE_SIGVEC
/* Define to 1 if the system has the type `sig_atomic_t'. */
/* Define to 1 if the system has the type 'sig_atomic_t'. */
#undef HAVE_SIG_ATOMIC_T
/* Define to 1 if you have the `snprintf' function. */
/* Define to 1 if you have the 'snprintf' function. */
#undef HAVE_SNPRINTF
/* Define to 1 if you have the <stdint.h> header file. */
@ -149,13 +146,13 @@
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the `strerror' function. */
/* Define to 1 if you have the 'strerror' function. */
#undef HAVE_STRERROR
/* Define to 1 if you have the `stresep' function. */
/* Define to 1 if you have the 'stresep' function. */
#undef HAVE_STRESEP
/* Define to 1 if you have the `strftime' function. */
/* Define to 1 if you have the 'strftime' function. */
#undef HAVE_STRFTIME
/* Define to 1 if you have the <strings.h> header file. */
@ -164,35 +161,35 @@
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the `strlcpy' function. */
/* Define to 1 if you have the 'strlcpy' function. */
#undef HAVE_STRLCPY
/* Define to 1 if you have the `strsep' function. */
/* Define to 1 if you have the 'strsep' function. */
#undef HAVE_STRSEP
/* Define to 1 if you have the `strtod' function. */
/* Define to 1 if you have the 'strtod' function. */
#undef HAVE_STRTOD
/* Define to 1 if you have the `strtol' function. */
/* Define to 1 if you have the 'strtol' function. */
#undef HAVE_STRTOL
/* Define to 1 if you have the `strtoll' function. */
/* Define to 1 if you have the 'strtoll' function. */
#undef HAVE_STRTOLL
/* Define to 1 if you have the `strtoul' function. */
/* Define to 1 if you have the 'strtoul' function. */
#undef HAVE_STRTOUL
/* Define to 1 if you have the `sysctl' function. */
/* Define to 1 if you have the 'sysctl' function. */
#undef HAVE_SYSCTL
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
/* Define to 1 if you have the <sys/dir.h> header file, and it defines 'DIR'.
*/
#undef HAVE_SYS_DIR_H
/* Define to 1 if you have the <sys/mman.h> header file. */
#undef HAVE_SYS_MMAN_H
/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
/* Define to 1 if you have the <sys/ndir.h> header file, and it defines 'DIR'.
*/
#undef HAVE_SYS_NDIR_H
@ -226,49 +223,49 @@
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if you have the `unsetenv' function. */
/* Define to 1 if you have the 'unsetenv' function. */
#undef HAVE_UNSETENV
/* Define to 1 if the system has the type `unsigned long long int'. */
/* Define to 1 if the system has the type 'unsigned long long int'. */
#undef HAVE_UNSIGNED_LONG_LONG_INT
/* Define to 1 if you have the <utime.h> header file. */
#undef HAVE_UTIME_H
/* Define to 1 if you have the `vfork' function. */
/* Define to 1 if you have the 'vfork' function. */
#undef HAVE_VFORK
/* Define to 1 if you have the <vfork.h> header file. */
#undef HAVE_VFORK_H
/* Define to 1 if you have the `vprintf' function. */
/* Define to 1 if you have the 'vprintf' function. */
#undef HAVE_VPRINTF
/* Define to 1 if you have the `vsnprintf' function. */
/* Define to 1 if you have the 'vsnprintf' function. */
#undef HAVE_VSNPRINTF
/* Define to 1 if you have the `wait3' function. */
/* Define to 1 if you have the 'wait3' function. */
#undef HAVE_WAIT3
/* Define to 1 if you have the `wait4' function. */
/* Define to 1 if you have the 'wait4' function. */
#undef HAVE_WAIT4
/* Define to 1 if you have the `waitpid' function. */
/* Define to 1 if you have the 'waitpid' function. */
#undef HAVE_WAITPID
/* Define to 1 if you have the `warn' function. */
/* Define to 1 if you have the 'warn' function. */
#undef HAVE_WARN
/* Define to 1 if you have the `warnx' function. */
/* Define to 1 if you have the 'warnx' function. */
#undef HAVE_WARNX
/* Define to 1 if you have the <wchar.h> header file. */
#undef HAVE_WCHAR_H
/* Define to 1 if `fork' works. */
/* Define to 1 if 'fork' works. */
#undef HAVE_WORKING_FORK
/* Define to 1 if `vfork' works. */
/* Define to 1 if 'vfork' works. */
#undef HAVE_WORKING_VFORK
/* define if your compiler has __attribute__ */
@ -292,18 +289,18 @@
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */
/* Define to 1 if the 'S_IS*' macros in <sys/stat.h> do not work properly. */
#undef STAT_MACROS_BROKEN
/* Define to 1 if all of the C90 standard headers exist (not just the ones
/* Define to 1 if all of the C89 standard headers exist (not just the ones
required in a freestanding environment). This macro is provided for
backward compatibility; new code need not use it. */
#undef STDC_HEADERS
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
/* Define to 1 if your <sys/time.h> declares 'struct tm'. */
#undef TM_IN_SYS_TIME
/* Enable extensions on AIX 3, Interix. */
/* Enable extensions on AIX, Interix, z/OS. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
@ -364,11 +361,15 @@
#ifndef __STDC_WANT_IEC_60559_DFP_EXT__
# undef __STDC_WANT_IEC_60559_DFP_EXT__
#endif
/* Enable extensions specified by C23 Annex F. */
#ifndef __STDC_WANT_IEC_60559_EXT__
# undef __STDC_WANT_IEC_60559_EXT__
#endif
/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */
#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__
# undef __STDC_WANT_IEC_60559_FUNCS_EXT__
#endif
/* Enable extensions specified by ISO/IEC TS 18661-3:2015. */
/* Enable extensions specified by C23 Annex H and ISO/IEC TS 18661-3:2015. */
#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__
# undef __STDC_WANT_IEC_60559_TYPES_EXT__
#endif
@ -411,10 +412,10 @@
/* C99 function name */
#undef __func__
/* Define to empty if `const' does not conform to ANSI C. */
/* Define to empty if 'const' does not conform to ANSI C. */
#undef const
/* Define to `__inline__' or `__inline' if that's what the C compiler
/* Define to '__inline__' or '__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
#undef inline
@ -424,10 +425,10 @@
such a type exists and the standard includes do not define it. */
#undef int64_t
/* Define to `int' if <sys/types.h> does not define. */
/* Define to 'int' if <sys/types.h> does not define. */
#undef mode_t
/* Define to `long int' if <sys/types.h> does not define. */
/* Define to 'long int' if <sys/types.h> does not define. */
#undef off_t
/* Define as a signed integer type capable of holding a process identifier. */
@ -436,12 +437,12 @@
/* type that signal handlers can safely frob */
#undef sig_atomic_t
/* Define to `unsigned int' if <sys/types.h> does not define. */
/* Define as 'unsigned int' if <stddef.h> doesn't define. */
#undef size_t
/* Define to the type of an unsigned integer type of width exactly 32 bits if
such a type exists and the standard includes do not define it. */
#undef uint32_t
/* Define as `fork' if `vfork' does not work. */
/* Define as 'fork' if 'vfork' does not work. */
#undef vfork

1342
contrib/bmake/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,11 @@
dnl
dnl RCSid:
dnl $Id: configure.in,v 1.105 2024/03/19 19:08:20 sjg Exp $
dnl $Id: configure.in,v 1.108 2024/07/13 15:27:00 sjg Exp $
dnl
dnl Process this file with autoconf to produce a configure script
dnl
AC_PREREQ([2.71])
AC_INIT([bmake],[20240314],[sjg@NetBSD.org])
AC_INIT([bmake],[20240711],[sjg@NetBSD.org])
AC_CONFIG_HEADERS(config.h)
dnl make srcdir absolute
@ -27,7 +27,7 @@ use_defshell() {
case "$1" in
*csh) # we must be desperate
DEFSHELL_INDEX=DEFSHELL_INDEX_CSH;;
*ksh)
*ksh*)
DEFSHELL_INDEX=DEFSHELL_INDEX_KSH;;
sh|/bin/sh|*/bsh)
DEFSHELL_INDEX=DEFSHELL_INDEX_SH;;
@ -165,12 +165,14 @@ dnl
echo $ECHO_N "checking whether system has timezone Europe/Berlin... $ECHO_C" >&6
eval `TZ=UTC date '+utc_H=%H utc_d=%d' 2> /dev/null`
eval `TZ=Europe/Berlin date '+utc1_H=%H utc1_d=%d' 2> /dev/null`
if test ${utc_d-0} -lt ${utc1_d-0} -o ${utc_H-0} -lt ${utc1_H-0}; then
if test ${utc1_d-0} = 01 -a ${utc_d-0} -gt ${utc1_d-0} ||
test ${utc_d-0} -lt ${utc1_d-0} -o ${utc_H-0} -lt ${utc1_H-0}; then
echo yes >&6
UTC_1=Europe/Berlin
else
eval `TZ=UTC-1 date '+utc1_H=%H utc1_d=%d' 2> /dev/null`
if test ${utc_d-0} -lt ${utc1_d-0} -o ${utc_H-0} -lt ${utc1_H-0}; then
if test ${utc1_d-0} = 01 -a ${utc_d-0} -gt ${utc1_d-0} ||
test ${utc_d-0} -lt ${utc1_d-0} -o ${utc_H-0} -lt ${utc1_H-0}; then
UTC_1=UTC-1
echo no, using UTC-1 >&6
fi
@ -324,7 +326,6 @@ AC_CHECK_FUNCS( \
getenv \
getwd \
killpg \
mmap \
putenv \
select \
setenv \

View File

@ -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(&cur, NULL);
CachedDir_Assign(&dot, NULL);
CachedDir_Assign(&dotLast, NULL);
@ -525,8 +523,8 @@ Dir_End(void)
OpenDirs_Done(&openDirs);
FreeCachedTable(&mtimes);
FreeCachedTable(&lmtimes);
#endif
}
#endif
/*
* We want ${.PATH} to indicate the order in which we will actually

View File

@ -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;

View File

@ -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 key, unsigned int h)
#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(HashTable *t, Substring key, unsigned int h)
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));
}

View File

@ -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(HashTable *, Substring, unsigned int)
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 *);
bool HashIter_Next(HashIter *) MAKE_ATTR_USE;

View File

@ -1,4 +1,4 @@
/* $NetBSD: job.c,v 1.477 2024/06/25 05:18:38 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.
@ -154,7 +154,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.480 2024/07/07 07:50:57 rillig Exp $");
/*
* A shell defines how the commands are run. All commands for a target are
@ -428,7 +428,7 @@ static Shell shells[] = {
* It is set by the Job_ParseShell function.
*/
static Shell *shell = &shells[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 */
@ -623,7 +623,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)
{
@ -635,7 +634,6 @@ JobChildSig(int signo MAKE_ATTR_UNUSED)
/* Resume all stopped jobs. */
/*ARGSUSED*/
static void
JobContinueSig(int signo MAKE_ATTR_UNUSED)
{
@ -2175,7 +2173,7 @@ InitShellNameAndPath(void)
}
#endif
#ifdef DEFSHELL_PATH
shellPath = DEFSHELL_PATH;
shellPath = bmake_strdup(DEFSHELL_PATH);
#else
shellPath = str_concat3(_PATH_DEFSHELLDIR, "/", shellName);
#endif
@ -2516,13 +2514,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);
@ -2630,14 +2628,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.

View File

@ -1,4 +1,4 @@
/* $NetBSD: job.h,v 1.78 2023/12/19 19:33:39 rillig Exp $ */
/* $NetBSD: job.h,v 1.80 2024/07/07 07:50: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;
@ -196,7 +196,9 @@ void Job_Make(GNode *);
void Job_Init(void);
bool Job_ParseShell(char *) MAKE_ATTR_USE;
int Job_Finish(void);
#ifdef CLEANUP
void Job_End(void);
#endif
void Job_Wait(void);
void Job_AbortAll(void);
void Job_TokenReturn(void);

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.624 2024/06/02 15:31:26 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.624 2024/06/02 15:31:26 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. "
@ -793,7 +793,6 @@ AppendWords(StringList *lp, char *str)
}
#ifdef SIGINFO
/*ARGSUSED*/
static void
siginfo(int signo MAKE_ATTR_UNUSED)
{
@ -1361,7 +1360,6 @@ main_Init(int argc, char **argv)
/* Just in case MAKEOBJDIR wants us to do something tricky. */
Targ_Init();
Var_Init();
#ifdef FORCE_MAKE_OS
Global_Set_ReadOnly(".MAKE.OS", FORCE_MAKE_OS);
#else
@ -1604,25 +1602,31 @@ 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();
Var_End();
Targ_End();
Arch_End();
Parse_End();
Dir_End();
Job_End();
#endif
Trace_End();
#ifdef CLEANUP
Str_Intern_End();
#endif
}
/* Determine the exit code. */
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;
}
@ -1703,6 +1707,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.
@ -1721,40 +1775,11 @@ Cmd_Exec(const char *cmd, char **error)
char *p;
int saved_errno;
char cmd_file[MAXPATHLEN];
size_t cmd_len;
int cmd_fd = -1;
if (shellPath == NULL)
Shell_Init();
cmd_len = strlen(cmd);
if (cmd_len > 1000) {
cmd_fd = mkTempFile(NULL, cmd_file, sizeof(cmd_file));
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;
}
}
}
args[0] = shellName;
if (cmd_fd >= 0) {
args[1] = cmd_file;
args[2] = NULL;
} else {
cmd_file[0] = '\0';
args[1] = "-c";
args[2] = cmd;
args[3] = NULL;
}
DEBUG1(VAR, "Capturing the output of command \"%s\"\n", cmd);
if (pipe(pipefds) == -1) {
if (Cmd_Argv(cmd, 0, args, 4, cmd_file, sizeof(cmd_file), false, false) < 0
|| pipe(pipefds) == -1) {
*error = str_concat3(
"Couldn't create pipe for \"", cmd, "\"");
return bmake_strdup("");
@ -1806,10 +1831,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(&errBuf);
Buf_AddStr(&errBuf, "Command \"");
Buf_AddStr(&errBuf, cmd);
Buf_AddStr(&errBuf, "\" exited with status ");
Buf_AddInt(&errBuf, WEXITSTATUS(status));
*error = Buf_DoneData(&errBuf);
} else if (saved_errno != 0)
*error = str_concat3(
"Couldn't read shell's output for \"", cmd, "\"");
else
@ -2084,6 +2114,7 @@ void
PrintOnError(GNode *gn, const char *msg)
{
static GNode *errorNode = NULL;
StringListNode *ln;
if (DEBUG(HASH)) {
Targ_Stats();
@ -2093,7 +2124,19 @@ PrintOnError(GNode *gn, const char *msg)
if (errorNode != NULL)
return; /* we've been here! */
printf("%s%s: stopped in %s\n", msg, progname, curdir);
printf("%s%s: stopped", msg, progname);
ln = opts.create.first;
if (ln != NULL || mainNode != NULL) {
printf(" making \"");
if (ln != NULL) {
printf("%s", (const char *)ln->datum);
for (ln = ln->next; ln != NULL; ln = ln->next)
printf(" %s", (const char *)ln->datum);
} else
printf("%s", mainNode->name);
printf("\"");
}
printf(" in %s\n", curdir);
/* we generally want to keep quiet if a sub-make died */
if (shouldDieQuietly(gn, -1))

View File

@ -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
@ -1586,6 +1586,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

View File

@ -1,4 +1,4 @@
/* $NetBSD: make.h,v 1.339 2024/06/15 20:02:45 rillig Exp $ */
/* $NetBSD: make.h,v 1.344 2024/07/11 20:09:16 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -114,7 +114,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 */
@ -811,7 +811,9 @@ extern char **environ;
/* arch.c */
void Arch_Init(void);
#ifdef CLEANUP
void Arch_End(void);
#endif
bool Arch_ParseArchive(char **, GNodeList *, GNode *);
void Arch_Touch(GNode *);
@ -866,8 +868,13 @@ void For_Break(struct ForLoop *);
/* job.c */
void JobReapChild(pid_t, int, bool);
/* longer than this we use a temp file */
#ifndef MAKE_CMDLEN_LIMIT
# define MAKE_CMDLEN_LIMIT 1000
#endif
/* main.c */
void Main_ParseArgLine(const char *);
int Cmd_Argv(const char *, size_t, const char **, size_t, char *, size_t, bool, bool);
char *Cmd_Exec(const char *, char **) MAKE_ATTR_USE;
void Error(const char *, ...) MAKE_ATTR_PRINTFLIKE(1, 2);
void Fatal(const char *, ...) MAKE_ATTR_PRINTFLIKE(1, 2) MAKE_ATTR_DEAD;
@ -882,8 +889,11 @@ const char *cached_realpath(const char *, char *);
bool GetBooleanExpr(const char *, bool);
/* parse.c */
extern int parseErrors;
void Parse_Init(void);
#ifdef CLEANUP
void Parse_End(void);
#endif
void PrintLocation(FILE *, bool, const GNode *);
void PrintStackTrace(bool);
@ -893,7 +903,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);
@ -901,7 +910,9 @@ void Parse_GuardEndif(void);
/* suff.c */
void Suff_Init(void);
#ifdef CLEANUP
void Suff_End(void);
#endif
void Suff_ClearSuffixes(void);
bool Suff_IsTransform(const char *) MAKE_ATTR_USE;
@ -941,7 +952,6 @@ const char *GNodeMade_Name(GNodeMade) MAKE_ATTR_USE;
#ifdef CLEANUP
void Parse_RegisterCommand(char *);
#else
/* ARGSUSED */
MAKE_INLINE
void Parse_RegisterCommand(char *cmd MAKE_ATTR_UNUSED)
{
@ -949,8 +959,6 @@ void Parse_RegisterCommand(char *cmd MAKE_ATTR_UNUSED)
#endif
/* var.c */
void Var_Init(void);
void Var_End(void);
typedef enum VarEvalMode {

View File

@ -36,6 +36,9 @@
# include "config.h"
#endif
#include <sys/stat.h>
#if defined(HAVE_SYS_SELECT_H)
# include <sys/select.h>
#endif
#ifdef HAVE_LIBGEN_H
#include <libgen.h>
#elif !defined(HAVE_DIRNAME)

0
contrib/bmake/mk/install-mk Normal file → Executable file
View File

View File

@ -1,4 +1,4 @@
/* $NetBSD: parse.c,v 1.731 2024/06/15 19:43:56 rillig Exp $ */
/* $NetBSD: parse.c,v 1.734 2024/07/09 19:43:01 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -105,23 +105,12 @@
#include <stdint.h>
#endif
#ifdef HAVE_MMAP
#include <sys/mman.h>
#ifndef MAP_COPY
#define MAP_COPY MAP_PRIVATE
#endif
#ifndef MAP_FILE
#define MAP_FILE 0
#endif
#endif
#include "dir.h"
#include "job.h"
#include "pathnames.h"
/* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */
MAKE_RCSID("$NetBSD: parse.c,v 1.731 2024/06/15 19:43:56 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 {
@ -247,7 +236,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
@ -440,6 +429,8 @@ PrintStackTrace(bool includingInnermost)
} else
debug_printf("\tin %s:%u\n", fname, entry->lineno);
}
if (makelevel > 0)
debug_printf("\tin directory %s\n", curdir);
}
/* Check if the current character is escaped on the current line. */
@ -554,7 +545,7 @@ ParseVErrorInternal(FILE *f, bool useVars, const GNode *gn,
parseErrors++;
}
if (DEBUG(PARSE))
if (level == PARSE_FATAL || DEBUG(PARSE))
PrintStackTrace(false);
}
@ -2988,11 +2979,11 @@ Parse_Init(void)
HashTable_Init(&guards);
}
#ifdef CLEANUP
/* Clean up the parsing module. */
void
Parse_End(void)
{
#ifdef CLEANUP
HashIter hi;
Lst_DoneFree(&targCmds);
@ -3009,8 +3000,8 @@ Parse_End(void)
free(guard);
}
HashTable_Done(&guards);
#endif
}
#endif
/* Populate the list with the single main target to create, or error out. */
@ -3026,9 +3017,3 @@ Parse_MainName(GNodeList *mainList)
Global_Append(".TARGETS", mainNode->name);
}
int
Parse_NumErrors(void)
{
return parseErrors;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: str.c,v 1.103 2024/04/14 15:21:20 rillig Exp $ */
/* $NetBSD: str.c,v 1.105 2024/07/07 07:50:57 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.105 2024/07/07 07:50:57 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;
}
@ -406,13 +408,13 @@ Str_Intern_Init(void)
HashTable_Init(&interned_strings);
}
#ifdef CLEANUP
void
Str_Intern_End(void)
{
#ifdef CLEANUP
HashTable_Done(&interned_strings);
#endif
}
#endif
/* Return a canonical instance of str, with unlimited lifetime. */
const char *

View File

@ -1,4 +1,4 @@
/* $NetBSD: str.h,v 1.19 2024/01/05 21:56:55 rillig Exp $ */
/* $NetBSD: str.h,v 1.20 2024/07/07 07:50:57 rillig Exp $ */
/*
Copyright (c) 2021 Roland Illig <rillig@NetBSD.org>
@ -333,5 +333,7 @@ char *str_concat3(const char *, const char *, const char *);
StrMatchResult Str_Match(const char *, const char *);
void Str_Intern_Init(void);
#ifdef CLEANUP
void Str_Intern_End(void);
#endif
const char *Str_Intern(const char *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: suff.c,v 1.380 2024/06/02 15:31:26 rillig Exp $ */
/* $NetBSD: suff.c,v 1.382 2024/07/07 07:50:57 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -115,7 +115,7 @@
#include "dir.h"
/* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */
MAKE_RCSID("$NetBSD: suff.c,v 1.380 2024/06/02 15:31:26 rillig Exp $");
MAKE_RCSID("$NetBSD: suff.c,v 1.382 2024/07/07 07:50:57 rillig Exp $");
typedef List SuffixList;
typedef ListNode SuffixListNode;
@ -979,7 +979,6 @@ Candidate_New(char *name, char *prefix, Suffix *suff, Candidate *parent,
}
/* Add a new candidate to the list. */
/*ARGSUSED*/
static void
CandidateList_Add(CandidateList *list, char *srcName, Candidate *targ,
Suffix *suff, const char *debug_tag MAKE_ATTR_UNUSED)
@ -2042,11 +2041,11 @@ Suff_Init(void)
Suff_ClearSuffixes();
}
#ifdef CLEANUP
/* Clean up the suffixes module. */
void
Suff_End(void)
{
#ifdef CLEANUP
SuffixListNode *ln;
for (ln = sufflist.first; ln != NULL; ln = ln->next)
@ -2058,8 +2057,8 @@ Suff_End(void)
if (nullSuff != NULL)
Suffix_Free(nullSuff);
Lst_Done(&transforms);
#endif
}
#endif
static void

View File

@ -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(&allTargetsByName);
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(&allTargets);
HashTable_Done(&allTargetsByName);
for (ln = allNodes.first; ln != NULL; ln = ln->next)
GNode_Free(ln->datum);
Lst_Done(&allNodes);
#endif
}
#endif
void
Targ_Stats(void)

View File

@ -1,6 +1,6 @@
# $Id: Makefile,v 1.219 2024/06/01 16:14:47 sjg Exp $
# $Id: Makefile,v 1.224 2024/07/13 05:27:35 sjg Exp $
#
# $NetBSD: Makefile,v 1.347 2024/06/01 15:54:40 sjg Exp $
# $NetBSD: Makefile,v 1.350 2024/07/07 09:37:00 rillig Exp $
#
# Unit tests for make(1)
#
@ -398,6 +398,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
@ -465,8 +466,23 @@ _shell := ${.SHELL:tA:T}
.if ${_shell} == "dash"
# dash fails -x output
BROKEN_TESTS+= opt-debug-x-trace
.elif ${_shell} == "ksh"
BROKEN_TESTS+= sh-flags
.elif ${_shell:N*ksh*} == ""
BROKEN_TESTS+= \
deptgt-silent-jobs \
job-flags \
job-output-long-lines \
opt-debug-x-trace \
sh-flags \
var-op-shell \
.if ${_shell:Nmksh} == ""
# more broken that pdksh
BROKEN_TESTS+= \
opt-jobs-no-action \
sh-errctl \
sh-leading-hyphen \
.endif
.endif
.if ${UTC_1:Uno} == ""
@ -591,7 +607,7 @@ SED_CMDS.meta-ignore= -e 's,\(\.meta:\) [1-9][0-9]*:,\1 <line>:,'
SED_CMDS.opt-debug-graph1= ${STD_SED_CMDS.dg1}
SED_CMDS.opt-debug-graph2= ${STD_SED_CMDS.dg2}
SED_CMDS.opt-debug-graph3= ${STD_SED_CMDS.dg3}
SED_CMDS.opt-debug-hash= -e 's,\(numEntries\)=[1-9][0-9],\1=<entries>,'
SED_CMDS.opt-debug-hash= -e 's,\(entries\)=[1-9][0-9],\1=<entries>,'
SED_CMDS.opt-debug-jobs= -e 's,([0-9][0-9]*),(<pid>),'
SED_CMDS.opt-debug-jobs+= -e 's,pid [0-9][0-9]*,pid <pid>,'
SED_CMDS.opt-debug-jobs+= -e 's,Process [0-9][0-9]*,Process <pid>,'
@ -807,7 +823,7 @@ LIMIT_RESOURCES?= :
# Postprocess the test output to make the output platform-independent.
#
# Replace anything after 'stopped in' with unit-tests
_SED_CMDS+= -e '/stopped/s, /.*, unit-tests,'
_SED_CMDS+= -e '/stopped/s, in /.*, in unit-tests,'
# Allow the test files to be placed anywhere.
_SED_CMDS+= -e 's,\(\.PARSEDIR}\) = `'"/[^']*'"',\1 = <some-dir>,'
_SED_CMDS+= -e 's,\(\.INCLUDEDFROMDIR}\) = `'"/[^']*'"',\1 = <some-dir>,'
@ -833,8 +849,10 @@ _SED_CMDS+= -e '/EGREP=/d'
.if ${.MAKE.OS:N*BSD} != ""
_SED_CMDS+= -e 's,\(Error code\) 255,\1 1,'
.endif
.if ${.SHELL:T} == "ksh"
.if ${_shell:N*ksh*} == ""
_SED_CMDS+= -e '/^set [+-]v/d'
SED_CMDS.opt-debug-jobs+= -e 's,Command: ksh -v,Command: <shell>,'
SED_CMDS.opt-debug-jobs+= -e 's,Command: <shell> -v,Command: <shell>,'
.endif
.rawout.out:

View File

@ -1,9 +1,9 @@
: 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": Unknown modifier "Z"
make: in target "unknown-modifier": while evaluating variable "UNKNOWN" with value "": Unknown modifier "Z"
: unknown-modifier--eol
: end-eol
exit status 0
exit status 2

View File

@ -1,4 +1,4 @@
# $NetBSD: cmd-errors-jobs.mk,v 1.4 2024/04/23 22:51:28 rillig Exp $
# $NetBSD: cmd-errors-jobs.mk,v 1.8 2024/07/09 19:43:01 rillig Exp $
#
# Demonstrate how errors in expressions affect whether the commands
# are actually executed in jobs mode.
@ -13,27 +13,26 @@ all: undefined unclosed-expression unclosed-modifier unknown-modifier end
undefined:
: $@-${UNDEFINED}-eol
# XXX: This command is executed even though it contains parse errors.
# expect: make: in target "unclosed-expression": Unclosed variable "UNCLOSED"
# expect: : unclosed-expression-
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: This command is executed even though it contains parse errors.
# expect: make: Unclosed expression, expecting '}' for "UNCLOSED"
# expect: : unclosed-modifier-
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-
: $@-${UNCLOSED:
# XXX: This command is executed even though it contains parse errors.
# expect: make: in target "unknown-modifier": while evaluating variable "UNKNOWN": Unknown modifier "Z"
# expect: : unknown-modifier--eol
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:Z}-eol
# expect: : end-eol
end:
: $@-eol
# XXX: Despite the parse errors, the exit status is 0.
# expect: exit status 0
# expect: exit status 2

View File

@ -1,9 +1,9 @@
: undefined
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": Unknown modifier "Z"
make: in target "unknown-modifier": while evaluating variable "UNKNOWN" with value "": Unknown modifier "Z"
: unknown-modifier
: end
exit status 2

View File

@ -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.4 2024/07/05 18:59:33 rillig Exp $
#
# Demonstrate how errors in expressions affect whether the commands
# are actually executed.
@ -10,24 +10,29 @@ all: undefined unclosed-expression unclosed-modifier unknown-modifier end
# 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: 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
: $@ ${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 though it contains parse errors.
# expect: : unknown-modifier
: $@ ${UNKNOWN:Z}
end:
# expect: : end
: $@
# expect: exit status 2

View File

@ -1,9 +1,9 @@
: 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": Unknown modifier "Z"
make: in target "unknown-modifier": while evaluating variable "UNKNOWN" with value "": Unknown modifier "Z"
: unknown-modifier--eol
: end-eol
exit status 0
exit status 2

View File

@ -1,4 +1,4 @@
# $NetBSD: cmd-errors.mk,v 1.6 2024/04/23 22:51:28 rillig Exp $
# $NetBSD: cmd-errors.mk,v 1.9 2024/07/09 19:43:01 rillig Exp $
#
# Demonstrate how errors in expressions affect whether the commands
# are actually executed in compat mode.
@ -8,24 +8,29 @@ all: undefined unclosed-expression unclosed-modifier unknown-modifier end
# Undefined variables in expressions are not an error. They expand to empty
# strings.
undefined:
# expect: : undefined--eol
: $@-${UNDEFINED}-eol
# 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 command is executed even though it contains
# parse errors.
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-
: $@-${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 though it contains parse errors.
# expect: : unknown-modifier--eol
: $@-${UNKNOWN:Z}-eol
end:
# expect: : end-eol
: $@-eol
# XXX: As of 2020-11-02, despite the parse errors, the exit status is 0.
# expect: exit status 2

View File

@ -9,7 +9,7 @@ false 'fail2' '${.TARGET}' '$${.TARGET}'
: Making success3 out of nothing.
Stop.
make: stopped in unit-tests
make: stopped making "success1 fail1 success2 fail2 success3" in unit-tests
.ERROR target: <fail1>
.ERROR command: <>
exit status 1

View File

@ -11,5 +11,5 @@ Comparing 123.000000 < 124.000000
CondParser_Eval: ${:U123 } < 124
make: "cond-cmp-numeric.mk" line 54: Comparison with '<' requires both operands '123 ' and '124' to be numeric
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 1

View File

@ -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: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 1

View File

@ -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 98: The empty variable is never defined.
make: "cond-func.mk" line 108: A plain function name is parsed as defined(...).
make: "cond-func.mk" line 116: A plain function name is parsed as defined(...).
make: "cond-func.mk" line 127: Symbols may start with a function name.
make: "cond-func.mk" line 133: Symbols may start with a function name.
make: "cond-func.mk" line 139: Missing closing parenthesis 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 for defined()
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
exit status 1

View File

@ -1,4 +1,4 @@
# $NetBSD: cond-func.mk,v 1.14 2023/11/19 21:47:52 rillig Exp $
# $NetBSD: cond-func.mk,v 1.15 2024/07/06 21:21:10 rillig Exp $
#
# Tests for those parts of the functions in .if conditions that are common
# among several functions.
@ -83,19 +83,18 @@ ${VARNAME_UNBALANCED_BRACES}= variable name with unbalanced braces
. error
.endif
# The following condition is interpreted as defined(A) && defined(B).
# In lack of a function call expression, each kind of .if directive has a
# Before cond.c 1.366 from 2024-07-06, the following condition was
# interpreted as defined(A) && defined(B). Each kind of .if directive has a
# default function that is called when a bare word is parsed. For the plain
# .if directive, this function is defined(); see "struct If ifs" in cond.c.
# .if directive, this function is 'defined'; see "struct If ifs" in cond.c.
# expect+1: Unknown operator '&'
.if A&B
. error
.endif
# The empty variable is never defined.
.if defined()
. error
.else
# expect+1: The empty variable is never defined.
. info The empty variable is never defined.
.endif
# The plain word 'defined' is interpreted as 'defined(defined)', see

View File

@ -1,4 +1,7 @@
make: Bad conditional expression ' != "no"' before '?:'
make: "cond-late.mk" line 38: while evaluating variable "VAR" with value "${${UNDEF} != "no":?:}": while evaluating condition " != "no"": Bad condition
in directory <curdir>
make: Fatal errors encountered -- cannot continue
make: stopped making "do-parse-time" in unit-tests
yes
no
exit status 0

View File

@ -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.8 2024/07/04 17:47:54 rillig Exp $
#
# Using the :? modifier, expressions can contain conditional
# expressions that are evaluated late, at expansion time.
@ -15,7 +15,10 @@
# actually interpreted as these operators. This is demonstrated below.
#
all: cond-literal
all: parse-time cond-literal
parse-time: .PHONY
@${MAKE} -f ${MAKEFILE} do-parse-time || true
COND.true= "yes" == "yes"
COND.false= "yes" != "yes"
@ -29,8 +32,9 @@ cond-literal:
@echo ${ ${COND.true} :?yes:no}
@echo ${ ${COND.false} :?yes:no}
.if make(do-parse-time)
VAR= ${${UNDEF} != "no":?:}
# expect-reset
# expect: make: Bad conditional expression ' != "no"' before '?:'
.if empty(VAR:Mpattern)
# expect+1: while evaluating variable "VAR" with value "${${UNDEF} != "no":?:}": while evaluating condition " != "no"": Bad condition
. if empty(VAR:Mpattern)
. endif
.endif

View File

@ -1,7 +1,11 @@
make: "cond-op-and.mk" line 37: Malformed conditional (0 || (${DEF} && ${UNDEF}))
make: "cond-op-and.mk" line 42: Malformed conditional (0 || (${UNDEF} && ${UNDEF}))
make: "cond-op-and.mk" line 45: Malformed conditional (0 || (!${UNDEF} && ${UNDEF}))
make: "cond-op-and.mk" line 75: Malformed conditional (0 &&& 0)
make: "cond-op-and.mk" line 36: Malformed conditional (0 || (${DEF} && ${UNDEF}))
make: "cond-op-and.mk" line 41: Malformed conditional (0 || (${UNDEF} && ${UNDEF}))
make: "cond-op-and.mk" line 44: Malformed conditional (0 || (!${UNDEF} && ${UNDEF}))
make: "cond-op-and.mk" line 60: Unknown operator '&'
make: "cond-op-and.mk" line 66: Unknown operator '&'
make: "cond-op-and.mk" line 72: Unknown operator '&'
make: "cond-op-and.mk" line 78: Unknown operator '&'
make: "cond-op-and.mk" line 87: Unknown operator '&'
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
exit status 1

View File

@ -1,4 +1,4 @@
# $NetBSD: cond-op-and.mk,v 1.9 2023/12/17 09:44:00 rillig Exp $
# $NetBSD: cond-op-and.mk,v 1.10 2024/07/06 21:21:10 rillig Exp $
#
# Tests for the && operator in .if conditions.
@ -25,8 +25,7 @@
.endif
# When an outer condition makes the inner '&&' condition irrelevant, neither
# of its operands must be evaluated.
#
# of its operands is evaluated.
.if 1 || (${UNDEF} && ${UNDEF})
.endif
@ -57,27 +56,43 @@ DEF= defined
# The && operator may be abbreviated as &. This is not widely known though
# and is also not documented in the manual page.
# expect+1: Unknown operator '&'
.if 0 & 0
. error
.else
. error
.endif
# expect+1: Unknown operator '&'
.if 1 & 0
. error
.endif
.if 0 & 1
.else
. error
.endif
# expect+1: Unknown operator '&'
.if 0 & 1
. error
.else
. error
.endif
# expect+1: Unknown operator '&'
.if !(1 & 1)
. error
.else
. error
.endif
# There is no operator &&&.
# expect+1: Malformed conditional (0 &&& 0)
# There is no operator '&&&'. The first two '&&' form an operator, the third
# '&' forms the next (incomplete) token.
# expect+1: Unknown operator '&'
.if 0 &&& 0
. error
.else
. error
.endif
# The '&&' operator must be preceded by whitespace, otherwise it becomes part
# of the preceding bare word. The condition is parsed as '"1&&" != "" && 1'.
# of the preceding bare word. The condition starts with a digit and is thus
# parsed as '"1&&" != "" && 1'.
.if 1&& && 1
.else
. error

View File

@ -5,5 +5,5 @@ make: "cond-op-not.mk" line 53: Not 1 evaluates to false.
make: "cond-op-not.mk" line 60: Not word evaluates to false.
make: "cond-op-not.mk" line 65: Malformed conditional (!)
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 1

View File

@ -1,7 +1,11 @@
make: "cond-op-or.mk" line 47: Malformed conditional (1 && (!${DEF} || ${UNDEF}))
make: "cond-op-or.mk" line 50: Malformed conditional (1 && (${UNDEF} || ${UNDEF}))
make: "cond-op-or.mk" line 53: Malformed conditional (1 && (!${UNDEF} || ${UNDEF}))
make: "cond-op-or.mk" line 75: Malformed conditional (0 ||| 0)
make: "cond-op-or.mk" line 36: Malformed conditional (1 && (!${DEF} || ${UNDEF}))
make: "cond-op-or.mk" line 41: Malformed conditional (1 && (!${UNDEF} || ${UNDEF}))
make: "cond-op-or.mk" line 44: Malformed conditional (1 && (${UNDEF} || ${UNDEF}))
make: "cond-op-or.mk" line 60: Unknown operator '|'
make: "cond-op-or.mk" line 66: Unknown operator '|'
make: "cond-op-or.mk" line 72: Unknown operator '|'
make: "cond-op-or.mk" line 78: Unknown operator '|'
make: "cond-op-or.mk" line 87: Unknown operator '|'
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
exit status 1

View File

@ -1,4 +1,4 @@
# $NetBSD: cond-op-or.mk,v 1.11 2023/12/17 09:44:00 rillig Exp $
# $NetBSD: cond-op-or.mk,v 1.12 2024/07/06 21:21:10 rillig Exp $
#
# Tests for the || operator in .if conditions.
@ -25,60 +25,75 @@
.endif
# When an outer condition makes the inner '||' condition irrelevant, neither
# of its operands must be evaluated. This had been wrong in cond.c 1.283 from
# 2021-12-09 and was reverted in cond.c 1.284 an hour later.
# of its operands is evaluated.
.if 0 && (!defined(UNDEF) || ${UNDEF})
.endif
# Test combinations of outer '&&' with inner '||', to ensure that the operands
# of the inner '||' is only evaluated if necessary.
# of the inner '||' are only evaluated if necessary.
DEF= defined
.if 0 && (${DEF} || ${UNDEF})
.endif
.if 0 && (!${DEF} || ${UNDEF})
.endif
.if 0 && (${UNDEF} || ${UNDEF})
.endif
.if 0 && (!${UNDEF} || ${UNDEF})
# expect+1: Malformed conditional (1 && (!${DEF} || ${UNDEF}))
.if 1 && (!${DEF} || ${UNDEF})
.endif
.if 1 && (${DEF} || ${UNDEF})
.endif
# expect+1: Malformed conditional (1 && (!${DEF} || ${UNDEF}))
.if 1 && (!${DEF} || ${UNDEF})
# expect+1: Malformed conditional (1 && (!${UNDEF} || ${UNDEF}))
.if 1 && (!${UNDEF} || ${UNDEF})
.endif
# expect+1: Malformed conditional (1 && (${UNDEF} || ${UNDEF}))
.if 1 && (${UNDEF} || ${UNDEF})
.endif
# expect+1: Malformed conditional (1 && (!${UNDEF} || ${UNDEF}))
.if 1 && (!${UNDEF} || ${UNDEF})
.if 0 && (!${DEF} || ${UNDEF})
.endif
.if 0 && (${DEF} || ${UNDEF})
.endif
.if 0 && (!${UNDEF} || ${UNDEF})
.endif
.if 0 && (${UNDEF} || ${UNDEF})
.endif
# The || operator may be abbreviated as |. This is not widely known though
# and is also not documented in the manual page.
# expect+1: Unknown operator '|'
.if 0 | 0
. error
.else
. error
.endif
# expect+1: Unknown operator '|'
.if !(1 | 0)
. error
.endif
.if !(0 | 1)
.else
. error
.endif
# expect+1: Unknown operator '|'
.if !(0 | 1)
. error
.else
. error
.endif
# expect+1: Unknown operator '|'
.if !(1 | 1)
. error
.else
. error
.endif
# There is no operator |||.
# expect+1: Malformed conditional (0 ||| 0)
# There is no operator '|||'. The first two '||' form an operator, the third
# '|' forms the next (incomplete) token.
# expect+1: Unknown operator '|'
.if 0 ||| 0
. error
.else
. error
.endif
# The '||' operator must be preceded by whitespace, otherwise it becomes part
# of the preceding bare word. The condition is parsed as '"1||" != "" || 0'.
.if 1|| || 0
# of the preceding bare word. The condition starts with a digit and is thus
# parsed as '"0||" != "" || 0'.
.if 0|| || 0
.else
. error
.endif

View File

@ -3,5 +3,5 @@ make: "cond-op-parentheses.mk" line 25: Malformed conditional ((3) > 2)
make: "cond-op-parentheses.mk" line 44: Malformed conditional (()
make: "cond-op-parentheses.mk" line 58: Malformed conditional ())
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 1

View File

@ -17,5 +17,5 @@ make: "cond-op.mk" line 129: Malformed conditional (0 &&)
make: "cond-op.mk" line 138: Malformed conditional (1 ||)
make: "cond-op.mk" line 148: Malformed conditional (0 ||)
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 1

View File

@ -9,5 +9,5 @@ expected or exists
expected or empty
make: "cond-short.mk" line 231: Comparison with '<' requires both operands '' and '42' to be numeric
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 1

View File

@ -3,5 +3,5 @@ make: "cond-token-number.mk" line 27: Malformed conditional (+0)
make: "cond-token-number.mk" line 38: Malformed conditional (!-1)
make: "cond-token-number.mk" line 49: Malformed conditional (!+1)
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 1

View File

@ -1,4 +1,4 @@
make: "cond-token-string.mk" line 15: while evaluating "${:Uvalue:Z}"": Unknown modifier "Z"
make: "cond-token-string.mk" line 15: while evaluating "${:Uvalue:Z}"" with value "value": Unknown modifier "Z"
make: "cond-token-string.mk" line 15: Malformed conditional ("" != "${:Uvalue:Z}")
make: "cond-token-string.mk" line 25: xvalue is not defined.
make: "cond-token-string.mk" line 32: Malformed conditional (x${:Uvalue} == "")
@ -17,5 +17,5 @@ CondParser_Eval: ("${VAR}")
CondParser_Eval: "quoted" == quoted
Comparing "quoted" == "quoted"
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 1

View File

@ -1,4 +1,4 @@
# $NetBSD: cond-token-string.mk,v 1.10 2024/04/20 10:18:55 rillig Exp $
# $NetBSD: cond-token-string.mk,v 1.11 2024/07/05 19:47:22 rillig Exp $
#
# Tests for quoted string literals in .if conditions.
#
@ -11,7 +11,7 @@
# Cover the code in CondParser_String that frees the memory after parsing
# an expression based on an undefined variable.
# expect+2: Malformed conditional ("" != "${:Uvalue:Z}")
# expect+1: while evaluating "${:Uvalue:Z}"": Unknown modifier "Z"
# expect+1: while evaluating "${:Uvalue:Z}"" with value "value": Unknown modifier "Z"
.if "" != "${:Uvalue:Z}"
. error
.else

View File

@ -1,4 +1,5 @@
make: "dep-op-missing.tmp" line 1: Invalid line 'target'
in directory <curdir>
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
exit status 0

View File

@ -2,5 +2,5 @@ make: don't know how to make dep-percent.o (continuing)
`all' not remade because of errors.
Stop.
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 1

View File

@ -27,4 +27,4 @@ def2
a-def2-b
1-2-NDIRECT_2-2-1
)
exit status 0
exit status 2

View File

@ -1,5 +1,5 @@
make: "dep.mk" line 11: Inconsistent operator for only-colon
make: "dep.mk" line 13: Inconsistent operator for only-colon
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 1

View File

@ -7,5 +7,5 @@ false all
*** Error code 1 (continuing)
Stop.
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 1

View File

@ -2,5 +2,5 @@ false
*** Error code 1 (continuing)
Stop.
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 1

View File

@ -2,5 +2,5 @@ false
*** Error code 1 (continuing)
Stop.
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 1

View File

@ -15,7 +15,7 @@ make: *** deptgt-delete_on_error-regular-delete removed
*** Error code 1 (continuing)
Stop.
make: stopped in unit-tests
make: stopped making "deptgt-delete_on_error-regular deptgt-delete_on_error-regular-delete deptgt-delete_on_error-phony deptgt-delete_on_error-phony-delete deptgt-delete_on_error-precious deptgt-delete_on_error-precious-delete" in unit-tests
*** Error code 1 (ignored)
Parallel mode
@ -23,27 +23,27 @@ Parallel mode
*** [deptgt-delete_on_error-regular] Error code 1
make: *** deptgt-delete_on_error-regular removed
make: stopped in unit-tests
make: stopped making "deptgt-delete_on_error-regular deptgt-delete_on_error-regular-delete deptgt-delete_on_error-phony deptgt-delete_on_error-phony-delete deptgt-delete_on_error-precious deptgt-delete_on_error-precious-delete" in unit-tests
> deptgt-delete_on_error-regular-delete; false
*** [deptgt-delete_on_error-regular-delete] Error code 1
make: *** deptgt-delete_on_error-regular-delete removed
make: stopped in unit-tests
make: stopped making "deptgt-delete_on_error-regular deptgt-delete_on_error-regular-delete deptgt-delete_on_error-phony deptgt-delete_on_error-phony-delete deptgt-delete_on_error-precious deptgt-delete_on_error-precious-delete" in unit-tests
> deptgt-delete_on_error-phony; false
*** [deptgt-delete_on_error-phony] Error code 1
make: stopped in unit-tests
make: stopped making "deptgt-delete_on_error-regular deptgt-delete_on_error-regular-delete deptgt-delete_on_error-phony deptgt-delete_on_error-phony-delete deptgt-delete_on_error-precious deptgt-delete_on_error-precious-delete" in unit-tests
> deptgt-delete_on_error-phony-delete; false
*** [deptgt-delete_on_error-phony-delete] Error code 1
make: stopped in unit-tests
make: stopped making "deptgt-delete_on_error-regular deptgt-delete_on_error-regular-delete deptgt-delete_on_error-phony deptgt-delete_on_error-phony-delete deptgt-delete_on_error-precious deptgt-delete_on_error-precious-delete" in unit-tests
> deptgt-delete_on_error-precious; false
*** [deptgt-delete_on_error-precious] Error code 1
make: stopped in unit-tests
make: stopped making "deptgt-delete_on_error-regular deptgt-delete_on_error-regular-delete deptgt-delete_on_error-phony deptgt-delete_on_error-phony-delete deptgt-delete_on_error-precious deptgt-delete_on_error-precious-delete" in unit-tests
> deptgt-delete_on_error-precious-delete; false
*** [deptgt-delete_on_error-precious-delete] Error code 1
make: stopped in unit-tests
make: stopped making "deptgt-delete_on_error-regular deptgt-delete_on_error-regular-delete deptgt-delete_on_error-phony deptgt-delete_on_error-phony-delete deptgt-delete_on_error-precious deptgt-delete_on_error-precious-delete" in unit-tests
*** Error code 1 (ignored)
exit status 0

View File

@ -3,5 +3,5 @@ false
*** Error code 1 (continuing)
Stop.
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 1

View File

@ -3,5 +3,5 @@ false
*** Error code 1 (continuing)
Stop.
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 1

View File

@ -13,7 +13,7 @@ Test case all=ok all-dep=ok end=ok end-dep=ERR.
*** Error code 1 (continuing)
Stop.
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 1
@ -25,7 +25,7 @@ Test case all=ok all-dep=ok end=ERR end-dep=ok.
*** Error code 1 (continuing)
Stop.
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 1
@ -36,7 +36,7 @@ Test case all=ok all-dep=ok end=ERR end-dep=ERR.
*** Error code 1 (continuing)
Stop.
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 1
@ -46,7 +46,7 @@ Test case all=ok all-dep=ERR end=ok end-dep=ok.
`all' not remade because of errors.
Stop.
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 1
@ -56,7 +56,7 @@ Test case all=ok all-dep=ERR end=ok end-dep=ERR.
`all' not remade because of errors.
Stop.
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 1
@ -66,7 +66,7 @@ Test case all=ok all-dep=ERR end=ERR end-dep=ok.
`all' not remade because of errors.
Stop.
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 1
@ -76,7 +76,7 @@ Test case all=ok all-dep=ERR end=ERR end-dep=ERR.
`all' not remade because of errors.
Stop.
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 1
@ -86,7 +86,7 @@ Test case all=ERR all-dep=ok end=ok end-dep=ok.
*** Error code 1 (continuing)
Stop.
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 1
@ -96,7 +96,7 @@ Test case all=ERR all-dep=ok end=ok end-dep=ERR.
*** Error code 1 (continuing)
Stop.
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 1
@ -106,7 +106,7 @@ Test case all=ERR all-dep=ok end=ERR end-dep=ok.
*** Error code 1 (continuing)
Stop.
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 1
@ -116,7 +116,7 @@ Test case all=ERR all-dep=ok end=ERR end-dep=ERR.
*** Error code 1 (continuing)
Stop.
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 1
@ -126,7 +126,7 @@ Test case all=ERR all-dep=ERR end=ok end-dep=ok.
`all' not remade because of errors.
Stop.
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 1
@ -136,7 +136,7 @@ Test case all=ERR all-dep=ERR end=ok end-dep=ERR.
`all' not remade because of errors.
Stop.
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 1
@ -146,7 +146,7 @@ Test case all=ERR all-dep=ERR end=ERR end-dep=ok.
`all' not remade because of errors.
Stop.
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 1
@ -156,7 +156,7 @@ Test case all=ERR all-dep=ERR end=ERR end-dep=ERR.
`all' not remade because of errors.
Stop.
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 1

View File

@ -2,7 +2,7 @@ false fails
*** Error code 1 (continuing)
Stop.
make: stopped in unit-tests
make: stopped making "all" in unit-tests
ERROR_INFO='This information is printed on 'errors'.'
Making sub-error as prerequisite.
Making .ERROR out of nothing.

View File

@ -7,5 +7,5 @@ Making depends-on-ignored from error-ignored.
`all' not remade because of errors.
Stop.
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 1

View File

@ -1,4 +1,4 @@
make: "deptgt-path-suffix.mk" line 8: Suffix '.c' not defined (yet)
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 1

View File

@ -8,10 +8,11 @@ ParseDependency(: empty-source)
Parsing line 39: : command for empty targets list
Parsing line 40: .MAKEFLAGS: -d0
ParseDependency(.MAKEFLAGS: -d0)
make: "deptgt.mk" line 49: while evaluating "${:U:Z}:": Unknown modifier "Z"
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
make: "deptgt.mk" line 58: warning: Special and mundane targets don't mix. Mundane ones ignored
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
make: stopped making "target1" in unit-tests
exit status 1

View File

@ -1,4 +1,4 @@
# $NetBSD: deptgt.mk,v 1.17 2024/04/20 10:18:55 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.
# expect+1: while evaluating "${:U:Z}:": Unknown modifier "Z"
$$$$$$$${:U:Z}:
# 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}:
# 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:
@:;

View File

@ -1,4 +1,5 @@
make: "directive-dinclude-error.inc" line 1: Invalid line 'syntax error'
in directive-dinclude.mk:21
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 1

View File

@ -17,5 +17,5 @@ make: "directive-elif.mk" line 143: 2-elsif
make: "directive-elif.mk" line 149: if-less elif
make: "directive-elif.mk" line 154: warning: extra elif
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 1

View File

@ -7,5 +7,5 @@ make: "directive-else.mk" line 36: ok
make: "directive-else.mk" line 38: warning: extra else
make: "directive-else.mk" line 51: The .else directive does not take arguments
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 1

View File

@ -1,4 +1,5 @@
make: "directive-export-gmake.mk" line 71: Invalid line 'export VAR=${:U1}', expanded to 'export VAR=1'
in .for loop from directive-export-gmake.mk:67 with value = 1
make: "directive-export-gmake.mk" line 85: 16:00:00
make: "directive-export-gmake.mk" line 92: Variable/Value missing from "export"
make: Fatal errors encountered -- cannot continue

View File

@ -1,5 +1,6 @@
make: "directive-for-break.mk" line 45: break outside of for loop
make: "directive-for-break.mk" line 65: The .break directive does not take arguments
in .for loop from directive-for-break.mk:63 with i = 1
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
exit status 1

View File

@ -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: "directive-for-errors.mk" line 64: Wrong number of words (5) in .for substitution list with 3 variables
make: "directive-for-errors.mk" line 78: missing `in' in for
make: "directive-for-errors.mk" line 89: while evaluating "${:U3:Z} 4": Unknown modifier "Z"
make: "directive-for-errors.mk" line 90: warning: Should not be reached.
make: "directive-for-errors.mk" line 90: warning: Should not be reached.
make: "directive-for-errors.mk" line 90: warning: Should not be reached.
make: "directive-for-errors.mk" line 89: while evaluating "${:U3:Z} 4" with value "3": Unknown modifier "Z"
make: "directive-for-errors.mk" line 93: warning: Should not be reached.
make: "directive-for-errors.mk" line 93: warning: Should not be reached.
make: "directive-for-errors.mk" line 93: warning: Should not be reached.
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
exit status 1

View File

@ -1,4 +1,4 @@
# $NetBSD: directive-for-errors.mk,v 1.11 2024/06/01 11:24:11 rillig Exp $
# $NetBSD: directive-for-errors.mk,v 1.13 2024/07/06 10:14:35 rillig Exp $
#
# Tests for error handling in .for loops.
@ -7,10 +7,10 @@
# in a parse error.
# expect+1: Unknown directive "fori"
.fori in 1 2 3
# expect+1: warning: <>
. warning <${i}>
# expect+1: for-less endfor
.endfor
# expect-2: warning: <>
# expect-2: for-less endfor
# A slash is not whitespace, therefore this is not parsed as a .for loop.
@ -23,10 +23,10 @@
# name is parsed a bit differently.
# expect+1: Unknown directive "for"
.for/i in 1 2 3
# expect+1: warning: <>
. warning <${i}>
# expect+1: for-less endfor
.endfor
# expect-2: warning: <>
# expect-2: for-less endfor
# Before for.c 1.173 from 2023-05-08, the variable name could be an arbitrary
@ -85,10 +85,10 @@ ${:U\\}= backslash # see whether the "variable" '\' is local
#
# XXX: As of 2020-12-31, Var_Subst doesn't report any errors, therefore
# the loop body is expanded as if no error had happened.
# expect+1: while evaluating "${:U3:Z} 4": Unknown modifier "Z"
# expect+1: while evaluating "${:U3:Z} 4" with value "3": Unknown modifier "Z"
.for i in 1 2 ${:U3:Z} 4
# expect+3: warning: Should not be reached.
# expect+2: warning: Should not be reached.
# expect+1: warning: Should not be reached.
. warning Should not be reached.
.endfor
# expect-2: warning: Should not be reached.
# expect-3: warning: Should not be reached.
# expect-4: warning: Should not be reached.

View File

@ -1,45 +1,47 @@
For: end for 1
For: loop body with chars = !"#$%&'()*+,-./0-9:;<=>?@A-Z[\]_^a-z{|}~:
. info ${:U!"#$%&'()*+,-./0-9\:;<=>?@A-Z[\\]_^a-z{|\}~}
make: Unclosed expression, expecting '}' for modifier "U!"" of variable "" with value "!""
make: "directive-for-escape.mk" line 19: !"
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: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{|}~:
. info ${:U!"\\\\#$%&'()*+,-./0-9\:;<=>?@A-Z[\\]_^a-z{|\}~}
make: Unclosed expression, expecting '}' for modifier "U!"\\\\" of variable "" with value "!"\\"
make: "directive-for-escape.mk" line 30: !"\\
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: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 = $:
. info ${:U\$}
make: "directive-for-escape.mk" line 45: $
make: "directive-for-escape.mk" line 57: $
For: loop body with i = ${V}:
. info ${:U${V}}
make: "directive-for-escape.mk" line 45: value
make: "directive-for-escape.mk" line 57: value
For: loop body with i = ${V:=-with-modifier}:
. info ${:U${V:=-with-modifier}}
make: "directive-for-escape.mk" line 45: value-with-modifier
make: "directive-for-escape.mk" line 57: value-with-modifier
For: loop body with i = $(V):
. info ${:U$(V)}
make: "directive-for-escape.mk" line 45: value
make: "directive-for-escape.mk" line 57: value
For: loop body with i = $(V:=-with-modifier):
. info ${:U$(V:=-with-modifier)}
make: "directive-for-escape.mk" line 45: value-with-modifier
make: "directive-for-escape.mk" line 57: value-with-modifier
For: end for 1
For: loop body with i = $:
. info ${:U\$}
make: "directive-for-escape.mk" line 60: $
make: "directive-for-escape.mk" line 69: $
For: loop body with i = ${V}:
. info ${:U${V}}
make: "directive-for-escape.mk" line 60: value
make: "directive-for-escape.mk" line 69: value
For: loop body with i = ${V:=-with-modifier}:
. info ${:U${V:=-with-modifier}}
make: "directive-for-escape.mk" line 60: value-with-modifier
make: "directive-for-escape.mk" line 69: value-with-modifier
For: loop body with i = $(V):
. info ${:U$(V)}
make: "directive-for-escape.mk" line 60: value
make: "directive-for-escape.mk" line 69: value
For: loop body with i = $(V:=-with-modifier):
. info ${:U$(V:=-with-modifier)}
make: "directive-for-escape.mk" line 60: value-with-modifier
make: "directive-for-escape.mk" line 69: value-with-modifier
For: end for 1
For: loop body with i = ${UNDEF:U\$\$:
# ${:U\${UNDEF\:U\\$\\$}
@ -50,77 +52,73 @@ For: loop body with i = end}:
For: end for 1
For: loop body with i = ${UNDEF:U\$\$:
. info ${:U\${UNDEF\:U\\$\\$}
make: "directive-for-escape.mk" line 115: ${UNDEF:U\backslash$
make: "directive-for-escape.mk" line 120: ${UNDEF:U\backslash$
For: loop body with i = {{}}:
. info ${:U{{\}\}}
make: "directive-for-escape.mk" line 115: {{}}
make: "directive-for-escape.mk" line 120: {{}}
For: loop body with i = end}:
. info ${:Uend\}}
make: "directive-for-escape.mk" line 115: end}
make: "directive-for-escape.mk" line 120: end}
For: end for 1
For: loop body with i = begin<${UNDEF:Ufallback:N{{{}}}}>end:
. info ${:Ubegin<${UNDEF:Ufallback:N{{{}}}}>end}
make: "directive-for-escape.mk" line 136: begin<fallback>end
make: "directive-for-escape.mk" line 138: begin<fallback>end
For: end for 1
For: loop body with i = $:
. info ${:U\$}
make: "directive-for-escape.mk" line 145: $
make: "directive-for-escape.mk" line 154: invalid character ':' in .for loop variable name
make: "directive-for-escape.mk" line 147: $
make: "directive-for-escape.mk" line 155: invalid character ':' in .for loop variable name
For: end for 1
make: "directive-for-escape.mk" line 164: invalid character '}' in .for loop variable name
make: "directive-for-escape.mk" line 165: invalid character '}' in .for loop variable name
For: end for 1
For: end for 1
For: loop body with i = inner:
. info . $$i: ${:Uinner}
. info . $${i}: ${:Uinner}
. info . $${i:M*}: ${:Uinner:M*}
. info . $$(i): $(:Uinner)
. info . $$(i:M*): $(:Uinner:M*)
. info . $${i$${:U}}: ${i${:U}}
. info . $${i\}}: ${:Uinner\}} # XXX: unclear why ForLoop_SubstVarLong needs this
. info . $${i2}: ${i2}
. info . $${i,}: ${i,}
. info . adjacent: ${:Uinner}${:Uinner}${:Uinner:M*}${:Uinner}
make: "directive-for-escape.mk" line 173: . $i: inner
make: "directive-for-escape.mk" line 174: . ${i}: inner
make: "directive-for-escape.mk" line 175: . ${i:M*}: inner
make: "directive-for-escape.mk" line 176: . $(i): inner
make: "directive-for-escape.mk" line 177: . $(i:M*): inner
make: "directive-for-escape.mk" line 178: . ${i${:U}}: outer
make: "directive-for-escape.mk" line 179: . ${i\}}: inner}
make: "directive-for-escape.mk" line 180: . ${i2}: two
make: "directive-for-escape.mk" line 181: . ${i,}: comma
make: "directive-for-escape.mk" line 182: . adjacent: innerinnerinnerinner
make: "directive-for-escape.mk" line 201: invalid character '$' in .for loop variable name
. info ${:Uinner} ${:Uinner} ${:Uinner:M*} $(:Uinner) $(:Uinner:M*)
make: "directive-for-escape.mk" line 175: inner inner inner inner inner
For: end for 1
make: "directive-for-escape.mk" line 213: eight and no cents.
For: loop body with i = inner:
. info ${i${:U}}
make: "directive-for-escape.mk" line 179: outer
For: end for 1
make: "directive-for-escape.mk" line 226: newline in .for value
make: "directive-for-escape.mk" line 226: newline in .for value
For: loop body with i = inner:
. info ${:Uinner\}} # XXX: unclear why ForLoop_SubstVarLong needs this
make: "directive-for-escape.mk" line 183: inner}
For: end for 1
For: loop body with i = inner:
. info ${i2} ${i,} ${:Uinner}${:Uinner}${:Uinner:M*}${:Uinner}
make: "directive-for-escape.mk" line 187: two comma innerinnerinnerinner
make: "directive-for-escape.mk" line 196: invalid character '$' in .for loop variable name
For: end for 1
make: "directive-for-escape.mk" line 208: eight and no cents.
For: end for 1
make: "directive-for-escape.mk" line 222: newline in .for value
in .for loop from directive-for-escape.mk:222 with i = "
"
make: "directive-for-escape.mk" line 222: newline in .for value
in .for loop from directive-for-escape.mk:222 with i = "
"
For: loop body with i = "
":
. info short: ${:U" "}
. info long: ${:U" "}
make: "directive-for-escape.mk" line 227: short: " "
make: "directive-for-escape.mk" line 228: long: " "
. info short: ${:U" "}, long: ${:U" "}
make: "directive-for-escape.mk" line 223: short: " ", long: " "
For: end for 1
For: loop body with i = "
":
Parsing line 244: .for i in "${.newline}"
Parsing line 236: .for i in "${.newline}"
For: end for 1
Parse_PushInput: .for loop in directive-for-escape.mk, line 244
make: "directive-for-escape.mk" line 244: newline in .for value
in .for loop from directive-for-escape.mk:244 with i = "
Parse_PushInput: .for loop in directive-for-escape.mk, line 236
make: "directive-for-escape.mk" line 236: newline in .for value
in .for loop from directive-for-escape.mk:236 with i = "
"
For: loop body with i = "
":
: ${:U" "}
SetFilenameVars: ${.PARSEDIR} = <some-dir> ${.PARSEFILE} = `directive-for-escape.mk'
Parsing line 245: : ${:U" "}
Parsing line 237: : ${:U" "}
ParseDependency(: " ")
ParseEOF: returning to file directive-for-escape.mk, line 247
ParseEOF: returning to file directive-for-escape.mk, line 239
SetFilenameVars: ${.PARSEDIR} = <some-dir> ${.PARSEFILE} = `directive-for-escape.mk'
Parsing line 247: .MAKEFLAGS: -d0
Parsing line 239: .MAKEFLAGS: -d0
ParseDependency(.MAKEFLAGS: -d0)
For: end for 1
For: loop body with i = #:

View File

@ -1,4 +1,4 @@
# $NetBSD: directive-for-escape.mk,v 1.23 2023/11/19 22:32:44 rillig Exp $
# $NetBSD: directive-for-escape.mk,v 1.28 2024/07/07 11:20:10 rillig Exp $
#
# Test escaping of special characters in the iteration values of a .for loop.
# These values get expanded later using the :U variable modifier, and this
@ -15,10 +15,11 @@ ASCII= !"\#$$%&'()*+,-./0-9:;<=>?@A-Z[\]_^a-z{|}~
# XXX: As of 2020-12-31, the '#' is not preserved in the expanded body of
# the loop. Not only would it need the escaping for the variable modifier
# ':U' but also the escaping for the line-end comment.
# expect+3: while evaluating "${:U!"" with value "!"": Unclosed expression, expecting '}' for modifier "U!""
# expect+2: !"
.for chars in ${ASCII}
. info ${chars}
.endfor
# expect-2: !"
# As of 2020-12-31, using 2 backslashes before be '#' would treat the '#'
# as comment character. Using 3 backslashes doesn't help either since
@ -26,10 +27,11 @@ ASCII= !"\#$$%&'()*+,-./0-9:;<=>?@A-Z[\]_^a-z{|}~
# This means that a '#' sign cannot be passed in the value of a .for loop
# at all.
ASCII.2020-12-31= !"\\\#$$%&'()*+,-./0-9:;<=>?@A-Z[\]_^a-z{|}~
# expect+3: while evaluating "${:U!"\\\\" with value "!"\\": Unclosed expression, expecting '}' for modifier "U!"\\\\"
# expect+2: !"\\
.for chars in ${ASCII.2020-12-31}
. info ${chars}
.endfor
# expect-2: !"\\
# Cover the code in ExprLen.
#
@ -41,31 +43,31 @@ ASCII.2020-12-31= !"\\\#$$%&'()*+,-./0-9:;<=>?@A-Z[\]_^a-z{|}~
# See for.c, function ExprLen.
V= value
VALUES= $$ $${V} $${V:=-with-modifier} $$(V) $$(V:=-with-modifier)
# expect: . info ${:U\$}
# expect+10: $
# expect: . info ${:U${V}}
# expect+8: value
# expect: . info ${:U${V:=-with-modifier}}
# expect+6: value-with-modifier
# expect: . info ${:U$(V)}
# expect+4: value
# expect: . info ${:U$(V:=-with-modifier)}
# expect+2: value-with-modifier
.for i in ${VALUES}
. info $i
.endfor
# expect: . info ${:U\$}
# expect-3: $
# expect: . info ${:U${V}}
# expect-5: value
# expect: . info ${:U${V:=-with-modifier}}
# expect-7: value-with-modifier
# expect: . info ${:U$(V)}
# expect-9: value
# expect: . info ${:U$(V:=-with-modifier)}
# expect-11: value-with-modifier
#
# Providing the loop items directly has the same effect.
# expect: . info ${:U\$}
# expect+7: $
# expect: . info ${:U${V}}
# expect+5: value
# expect+4: value-with-modifier
# expect+3: value
# expect+2: value-with-modifier
.for i in $$ $${V} $${V:=-with-modifier} $$(V) $$(V:=-with-modifier)
. info $i
.endfor
# expect: . info ${:U\$}
# expect-3: $
# expect: . info ${:U${V}}
# expect-5: value
# expect-6: value-with-modifier
# expect-7: value
# expect-8: value-with-modifier
# Try to cover the code for nested '{}' in ExprLen, without success.
#
@ -111,19 +113,18 @@ VALUES= $${UNDEF:U\$$\$$ {{}} end}
#
# To make the expression '$\' visible, define it to an actual word:
${:U\\}= backslash
# expect+4: ${UNDEF:U\backslash$
# expect+3: {{}}
# expect+2: end}
.for i in ${VALUES}
. info $i
.endfor
#
# expect-3: ${UNDEF:U\backslash$
# expect-4: {{}}
# expect-5: end}
#
# FIXME: There was no expression '$\' in the original text of the variable
# 'VALUES', that's a surprise in the parser.
# Second try to cover the code for nested '{}' in ExprLen.
# The second attempt to cover the code for nested '{}' in ExprLen.
#
# XXX: It is not the job of ExprLen to parse an expression, it is naive to
# expect ExprLen to get all the details right in just a few lines of code.
@ -132,19 +133,19 @@ ${:U\\}= backslash
# ':D' for details.) The only sensible thing to do is therefore to let
# Var_Parse do all the parsing work.
VALUES= begin<$${UNDEF:Ufallback:N{{{}}}}>end
# expect+2: begin<fallback>end
.for i in ${VALUES}
. info $i
.endfor
# expect-2: begin<fallback>end
# A single trailing dollar doesn't happen in practice.
# The dollar sign is correctly passed through to the body of the .for loop.
# There, it is expanded by the .info directive, but even there a trailing
# dollar sign is kept as-is.
# expect+2: $
.for i in ${:U\$}
. info ${i}
.endfor
# expect-2: $
# Before for.c 1.173 from 2023-05-08, the name of the iteration variable
# could contain colons, which affected expressions having this exact
@ -169,28 +170,22 @@ EXT= .c
i= outer
i2= two
i,= comma
# expect+2: inner inner inner inner inner
.for i in inner
. info . $$i: $i
. info . $${i}: ${i}
. info . $${i:M*}: ${i:M*}
. info . $$(i): $(i)
. info . $$(i:M*): $(i:M*)
. info . $${i$${:U}}: ${i${:U}}
. info . $${i\}}: ${i\}} # XXX: unclear why ForLoop_SubstVarLong needs this
. info . $${i2}: ${i2}
. info . $${i,}: ${i,}
. info . adjacent: $i${i}${i:M*}$i
. info $i ${i} ${i:M*} $(i) $(i:M*)
.endfor
# expect+2: outer
.for i in inner
. info ${i${:U}}
.endfor
# expect+2: inner}
.for i in inner
. info ${i\}} # XXX: unclear why ForLoop_SubstVarLong needs this
.endfor
# expect+2: two comma innerinnerinnerinner
.for i in inner
. info ${i2} ${i,} $i${i}${i:M*}$i
.endfor
# expect-11: . $i: inner
# expect-11: . ${i}: inner
# expect-11: . ${i:M*}: inner
# expect-11: . $(i): inner
# expect-11: . $(i:M*): inner
# expect-11: . ${i${:U}}: outer
# expect-11: . ${i\}}: inner}
# expect-11: . ${i2}: two
# expect-11: . ${i,}: comma
# expect-11: . adjacent: innerinnerinnerinner
# Before for.c 1.173 from 2023-05-08, the variable name could be a single '$'
# since there was no check on valid variable names. ForLoop_SubstVarShort
@ -221,16 +216,13 @@ ${closing-brace}= <closing-brace> # alternative interpretation
# The error message occurs in the line of the .for loop since that's the place
# where the body of the .for loop is constructed, and at this point the
# newline character gets replaced with a plain space.
# expect+3: newline in .for value
# expect+2: newline in .for value
# expect+1: newline in .for value
# expect+2: short: " ", long: " "
.for i in "${.newline}"
. info short: $i
. info long: ${i}
. info short: $i, long: ${i}
.endfor
# expect-3: short: " "
# expect-3: long: " "
# No error since the newline character is not actually used.
# No error since the newline character is not actually used in the body.
.for i in "${.newline}"
.endfor

View File

@ -1,7 +1,10 @@
make: "directive-for-generating-endif.mk" line 24: if-less endif
in .for loop from directive-for-generating-endif.mk:20 with i = 3
make: "directive-for-generating-endif.mk" line 24: if-less endif
in .for loop from directive-for-generating-endif.mk:20 with i = 2
make: "directive-for-generating-endif.mk" line 24: if-less endif
in .for loop from directive-for-generating-endif.mk:20 with i = 1
make: "directive-for-generating-endif.mk" line 30: 3 open conditionals
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 1

View File

@ -1,8 +1,11 @@
make: "directive-for-if.mk" line 51: if-less endif
in .for loop from directive-for-if.mk:46 with directive = if
make: "directive-for-if.mk" line 51: if-less endif
in .for loop from directive-for-if.mk:46 with directive = ifdef
make: "directive-for-if.mk" line 51: if-less endif
in .for loop from directive-for-if.mk:46 with directive = ifndef
VAR1
VAR3
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
make: stopped making "." in unit-tests
exit status 1

View File

@ -1,6 +1,7 @@
make: "(stdin)" line 2: Zero byte read from file
in directory <curdir>
*** Error code 2 (continuing)
Stop.
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 1

View File

@ -1,31 +1,33 @@
make: "directive-for.mk" line 117: outer
make: "directive-for.mk" line 135: a:\ a:\file.txt
make: "directive-for.mk" line 135: d:\\
make: "directive-for.mk" line 135: d:\\file.txt
make: "directive-for.mk" line 146: ( ( (
make: "directive-for.mk" line 146: [ [ [
make: "directive-for.mk" line 146: { { {
make: "directive-for.mk" line 146: ) ) )
make: "directive-for.mk" line 146: ] ] ]
make: "directive-for.mk" line 146: } } }
make: "directive-for.mk" line 146: (()) (()) (())
make: "directive-for.mk" line 146: [[]] [[]] [[]]
make: "directive-for.mk" line 146: {{}} {{}} {{}}
make: "directive-for.mk" line 146: )( )( )(
make: "directive-for.mk" line 146: ][ ][ ][
make: "directive-for.mk" line 146: }{ }{ }{
make: "directive-for.mk" line 138: a:\ a:\file.txt
make: "directive-for.mk" line 138: d:\\
make: "directive-for.mk" line 138: d:\\file.txt
make: "directive-for.mk" line 158: ( ( (
make: "directive-for.mk" line 158: [ [ [
make: "directive-for.mk" line 158: { { {
make: "directive-for.mk" line 158: ) ) )
make: "directive-for.mk" line 158: ] ] ]
make: "directive-for.mk" line 158: } } }
make: "directive-for.mk" line 158: (()) (()) (())
make: "directive-for.mk" line 158: [[]] [[]] [[]]
make: "directive-for.mk" line 158: {{}} {{}} {{}}
make: "directive-for.mk" line 158: )( )( )(
make: "directive-for.mk" line 158: ][ ][ ][
make: "directive-for.mk" line 158: }{ }{ }{
make: "directive-for.mk" line 166: invalid character ':' in .for loop variable name
make: "directive-for.mk" line 173: invalid character '$' in .for loop variable name
make: "directive-for.mk" line 185: invalid character '$' in .for loop variable name
make: "directive-for.mk" line 210: while evaluating "${:Uword2:Z}-after word3": Unknown modifier "Z"
make: "directive-for.mk" line 211: XXX: Should not reach word1
make: "directive-for.mk" line 211: XXX: Should not reach before--after
make: "directive-for.mk" line 211: XXX: Should not reach word3
make: "directive-for.mk" line 210: while evaluating "${:Uword2:Z}-after word3" with value "word2": Unknown modifier "Z"
make: "directive-for.mk" line 214: XXX: Should not reach word1
make: "directive-for.mk" line 214: XXX: Should not reach before--after
make: "directive-for.mk" line 214: XXX: Should not reach word3
make: "directive-for.mk" line 219: no iteration variables in for
make: "directive-for.mk" line 245: 1 open conditional
in .for loop from directive-for.mk:243 with var = value
make: "directive-for.mk" line 261: for-less endfor
make: "directive-for.mk" line 262: if-less endif
make: "directive-for.mk" line 270: if-less endif
in .for loop from directive-for.mk:269 with var = value
For: new loop 2
For: end for 2
For: end for 1
@ -36,7 +38,7 @@ For: loop body with outer = o:
endfor
For: end for 1
For: loop body with inner = i:
make: "directive-for.mk" line 318: newline-item=(a)
make: "directive-for.mk" line 319: newline-item=(a)
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
exit status 1

View File

@ -1,4 +1,4 @@
# $NetBSD: directive-for.mk,v 1.25 2024/04/20 10:18:55 rillig Exp $
# $NetBSD: directive-for.mk,v 1.27 2024/07/06 10:14:35 rillig Exp $
#
# Tests for the .for directive.
#
@ -132,31 +132,31 @@ EXPANSION${plus}= value
# variable values have been replaced with expressions of the form ${:U...},
# which are not interpreted as code anymore.
.for path in a:\ a:\file.txt d:\\ d:\\file.txt
# expect+3: a:\ a:\file.txt
# expect+2: d:\\
# expect+1: d:\\file.txt
. info ${path}
.endfor
# expect-2: a:\ a:\file.txt
# expect-3: d:\\
# expect-4: d:\\file.txt
# Ensure that braces and parentheses are properly escaped by the .for loop.
# Each line must print the same word 3 times.
# See ForLoop_SubstBody.
.for v in ( [ { ) ] } (()) [[]] {{}} )( ][ }{
# expect+12: ( ( (
# expect+11: [ [ [
# expect+10: { { {
# expect+9: ) ) )
# expect+8: ] ] ]
# expect+7: } } }
# expect+6: (()) (()) (())
# expect+5: [[]] [[]] [[]]
# expect+4: {{}} {{}} {{}}
# expect+3: )( )( )(
# expect+2: ][ ][ ][
# expect+1: }{ }{ }{
. info $v ${v} $(v)
.endfor
# expect-02: ( ( (
# expect-03: [ [ [
# expect-04: { { {
# expect-05: ) ) )
# expect-06: ] ] ]
# expect-07: } } }
# expect-08: (()) (()) (())
# expect-09: [[]] [[]] [[]]
# expect-10: {{}} {{}} {{}}
# expect-11: )( )( )(
# expect-12: ][ ][ ][
# expect-13: }{ }{ }{
# Before 2023-05-09, the variable names could contain arbitrary characters,
# except for whitespace, allowing for creative side effects, as usual for
@ -206,13 +206,13 @@ INDIRECT= ${DIRECT}
# XXX: A parse error or evaluation error in the items of the .for loop
# should skip the whole loop. As of 2023-05-09, the loop is expanded as
# usual.
# expect+1: while evaluating "${:Uword2:Z}-after word3": Unknown modifier "Z"
# expect+1: while evaluating "${:Uword2:Z}-after word3" with value "word2": Unknown modifier "Z"
.for var in word1 before-${:Uword2:Z}-after word3
# expect+3: XXX: Should not reach word1
# expect+2: XXX: Should not reach before--after
# expect+1: XXX: Should not reach word3
. info XXX: Should not reach ${var}
.endfor
# expect-2: XXX: Should not reach word1
# expect-3: XXX: Should not reach before--after
# expect-4: XXX: Should not reach word3
# An empty list of variables to the left of the 'in' is a parse error.
@ -315,6 +315,6 @@ INDIRECT= ${DIRECT}
# Back then, the .newline variable didn't exist, therefore it was unlikely
# that a newline ever occurred.
.for var in a${.newline}b${.newline}c
# expect+1: newline-item=(a)
. info newline-item=(${var})
.endfor
# expect-2: newline-item=(a)

View File

@ -1,4 +1,5 @@
make: "directive-hyphen-include-error.inc" line 1: Invalid line 'syntax error'
in directive-hyphen-include.mk:20
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 1

View File

@ -11,5 +11,5 @@ make: "directive-ifmake.mk" line 82: ok
make: don't know how to make !edge (continuing)
Stop.
make: stopped in unit-tests
make: stopped making "first second late-target !edge" in unit-tests
exit status 1

View File

@ -1,4 +1,4 @@
make: "directive-include-fatal.mk" line 14: Malformed conditional (${UNDEF})
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 1

View File

@ -4,10 +4,10 @@ CondParser_Eval: ${.MAKE.MAKEFILES:T} != "${.PARSEFILE} null"
Comparing "directive-include.mk null" != "directive-include.mk null"
make: "directive-include.mk" line 26: Could not find nonexistent.mk
make: "directive-include.mk" line 49: Could not find "
make: "directive-include.mk" line 56: while evaluating "${:U123:Z}.mk": Unknown modifier "Z"
make: "directive-include.mk" line 56: while evaluating "${:U123:Z}.mk" with value "123": Unknown modifier "Z"
make: "directive-include.mk" line 56: Could not find nonexistent.mk
make: "directive-include.mk" line 61: Cannot open /nonexistent
make: "directive-include.mk" line 66: Invalid line 'include'
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 1

View File

@ -1,4 +1,4 @@
# $NetBSD: directive-include.mk,v 1.14 2024/04/20 10:18:55 rillig Exp $
# $NetBSD: directive-include.mk,v 1.15 2024/07/05 19:47:22 rillig Exp $
#
# Tests for the .include directive, which includes another file.
@ -52,7 +52,7 @@ DQUOT= "
# expression is skipped and the file is included nevertheless.
# FIXME: Add proper error handling, no file must be included here.
# expect+2: Could not find nonexistent.mk
# expect+1: while evaluating "${:U123:Z}.mk": Unknown modifier "Z"
# expect+1: while evaluating "${:U123:Z}.mk" with value "123": Unknown modifier "Z"
.include "nonexistent${:U123:Z}.mk"
# The traditional include directive is seldom used.

View File

@ -11,5 +11,5 @@ make: "directive-info.mk" line 36: Unknown directive "info-message"
make: "directive-info.mk" line 38: no-target: no-source
make: "directive-info.mk" line 47: expect line 35 for multi-line message
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
make: stopped making ".info.man" in unit-tests
exit status 1

View File

@ -1,4 +1,5 @@
make: "directive-include-error.inc" line 1: Invalid line 'syntax error'
in directive-sinclude.mk:20
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 1

View File

@ -1,6 +1,6 @@
make: "directive-undef.mk" line 30: The .undef directive requires an argument
make: "directive-undef.mk" line 88: while evaluating variable "VARNAMES": Unknown modifier "Z"
make: "directive-undef.mk" line 88: while evaluating variable "VARNAMES" with value "VARNAMES": Unknown modifier "Z"
make: "directive-undef.mk" line 105: warning: UT_EXPORTED is still listed in .MAKE.EXPORTED even though spaceit is not exported anymore.
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 1

View File

@ -1,4 +1,4 @@
# $NetBSD: directive-undef.mk,v 1.14 2024/04/20 10:18:55 rillig Exp $
# $NetBSD: directive-undef.mk,v 1.15 2024/07/04 17:47:54 rillig Exp $
#
# Tests for the .undef directive.
#
@ -84,7 +84,7 @@ ${DOLLAR}= dollar
#
# As of var.c 1.762, this doesn't happen though because the error handling
# in Var_Parse and Var_Subst is not done properly.
# expect+1: while evaluating variable "VARNAMES": Unknown modifier "Z"
# expect+1: while evaluating variable "VARNAMES" with value "VARNAMES": Unknown modifier "Z"
.undef ${VARNAMES:L:Z}

View File

@ -14,5 +14,5 @@ Global: delete .MAKE.EXPORTED
Global: .MAKEFLAGS = -r -k -d v -d
Global: .MAKEFLAGS = -r -k -d v -d 0
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 1

View File

@ -7,5 +7,5 @@ make: "directive-warning.mk" line 19: warning: message
make: "directive-warning.mk" line 21: Unknown directive "warnings"
make: "directive-warning.mk" line 23: Unknown directive "warnings"
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 1

View File

@ -10,5 +10,5 @@ Global: .MAKEFLAGS = -r -k -d v -d 0
make: "directive.mk" line 40: Invalid line 'target-without-colon'
make: "directive.mk" line 43: Invalid line 'target-without-colon another-target'
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
make: stopped making ".target" in unit-tests
exit status 1

View File

@ -4,6 +4,6 @@ and now: sad
*** Error code 1
Stop.
make: stopped in unit-tests
make: stopped making "all" in unit-tests
.ERROR: Looks like 'sad' is upset.
exit status 1

View File

@ -1,5 +1,5 @@
: 'Making existing-target out of nothing.'
make: don't know how to make nonexistent-target (continuing)
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 2

View File

@ -1,8 +1,8 @@
false
*** [indirect] Error code 1
make: stopped in unit-tests
make: stopped making "all" in unit-tests
make: 1 error
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 2

View File

@ -2,10 +2,10 @@ make -f jobs-error-nested-make.mk nested
false
*** [nested] Error code 1
make: stopped in unit-tests
make: stopped making "nested" in unit-tests
make: 1 error
make: stopped in unit-tests
make: stopped making "nested" in unit-tests
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 2

View File

@ -2,14 +2,14 @@ make -f jobs-error-nested.mk nested
false
*** [nested] Error code 1
make: stopped in unit-tests
make: stopped making "nested" in unit-tests
make: 1 error
make: stopped in unit-tests
make: stopped making "nested" in unit-tests
*** [all] Error code 2
make: stopped in unit-tests
make: stopped making "all" in unit-tests
make: 1 error
make: stopped in unit-tests
make: stopped making "all" in unit-tests
exit status 2

View File

@ -1,4 +1,4 @@
make: in target "mod-loop-varname": while evaluating variable "VAR": In the :@ modifier, the variable name "${:Ubar:S,b,v,}" must not contain a dollar
make: in target "mod-loop-varname": while evaluating variable "VAR" with value "value": In the :@ modifier, the variable name "${:Ubar:S,b,v,}" must not contain a dollar
y@:Q}
xvaluey
exit status 2

Some files were not shown because too many files have changed in this diff Show More