aboutsummaryrefslogtreecommitdiff
path: root/parse.c
diff options
context:
space:
mode:
authorSimon J. Gerraty <sjg@FreeBSD.org>2026-04-06 18:25:05 +0000
committerSimon J. Gerraty <sjg@FreeBSD.org>2026-04-06 18:25:05 +0000
commitfe271bdb43cf88ee129d94c0e286fe618fd28e89 (patch)
treef8a53c5b636b2af4eaa7ac94683cb00033588454 /parse.c
parent638c66de4a0faa4c2e815e81cd4021c2387c7e0f (diff)
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c54
1 files changed, 6 insertions, 48 deletions
diff --git a/parse.c b/parse.c
index ecc77366d2d7..bbbffaa71c16 100644
--- a/parse.c
+++ b/parse.c
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.753 2025/06/28 22:39:27 rillig Exp $ */
+/* $NetBSD: parse.c,v 1.755 2026/02/10 18:53:34 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -110,7 +110,7 @@
#include "pathnames.h"
/* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.753 2025/06/28 22:39:27 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.755 2026/02/10 18:53:34 sjg Exp $");
/* Detects a multiple-inclusion guard in a makefile. */
typedef enum {
@@ -481,11 +481,11 @@ add_parent_stack_trace:
}
void
-PrintStackTrace(bool includingInnermost)
+PrintStackTrace(FILE *f, bool includingInnermost)
{
char *stackTrace = GetStackTrace(includingInnermost);
- fprintf(stderr, "%s", stackTrace);
- fflush(stderr);
+ fprintf(f, "%s", stackTrace);
+ fflush(f);
free(stackTrace);
}
@@ -602,7 +602,7 @@ ParseVErrorInternal(FILE *f, bool useVars, const GNode *gn,
if (level == PARSE_FATAL || DEBUG(PARSE)
|| (gn == NULL && includes.len == 0 /* see PrintLocation */))
- PrintStackTrace(false);
+ PrintStackTrace(f, false);
}
static void MAKE_ATTR_PRINTFLIKE(3, 4)
@@ -1985,46 +1985,6 @@ Parse_Var(VarAssign *var, GNode *scope)
}
-/*
- * See if the command possibly calls a sub-make by using the
- * expressions ${.MAKE}, ${MAKE} or the plain word "make".
- */
-static bool
-MaybeSubMake(const char *cmd)
-{
- const char *start;
-
- for (start = cmd; *start != '\0'; start++) {
- const char *p = start;
- char endc;
-
- /* XXX: What if progname != "make"? */
- if (strncmp(p, "make", 4) == 0)
- if (start == cmd || !ch_isalnum(p[-1]))
- if (!ch_isalnum(p[4]))
- return true;
-
- if (*p != '$')
- continue;
- p++;
-
- if (*p == '{')
- endc = '}';
- else if (*p == '(')
- endc = ')';
- else
- continue;
- p++;
-
- if (*p == '.') /* Accept either ${.MAKE} or ${MAKE}. */
- p++;
-
- if (strncmp(p, "MAKE", 4) == 0 && p[4] == endc)
- return true;
- }
- return false;
-}
-
/* Append the command to the target node. */
static void
GNode_AddCommand(GNode *gn, char *cmd)
@@ -2035,8 +1995,6 @@ GNode_AddCommand(GNode *gn, char *cmd)
/* if target already supplied, ignore commands */
if (!(gn->type & OP_HAS_COMMANDS)) {
Lst_Append(&gn->commands, cmd);
- if (MaybeSubMake(cmd))
- gn->type |= OP_SUBMAKE;
RememberLocation(gn);
} else {
Parse_Error(PARSE_WARNING,