[Midnightbsd-cvs] src [6522] trunk/usr.bin/make: sync make with freebsd 9.2
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sun Dec 22 16:32:26 EST 2013
Revision: 6522
http://svnweb.midnightbsd.org/src/?rev=6522
Author: laffer1
Date: 2013-12-22 16:32:26 -0500 (Sun, 22 Dec 2013)
Log Message:
-----------
sync make with freebsd 9.2
Modified Paths:
--------------
trunk/usr.bin/make/Makefile
trunk/usr.bin/make/job.c
trunk/usr.bin/make/var.c
Modified: trunk/usr.bin/make/Makefile
===================================================================
--- trunk/usr.bin/make/Makefile 2013-12-22 21:23:07 UTC (rev 6521)
+++ trunk/usr.bin/make/Makefile 2013-12-22 21:32:26 UTC (rev 6522)
@@ -1,7 +1,7 @@
# @(#)Makefile 5.2 (Berkeley) 12/28/90
# $Id: Makefile,v 1.5 2012-07-20 02:29:45 laffer1 Exp $
# $FreeBSD: src/usr.bin/make/Makefile,v 1.66 2008/03/04 22:32:58 obrien Exp $
-# $MidnightBSD: src/usr.bin/make/Makefile,v 1.4 2012/01/18 01:49:21 laffer1 Exp $
+# $MidnightBSD$
.include <bsd.own.mk>
@@ -16,7 +16,7 @@
.endif
# Version has the RYYYYMMDDX format, where R is from RELENG_<R>
-CFLAGS+=-DMAKE_VERSION=\"9201120530\"
+CFLAGS+=-DMAKE_VERSION=\"9201210220\"
# There is no obvious performance improvement currently.
# CFLAGS+=-DUSE_KQUEUE
Modified: trunk/usr.bin/make/job.c
===================================================================
--- trunk/usr.bin/make/job.c 2013-12-22 21:23:07 UTC (rev 6521)
+++ trunk/usr.bin/make/job.c 2013-12-22 21:32:26 UTC (rev 6522)
@@ -41,7 +41,7 @@
#include <sys/cdefs.h>
/* $FreeBSD: src/usr.bin/make/job.c,v 1.130 2008/09/29 16:13:28 ache Exp $ */
-__MBSDID("$MidnightBSD: src/usr.bin/make/job.c,v 1.5 2012/01/18 01:49:21 laffer1 Exp $");
+__MBSDID("$MidnightBSD$");
/*-
* job.c --
@@ -382,7 +382,7 @@
static void JobDoOutput(Job *, Boolean);
static void JobInterrupt(int, int);
static void JobRestartJobs(void);
-static int Compat_RunCommand(char *, struct GNode *);
+static int Compat_RunCommand(LstNode *, struct GNode *);
static GNode *curTarg = NULL;
static GNode *ENDNode;
@@ -648,7 +648,7 @@
* numCommands is incremented if the command is actually printed.
*/
static int
-JobPrintCommand(char *cmd, Job *job)
+JobPrintCommand(LstNode *cmdNode, Job *job)
{
Boolean noSpecials; /* true if we shouldn't worry about
* inserting special commands into
@@ -659,41 +659,31 @@
* off before printing the command
* and need to turn it back on */
const char *cmdTemplate;/* Template to use when printing the command */
- char *cmdStart; /* Start of expanded command */
- LstNode *cmdNode; /* Node for replacing the command */
+ char *cmd; /* Expanded command */
noSpecials = (noExecute && !(job->node->type & OP_MAKE));
- if (strcmp(cmd, "...") == 0) {
- job->node->type |= OP_SAVE_CMDS;
- if ((job->flags & JOB_IGNDOTS) == 0) {
- job->tailCmds =
- Lst_Succ(Lst_Member(&job->node->commands, cmd));
- return (1);
- }
- return (0);
- }
-
#define DBPRINTF(fmt, arg) \
DEBUGF(JOB, (fmt, arg)); \
fprintf(job->cmdFILE, fmt, arg); \
fflush(job->cmdFILE);
- numCommands += 1;
-
/*
* For debugging, we replace each command with the result of expanding
* the variables in the command.
*/
- cmdNode = Lst_Member(&job->node->commands, cmd);
+ cmd = Buf_Peel(Var_Subst(Lst_Datum(cmdNode), job->node, FALSE));
+ if (strcmp(cmd, "...") == 0) {
+ free(cmd);
+ job->node->type |= OP_SAVE_CMDS;
+ if ((job->flags & JOB_IGNDOTS) == 0) {
+ job->tailCmds = Lst_Succ(cmdNode);
+ return (1);
+ }
+ return (0);
+ }
+ Lst_Replace(cmdNode, cmd);
- cmd = Buf_Peel(Var_Subst(cmd, job->node, FALSE));
- cmdStart = cmd;
-
- Lst_Replace(cmdNode, cmdStart);
-
- cmdTemplate = "%s\n";
-
/*
* Check for leading @', -' or +'s to control echoing, error checking,
* and execution on -n.
@@ -716,7 +706,7 @@
* but this one needs to be - use compat mode
* just for it.
*/
- Compat_RunCommand(cmd, job->node);
+ Compat_RunCommand(cmdNode, job->node);
return (0);
}
break;
@@ -727,6 +717,16 @@
while (isspace((unsigned char)*cmd))
cmd++;
+ /*
+ * Ignore empty commands
+ */
+ if (*cmd == '\0') {
+ return (0);
+ }
+
+ cmdTemplate = "%s\n";
+ numCommands += 1;
+
if (shutUp) {
if (!(job->flags & JOB_SILENT) && !noSpecials &&
commandShell->hasEchoCtl) {
@@ -1671,7 +1671,7 @@
Lst_Succ(gn->compat_command);
if (gn->compat_command == NULL ||
- JobPrintCommand(Lst_Datum(gn->compat_command), job))
+ JobPrintCommand(gn->compat_command, job))
noExec = TRUE;
if (noExec && !(job->flags & JOB_FIRST)) {
@@ -1695,7 +1695,7 @@
*/
numCommands = 0;
LST_FOREACH(ln, &gn->commands) {
- if (JobPrintCommand(Lst_Datum(ln), job))
+ if (JobPrintCommand(ln, job))
break;
}
@@ -1729,7 +1729,7 @@
*/
if (cmdsOK) {
LST_FOREACH(ln, &gn->commands) {
- if (JobPrintCommand(Lst_Datum(ln), job))
+ if (JobPrintCommand(ln, job))
break;
}
}
@@ -2815,7 +2815,7 @@
gn = Targ_FindNode(".INTERRUPT", TARG_NOCREATE);
if (gn != NULL) {
LST_FOREACH(ln, &gn->commands) {
- if (Compat_RunCommand(Lst_Datum(ln), gn))
+ if (Compat_RunCommand(ln, gn))
break;
}
}
@@ -2890,16 +2890,15 @@
* The node's 'made' field may be set to ERROR.
*/
static int
-Compat_RunCommand(char *cmd, GNode *gn)
+Compat_RunCommand(LstNode *cmdNode, GNode *gn)
{
ArgArray aa;
- char *cmdStart; /* Start of expanded command */
+ char *cmd; /* Expanded command */
Boolean silent; /* Don't print command */
Boolean doit; /* Execute even in -n */
Boolean errCheck; /* Check errors */
int reason; /* Reason for child's death */
int status; /* Description of child's death */
- LstNode *cmdNode; /* Node where current cmd is located */
char **av; /* Argument vector for thing to exec */
ProcStuff ps;
@@ -2907,31 +2906,16 @@
errCheck = !(gn->type & OP_IGNORE);
doit = FALSE;
- cmdNode = Lst_Member(&gn->commands, cmd);
- cmdStart = Buf_Peel(Var_Subst(cmd, gn, FALSE));
-
- /*
- * brk_string will return an argv with a NULL in av[0], thus causing
- * execvp() to choke and die horribly. Besides, how can we execute a
- * null command? In any case, we warn the user that the command
- * expanded to nothing (is this the right thing to do?).
- */
- if (*cmdStart == '\0') {
- free(cmdStart);
- Error("%s expands to empty string", cmd);
- return (0);
- } else {
- cmd = cmdStart;
- }
- Lst_Replace(cmdNode, cmdStart);
-
+ cmd = Buf_Peel(Var_Subst(Lst_Datum(cmdNode), gn, FALSE));
if ((gn->type & OP_SAVE_CMDS) && (gn != ENDNode)) {
- Lst_AtEnd(&ENDNode->commands, cmdStart);
+ Lst_AtEnd(&ENDNode->commands, cmd);
return (0);
- } else if (strcmp(cmdStart, "...") == 0) {
+ } else if (strcmp(cmd, "...") == 0) {
+ free(cmd);
gn->type |= OP_SAVE_CMDS;
return (0);
}
+ Lst_Replace(cmdNode, cmd);
while (*cmd == '@' || *cmd == '-' || *cmd == '+') {
switch (*cmd) {
@@ -2955,6 +2939,13 @@
cmd++;
/*
+ * Ignore empty commands
+ */
+ if (*cmd == '\0') {
+ return (0);
+ }
+
+ /*
* Print the command before echoing if we're not supposed to be quiet
* for this one. We also print the command if -n given, but not if '+'.
*/
@@ -3028,7 +3019,8 @@
* therefore do not free it when debugging.
*/
if (!DEBUG(GRAPH2)) {
- free(cmdStart);
+ free(Lst_Datum(cmdNode));
+ Lst_Replace(cmdNode, NULL);
}
/*
@@ -3174,8 +3166,7 @@
if (!touchFlag) {
curTarg = gn;
LST_FOREACH(ln, &gn->commands) {
- if (Compat_RunCommand(Lst_Datum(ln),
- gn))
+ if (Compat_RunCommand(ln, gn))
break;
}
curTarg = NULL;
@@ -3353,7 +3344,7 @@
gn = Targ_FindNode(".BEGIN", TARG_NOCREATE);
if (gn != NULL) {
LST_FOREACH(ln, &gn->commands) {
- if (Compat_RunCommand(Lst_Datum(ln), gn))
+ if (Compat_RunCommand(ln, gn))
break;
}
if (gn->made == ERROR) {
@@ -3394,7 +3385,7 @@
*/
if (makeErrors == 0) {
LST_FOREACH(ln, &ENDNode->commands) {
- if (Compat_RunCommand(Lst_Datum(ln), ENDNode))
+ if (Compat_RunCommand(ln, ENDNode))
break;
}
}
Modified: trunk/usr.bin/make/var.c
===================================================================
--- trunk/usr.bin/make/var.c 2013-12-22 21:23:07 UTC (rev 6521)
+++ trunk/usr.bin/make/var.c 2013-12-22 21:32:26 UTC (rev 6522)
@@ -41,7 +41,7 @@
#include <sys/cdefs.h>
/* $FreeBSD: src/usr.bin/make/var.c,v 1.163 2006/07/17 21:05:27 obrien Exp $ */
-__MBSDID("$MidnightBSD: src/usr.bin/make/var.c,v 1.4 2012/01/18 01:49:21 laffer1 Exp $");
+__MBSDID("$MidnightBSD$");
/**
* var.c --
@@ -1422,6 +1422,7 @@
vp->ptr++;
}
*ptr = '\0';
+ DEBUGF(VAR, ("Pattern :%s\n", patt));
if (modifier == 'M') {
newValue = VarModify(value, VarMatch, patt);
@@ -1766,7 +1767,7 @@
if ((vp->ptr[0] == 's') &&
(vp->ptr[1] == 'h') &&
(vp->ptr[2] == endc || vp->ptr[2] == ':')) {
- const char *error;
+ const char *error = NULL;
if (vp->execute) {
newStr = Buf_Peel(
More information about the Midnightbsd-cvs
mailing list