DragonFly submit List (threaded) for 2004-11
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]
usr.bin/make functional changes
patch-4.16
o Pacify ``make -f /dev/null -V FOO''.
patch-4.17
o Add empty default cases where they should be, remove
non-local execution stuff in compat.c which doesn't even
have preprocessor-conditional-hidden support code, and
add a debugging statement where we might end up with a
nil list somehow, but where I doubt it.
First confirmed userland kill for Flexelint.
patch-4.18
o Makeing make(1) WARNS=6 cleanup
patch-4.19 Date: 2002/10/03 05:32:47 Author: jmallett
o In lieu of a good way to prevent every possible looping
in make(1), stop there from being more than 500 processes
forked by make(1), to prevent a forkbomb from happening,
in a dumb and mechanical way.
patch-4.20
o Some ANSI changes that we missed
---------------------
PatchSet 258
Date: 2002/08/07 14:25:51
Author: ru
Log:
Pacify ``make -f /dev/null -V FOO''.
Members:
main.c:1.67->1.68
Index: main.c
===================================================================
RCS file: /usr/home/okumoto/Work/make/fbsd-cvs/src/usr.bin/make/main.c,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -r1.67 -r1.68
--- main.c 26 Jul 2002 21:50:36 -0000 1.67
+++ main.c 7 Aug 2002 13:25:51 -0000 1.68
@@ -115,7 +115,6 @@
static Boolean noBuiltins; /* -r flag */
static Lst makefiles; /* ordered list of makefiles to read */
-static Boolean printVars; /* print value of one or more vars */
static Boolean expandVars; /* fully expand printed variables */
static Lst variables; /* list of variables to print */
int maxJobs; /* -j argument */
@@ -185,7 +184,6 @@
Var_Append(MAKEFLAGS, optarg, VAR_GLOBAL);
break;
case 'V':
- printVars = TRUE;
(void)Lst_AtEnd(variables, (void *)optarg);
Var_Append(MAKEFLAGS, "-V", VAR_GLOBAL);
Var_Append(MAKEFLAGS, optarg, VAR_GLOBAL);
@@ -605,7 +603,6 @@
create = Lst_Init(FALSE);
makefiles = Lst_Init(FALSE);
envFirstVars = Lst_Init(FALSE);
- printVars = FALSE;
expandVars = TRUE;
variables = Lst_Init(FALSE);
beSilent = FALSE; /* Print commands as executed */
@@ -814,7 +811,7 @@
Targ_PrintGraph(1);
/* print the values of any variables requested by the user */
- if (printVars) {
+ if (!Lst_IsEmpty(variables)) {
LstNode ln;
for (ln = Lst_First(variables); ln != NULL;
@@ -833,40 +830,41 @@
if (p1)
free(p1);
}
- }
-
- /*
- * Have now read the entire graph and need to make a list of targets
- * to create. If none was given on the command line, we consult the
- * parsing module to find the main target(s) to create.
- */
- if (Lst_IsEmpty(create))
- targs = Parse_MainName();
- else
- targs = Targ_FindList(create, TARG_CREATE);
+ } else {
- if (!compatMake && !printVars) {
/*
- * Initialize job module before traversing the graph, now that
- * any .BEGIN and .END targets have been read. This is done
- * only if the -q flag wasn't given (to prevent the .BEGIN from
- * being executed should it exist).
+ * Have now read the entire graph and need to make a list of targets
+ * to create. If none was given on the command line, we consult the
+ * parsing module to find the main target(s) to create.
*/
- if (!queryFlag) {
- if (maxLocal == -1)
- maxLocal = maxJobs;
- Job_Init(maxJobs, maxLocal);
- jobsRunning = TRUE;
- }
+ if (Lst_IsEmpty(create))
+ targs = Parse_MainName();
+ else
+ targs = Targ_FindList(create, TARG_CREATE);
- /* Traverse the graph, checking on all the targets */
- outOfDate = Make_Run(targs);
- } else if (!printVars) {
- /*
- * Compat_Init will take care of creating all the targets as
- * well as initializing the module.
- */
- Compat_Run(targs);
+ if (!compatMake) {
+ /*
+ * Initialize job module before traversing the graph, now that
+ * any .BEGIN and .END targets have been read. This is done
+ * only if the -q flag wasn't given (to prevent the .BEGIN from
+ * being executed should it exist).
+ */
+ if (!queryFlag) {
+ if (maxLocal == -1)
+ maxLocal = maxJobs;
+ Job_Init(maxJobs, maxLocal);
+ jobsRunning = TRUE;
+ }
+
+ /* Traverse the graph, checking on all the targets */
+ outOfDate = Make_Run(targs);
+ } else {
+ /*
+ * Compat_Init will take care of creating all the targets as
+ * well as initializing the module.
+ */
+ Compat_Run(targs);
+ }
}
Lst_Destroy(targs, NOFREE);
---------------------
PatchSet 259
Date: 2002/08/11 12:10:43
Author: ru
Log:
main.c:450: warning: `targs' might be used uninitialized in this function
Spotted by: patrick@xxxxxxxxxxxxx, naddy, -Wuninitialized
This segfaulted alpha and sparc64; i386 had this magically zeroed.
Members:
main.c:1.68->1.69
Index: main.c
===================================================================
RCS file: /usr/home/okumoto/Work/make/fbsd-cvs/src/usr.bin/make/main.c,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -r1.68 -r1.69
--- main.c 7 Aug 2002 13:25:51 -0000 1.68
+++ main.c 11 Aug 2002 11:10:43 -0000 1.69
@@ -865,9 +865,9 @@
*/
Compat_Run(targs);
}
+ Lst_Destroy(targs, NOFREE);
}
- Lst_Destroy(targs, NOFREE);
Lst_Destroy(variables, NOFREE);
Lst_Destroy(makefiles, NOFREE);
Lst_Destroy(create, (void (*) (void *)) free);
---------------------
PatchSet 274
Date: 2002/09/28 21:03:26
Author: jmallett
Log:
Add empty default cases where they should be, remove non-local execution stuff
in compat.c which doesn't even have preprocessor-conditional-hidden support
code, and add a debugging statement where we might end up with a nil list
somehow, but where I doubt it.
First confirmed userland kill for Flexelint.
Sponsored by: Bright Path Solutions
Members:
compat.c:1.31->1.32
cond.c:1.22->1.23
dir.c:1.27->1.28
job.c:1.41->1.42
parse.c:1.43->1.44
suff.c:1.23->1.24
targ.c:1.22->1.23
var.c:1.32->1.33
Index: compat.c
===================================================================
RCS file: /usr/home/okumoto/Work/make/fbsd-cvs/src/usr.bin/make/compat.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- compat.c 18 Sep 2002 16:13:02 -0000 1.31
+++ compat.c 28 Sep 2002 20:03:26 -0000 1.32
@@ -193,8 +193,6 @@
char **av; /* Argument vector for thing to exec */
int argc; /* Number of arguments in av or 0 if not
* dynamically allocated */
- Boolean local; /* TRUE if command should be executed
- * locally */
int internal; /* Various values.. */
char *cmd = (char *) cmdp;
GNode *gn = (GNode *) gnp;
@@ -317,8 +315,6 @@
av += 1;
}
- local = TRUE;
-
/*
* Fork and execute the single command. If the fork fails, we abort.
*/
@@ -327,15 +323,11 @@
Fatal("Could not fork");
}
if (cpid == 0) {
- if (local) {
- execvp(av[0], av);
- (void) write (STDERR_FILENO, av[0], strlen (av[0]));
- (void) write (STDERR_FILENO, ":", 1);
- (void) write (STDERR_FILENO, strerror(errno), strlen(strerror(errno)));
- (void) write (STDERR_FILENO, "\n", 1);
- } else {
- (void)execv(av[0], av);
- }
+ execvp(av[0], av);
+ (void) write (STDERR_FILENO, av[0], strlen (av[0]));
+ (void) write (STDERR_FILENO, ":", 1);
+ (void) write (STDERR_FILENO, strerror(errno), strlen(strerror(errno)));
+ (void) write (STDERR_FILENO, "\n", 1);
exit(1);
}
Index: cond.c
===================================================================
RCS file: /usr/home/okumoto/Work/make/fbsd-cvs/src/usr.bin/make/cond.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- cond.c 18 Sep 2002 16:13:02 -0000 1.22
+++ cond.c 28 Sep 2002 20:03:26 -0000 1.23
@@ -751,6 +751,8 @@
t = (left > right ? True : False);
}
break;
+ default:
+ break;
}
}
error:
Index: dir.c
===================================================================
RCS file: /usr/home/okumoto/Work/make/fbsd-cvs/src/usr.bin/make/dir.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- dir.c 18 Sep 2002 16:13:02 -0000 1.27
+++ dir.c 28 Sep 2002 20:03:26 -0000 1.28
@@ -473,6 +473,8 @@
Dir_Expand(file, path, expansions);
goto next;
}
+ default:
+ break;
}
if (*cp2 == '\0') {
/*
Index: job.c
===================================================================
RCS file: /usr/home/okumoto/Work/make/fbsd-cvs/src/usr.bin/make/job.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- job.c 18 Sep 2002 16:13:03 -0000 1.41
+++ job.c 28 Sep 2002 20:03:26 -0000 1.42
@@ -921,6 +921,8 @@
*/
done = FALSE;
break;
+ default:
+ break;
}
} else {
done = TRUE;
Index: parse.c
===================================================================
RCS file: /usr/home/okumoto/Work/make/fbsd-cvs/src/usr.bin/make/parse.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- parse.c 26 Sep 2002 06:44:30 -0000 1.43
+++ parse.c 28 Sep 2002 20:03:26 -0000 1.44
@@ -2088,7 +2088,8 @@
Buf_ReplaceLastByte(buf, (Byte)' ');
lineno++;
- while ((c = ParseReadc()) == ' ' || c == '\t');
+ while ((c = ParseReadc()) == ' ' || c == '\t')
+ continue;
if (c == EOF)
break;
@@ -2288,6 +2289,8 @@
semiNL = TRUE;
}
break;
+ default:
+ break;
}
/*
* Copy in the previous character and save this one in lastc.
@@ -2364,6 +2367,8 @@
For_Run();
line = ParseReadLine();
}
+ break;
+ default:
break;
}
}
Index: suff.c
===================================================================
RCS file: /usr/home/okumoto/Work/make/fbsd-cvs/src/usr.bin/make/suff.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- suff.c 18 Sep 2002 16:13:03 -0000 1.23
+++ suff.c 28 Sep 2002 20:03:26 -0000 1.24
@@ -412,6 +412,9 @@
break;
}
}
+ if (s2 == NULL) {
+ DEBUGF(SUFF, ("inserting an empty list?..."));
+ }
Lst_Close (l);
DEBUGF(SUFF, ("inserting %s(%d)...", s->name, s->sNum));
@@ -2356,6 +2359,8 @@
break;
case SUFF_LIBRARY:
printf ("LIBRARY");
+ break;
+ default:
break;
}
fputc(flags ? '|' : ')', stdout);
Index: targ.c
===================================================================
RCS file: /usr/home/okumoto/Work/make/fbsd-cvs/src/usr.bin/make/targ.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- targ.c 26 Sep 2002 06:40:04 -0000 1.22
+++ targ.c 28 Sep 2002 20:03:26 -0000 1.23
@@ -577,6 +577,8 @@
printf("! "); break;
case OP_DOUBLEDEP:
printf(":: "); break;
+ default:
+ break;
}
Targ_PrintType (gn->type);
Lst_ForEach (gn->children, TargPrintName, (void *)0);
Index: var.c
===================================================================
RCS file: /usr/home/okumoto/Work/make/fbsd-cvs/src/usr.bin/make/var.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- var.c 18 Sep 2002 16:13:03 -0000 1.32
+++ var.c 28 Sep 2002 20:03:26 -0000 1.33
@@ -1538,6 +1538,8 @@
return("$(.PREFIX)");
case '!':
return("$(.MEMBER)");
+ default:
+ break;
}
}
/*
@@ -1644,6 +1646,8 @@
return(val);
}
break;
+ default:
+ break;
}
}
}
@@ -1670,6 +1674,8 @@
case '!':
dynamic = TRUE;
break;
+ default:
+ break;
}
} else if ((vlen > 2) && (str[0] == '.') &&
isupper((unsigned char) str[1]) &&
@@ -2077,6 +2083,8 @@
case '1':
pattern.flags |= VAR_SUB_ONE;
continue;
+ default:
+ break;
}
break;
}
---------------------
PatchSet 275
Date: 2002/09/28 21:04:17
Author: jmallett
Log:
Fix merge error in previous commit.
Sponsored by: Bright Path Solutions
Members:
dir.c:1.28->1.29
Index: dir.c
===================================================================
RCS file: /usr/home/okumoto/Work/make/fbsd-cvs/src/usr.bin/make/dir.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- dir.c 28 Sep 2002 20:03:26 -0000 1.28
+++ dir.c 28 Sep 2002 20:04:17 -0000 1.29
@@ -472,9 +472,9 @@
case '[':
Dir_Expand(file, path, expansions);
goto next;
- }
default:
break;
+ }
}
if (*cp2 == '\0') {
/*
---------------------
PatchSet 276
Date: 2002/09/29 00:35:07
Author: jmallett
Log:
Make make(1) WARNS=6 clean except for const issues. This mostly involves
renaming variables to not shadow libc functions or greater scope locals. Kinda
makes one wonder if the extern ones weren't meant in some of these places :)
The only thing I'd still like to do WRT this is possibly combine rstat and
status in compat.c -- that should be fine, as I do not think the codepaths
will want both around at once.
Sponsored by: Bright Path Solutions
Members:
compat.c:1.32->1.33
main.c:1.71->1.72
make.c:1.20->1.21
parse.c:1.44->1.45
suff.c:1.24->1.25
targ.c:1.23->1.24
var.c:1.33->1.34
Index: compat.c
===================================================================
RCS file: /usr/home/okumoto/Work/make/fbsd-cvs/src/usr.bin/make/compat.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- compat.c 28 Sep 2002 20:03:26 -0000 1.32
+++ compat.c 28 Sep 2002 23:35:07 -0000 1.33
@@ -188,7 +188,7 @@
int reason; /* Reason for child's death */
int status; /* Description of child's death */
int cpid; /* Child actually found */
- ReturnStatus stat; /* Status of fork */
+ ReturnStatus rstat; /* Status of fork */
LstNode cmdNode; /* Node where current command is located */
char **av; /* Argument vector for thing to exec */
int argc; /* Number of arguments in av or 0 if not
@@ -347,13 +347,13 @@
*/
while (1) {
- while ((stat = wait(&reason)) != cpid) {
- if (stat == -1 && errno != EINTR) {
+ while ((rstat = wait(&reason)) != cpid) {
+ if (rstat == -1 && errno != EINTR) {
break;
}
}
- if (stat > -1) {
+ if (rstat > -1) {
if (WIFSTOPPED(reason)) {
status = WSTOPSIG(reason); /* stopped */
} else if (WIFEXITED(reason)) {
@@ -388,7 +388,7 @@
}
break;
} else {
- Fatal ("error in wait: %d", stat);
+ Fatal ("error in wait: %d", rstat);
/*NOTREACHED*/
}
}
Index: make.c
===================================================================
RCS file: /usr/home/okumoto/Work/make/fbsd-cvs/src/usr.bin/make/make.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- make.c 18 Sep 2002 16:13:03 -0000 1.20
+++ make.c 28 Sep 2002 23:35:07 -0000 1.21
@@ -511,8 +511,8 @@
* of this node.
*/
if (Lst_Open (cgn->iParents) == SUCCESS) {
- char *p1;
- char *cpref = Var_Value(PREFIX, cgn, &p1);
+ char *ptr;
+ char *cpref = Var_Value(PREFIX, cgn, &ptr);
while ((ln = Lst_Next (cgn->iParents)) != NULL) {
pgn = (GNode *)Lst_Datum (ln);
@@ -521,7 +521,7 @@
Var_Set (PREFIX, cpref, pgn);
}
}
- free(p1);
+ free(ptr);
Lst_Close (cgn->iParents);
}
}
Index: parse.c
===================================================================
RCS file: /usr/home/okumoto/Work/make/fbsd-cvs/src/usr.bin/make/parse.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- parse.c 28 Sep 2002 20:03:26 -0000 1.44
+++ parse.c 28 Sep 2002 23:35:07 -0000 1.45
@@ -1131,11 +1131,11 @@
* If it was .NULL, the source is the suffix to use when a file
* has no valid suffix.
*/
- char savec;
+ char savech;
while (*cp && !isspace ((unsigned char) *cp)) {
cp++;
}
- savec = *cp;
+ savech = *cp;
*cp = '\0';
switch (specType) {
case Suffixes:
@@ -1156,8 +1156,8 @@
default:
break;
}
- *cp = savec;
- if (savec != '\0') {
+ *cp = savech;
+ if (savech != '\0') {
cp++;
}
while (*cp && isspace ((unsigned char) *cp)) {
@@ -1190,7 +1190,7 @@
}
if (*cp == '(') {
- GNode *gn;
+ GNode *gnp;
sources = Lst_Init (FALSE);
if (Arch_ParseArchive (&line, sources, VAR_CMD) != SUCCESS) {
@@ -1200,8 +1200,8 @@
}
while (!Lst_IsEmpty (sources)) {
- gn = (GNode *) Lst_DeQueue (sources);
- ParseDoSrc (tOp, gn->name, curSrcs);
+ gnp = (GNode *) Lst_DeQueue (sources);
+ ParseDoSrc (tOp, gnp->name, curSrcs);
}
Lst_Destroy (sources, NOFREE);
cp = line;
@@ -1479,7 +1479,7 @@
} else if (type == VAR_SHELL) {
Boolean freeCmd = FALSE; /* TRUE if the command needs to be freed, i.e.
* if any variable expansion was performed */
- char *res, *err;
+ char *res, *error;
if (strchr(cp, '$') != NULL) {
/*
@@ -1491,12 +1491,12 @@
freeCmd = TRUE;
}
- res = Cmd_Exec(cp, &err);
+ res = Cmd_Exec(cp, &error);
Var_Set(line, res, ctxt);
free(res);
- if (err)
- Parse_Error(PARSE_WARNING, err, cp);
+ if (error)
+ Parse_Error(PARSE_WARNING, error, cp);
if (freeCmd)
free(cp);
Index: suff.c
===================================================================
RCS file: /usr/home/okumoto/Work/make/fbsd-cvs/src/usr.bin/make/suff.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- suff.c 28 Sep 2002 20:03:26 -0000 1.24
+++ suff.c 28 Sep 2002 23:35:07 -0000 1.25
@@ -1816,40 +1816,40 @@
if (ln != NULL) {
int prefLen; /* Length of the prefix */
- Src *targ;
+ Src *target;
/*
* Allocate a Src structure to which things can be transformed
*/
- targ = (Src *)emalloc(sizeof (Src));
- targ->file = estrdup(gn->name);
- targ->suff = (Suff *)Lst_Datum(ln);
- targ->suff->refCount++;
- targ->node = gn;
- targ->parent = (Src *)NULL;
- targ->children = 0;
+ target = (Src *)emalloc(sizeof (Src));
+ target->file = estrdup(gn->name);
+ target->suff = (Suff *)Lst_Datum(ln);
+ target->suff->refCount++;
+ target->node = gn;
+ target->parent = (Src *)NULL;
+ target->children = 0;
#ifdef DEBUG_SRC
- targ->cp = Lst_Init(FALSE);
+ target->cp = Lst_Init(FALSE);
#endif
/*
* Allocate room for the prefix, whose end is found by subtracting
* the length of the suffix from the end of the name.
*/
- prefLen = (eoname - targ->suff->nameLen) - sopref;
- targ->pref = emalloc(prefLen + 1);
- memcpy(targ->pref, sopref, prefLen);
- targ->pref[prefLen] = '\0';
+ prefLen = (eoname - target->suff->nameLen) - sopref;
+ target->pref = emalloc(prefLen + 1);
+ memcpy(target->pref, sopref, prefLen);
+ target->pref[prefLen] = '\0';
/*
* Add nodes from which the target can be made
*/
- SuffAddLevel(srcs, targ);
+ SuffAddLevel(srcs, target);
/*
* Record the target so we can nuke it
*/
- (void)Lst_AtEnd(targs, (void *)targ);
+ (void)Lst_AtEnd(targs, (void *)target);
/*
* Search from this suffix's successor...
Index: targ.c
===================================================================
RCS file: /usr/home/okumoto/Work/make/fbsd-cvs/src/usr.bin/make/targ.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- targ.c 28 Sep 2002 20:03:26 -0000 1.23
+++ targ.c 28 Sep 2002 23:35:07 -0000 1.24
@@ -456,11 +456,11 @@
*-----------------------------------------------------------------------
*/
char *
-Targ_FmtTime (time_t time)
+Targ_FmtTime (time_t modtime)
{
struct tm *parts;
static char buf[128];
- parts = localtime(&time);
+ parts = localtime(&modtime);
strftime(buf, sizeof buf, "%H:%M:%S %b %d, %Y", parts);
buf[sizeof(buf) - 1] = '\0';
Index: var.c
===================================================================
RCS file: /usr/home/okumoto/Work/make/fbsd-cvs/src/usr.bin/make/var.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- var.c 28 Sep 2002 20:03:26 -0000 1.33
+++ var.c 28 Sep 2002 23:35:07 -0000 1.34
@@ -1868,11 +1868,11 @@
case 'S':
{
VarPattern pattern;
- char delim;
+ char del;
Buffer buf; /* Buffer for patterns */
pattern.flags = 0;
- delim = tstr[1];
+ del = tstr[1];
tstr += 2;
/*
@@ -1893,16 +1893,16 @@
* the delimiter (expand the variable substitution).
* The result is left in the Buffer buf.
*/
- for (cp = tstr; *cp != '\0' && *cp != delim; cp++) {
+ for (cp = tstr; *cp != '\0' && *cp != del; cp++) {
if ((*cp == '\\') &&
- ((cp[1] == delim) ||
+ ((cp[1] == del) ||
(cp[1] == '$') ||
(cp[1] == '\\')))
{
Buf_AddByte(buf, (Byte)cp[1]);
cp++;
} else if (*cp == '$') {
- if (cp[1] != delim) {
+ if (cp[1] != del) {
/*
* If unescaped dollar sign not before the
* delimiter, assume it's a variable
@@ -1936,14 +1936,14 @@
* If lhs didn't end with the delimiter, complain and
* return NULL
*/
- if (*cp != delim) {
+ if (*cp != del) {
*lengthPtr = cp - start + 1;
if (*freePtr) {
free(str);
}
Buf_Destroy(buf, TRUE);
Error("Unclosed substitution for %s (%c missing)",
- v->name, delim);
+ v->name, del);
return (var_Error);
}
@@ -1968,16 +1968,16 @@
buf = Buf_Init(0);
tstr = cp + 1;
- for (cp = tstr; *cp != '\0' && *cp != delim; cp++) {
+ for (cp = tstr; *cp != '\0' && *cp != del; cp++) {
if ((*cp == '\\') &&
- ((cp[1] == delim) ||
+ ((cp[1] == del) ||
(cp[1] == '&') ||
(cp[1] == '\\') ||
(cp[1] == '$')))
{
Buf_AddByte(buf, (Byte)cp[1]);
cp++;
- } else if ((*cp == '$') && (cp[1] != delim)) {
+ } else if ((*cp == '$') && (cp[1] != del)) {
char *cp2;
int len;
Boolean freeIt;
@@ -2001,14 +2001,14 @@
/*
* If didn't end in delimiter character, complain
*/
- if (*cp != delim) {
+ if (*cp != del) {
*lengthPtr = cp - start + 1;
if (*freePtr) {
free(str);
}
Buf_Destroy(buf, TRUE);
Error("Unclosed substitution for %s (%c missing)",
- v->name, delim);
+ v->name, del);
return (var_Error);
}
@@ -2157,10 +2157,10 @@
#ifdef SUNSHCMD
case 's':
if (tstr[1] == 'h' && (tstr[2] == endc || tstr[2] == ':')) {
- char *err;
- newStr = Cmd_Exec (str, &err);
- if (err)
- Error (err, str);
+ char *error;
+ newStr = Cmd_Exec (str, &error);
+ if (error)
+ Error (error, str);
cp = tstr + 2;
termc = *cp;
break;
Index: main.c
===================================================================
RCS file: /usr/home/okumoto/Work/make/fbsd-cvs/src/usr.bin/make/main.c,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -r1.71 -r1.72
--- main.c 18 Sep 2002 16:13:03 -0000 1.71
+++ main.c 28 Sep 2002 23:35:07 -0000 1.72
@@ -992,9 +992,9 @@
*
* Results:
* A string containing the output of the command, or the empty string
- * If err is not NULL, it contains the reason for the command failure
+ * If error is not NULL, it contains the reason for the command failure
*
* Side Effects:
* The string must be freed by the caller.
*/
---------------------
PatchSet 281
Date: 2002/10/03 05:32:47
Author: jmallett
Log:
In lieu of a good way to prevent every possible looping in make(1), stop
there from being more than 500 processes forked by make(1), to prevent a
forkbomb from happening, in a dumb and mechanical way.
PR: alane
Submitted by: bin/42772
MFC after: 2 weeks
Members:
main.c:1.73->1.74
Index: main.c
===================================================================
RCS file: /usr/home/okumoto/Work/make/fbsd-cvs/src/usr.bin/make/main.c,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -r1.73 -r1.74
--- main.c 29 Sep 2002 00:02:04 -0000 1.73
+++ main.c 3 Oct 2002 04:32:47 -0000 1.74
@@ -102,6 +102,8 @@
#include "job.h"
#include "pathnames.h"
+#define WANT_ENV_MKLVL 1
+
#ifndef DEFMAXLOCAL
#define DEFMAXLOCAL DEFMAXJOBS
#endif /* DEFMAXLOCAL */
@@ -454,6 +456,12 @@
Boolean outOfDate = TRUE; /* FALSE if all targets up to date */
struct stat sa;
char *p, *p1, *path, *pathp;
+#ifdef WANT_ENV_MKLVL
+#define MKLVL_MAXVAL 500
+#define MKLVL_ENVVAR "__MKLVL__"
+ int iMkLvl = 0;
+ char *szMkLvl = getenv(MKLVL_ENVVAR);
+#endif /* WANT_ENV_MKLVL */
char mdpath[MAXPATHLEN];
char obpath[MAXPATHLEN];
char cdpath[MAXPATHLEN];
@@ -452,5 +472,18 @@
sigaction(SIGCHLD, &sa, NULL);
}
+
+#ifdef WANT_ENV_MKLVL
+ if ((iMkLvl = szMkLvl ? atoi(szMkLvl) : 0) < 0) {
+ iMkLvl = 0;
+ }
+ if (iMkLvl++ > MKLVL_MAXVAL) {
+ errc(2, EAGAIN,
+ "Max recursion level (%d) exceeded.", MKLVL_MAXVAL);
+ }
+ bzero(szMkLvl = emalloc(32), 32);
+ sprintf(szMkLvl, "%d", iMkLvl);
+ setenv(MKLVL_ENVVAR, szMkLvl, 1);
+#endif /* WANT_ENV_MKLVL */
#if DEFSHELL == 2
/*
---------------------
PatchSet 287
Date: 2002/10/09 04:42:09
Author: jmallett
Log:
Convert make(1) to use ANSI style function declarations. Variable
documentation already adequatedly existed in the description in most
cases. Where it did not, it was added. If no documentation existed
beforehand, then none was added. Some unused dummies for use in the
traversal functions were marked as __unused during the conversion.
Occasionally, local style fixes were applied to lines already being
modified or influenced.
Now make(1) should always build with WARNS=3.
Members:
arch.c:1.31->1.32
buf.c:1.17->1.18
compat.c:1.33->1.34
cond.c:1.23->1.24
dir.c:1.29->1.30
for.c:1.18->1.19
hash.c:1.17->1.18
job.c:1.44->1.45
main.c:1.77->1.78
make.c:1.22->1.23
parse.c:1.47->1.48
suff.c:1.25->1.26
targ.c:1.24->1.25
var.c:1.34->1.35
Index: util.c
===================================================================
RCS file: /usr/home/okumoto/Work/make/fbsd-cvs/src/usr.bin/make/util.c,v
diff -u -r1.77 -r1.78
--- util.c 9 Oct 2002 01:56:02 -0000 1.77
+++ util.c 9 Oct 2002 03:42:10 -0000 1.78
@@ -1275,7 +1265,7 @@
/*
* Finish --
* Called when aborting due to errors in child shell to signal
- * abnormal exit.
+ * abnormal exit, with the number of errors encountered in Make_Make.
*
* Results:
* None
@@ -1284,8 +1274,7 @@
* The program exits
*/
void
-Finish(errors)
- int errors; /* number of errors encountered in Make_Make */
+Finish(int errors)
{
Fatal("%d error%s", errors, errors == 1 ? "" : "s");
}
@@ -1295,8 +1284,7 @@
* malloc, but die on error.
*/
void *
-emalloc(len)
- size_t len;
+emalloc(size_t len)
{
void *p;
@@ -1310,8 +1298,7 @@
* strdup, but die on error.
*/
char *
-estrdup(str)
- const char *str;
+estrdup(const char *str)
{
char *p;
@@ -1325,9 +1312,7 @@
* realloc, but die on error.
*/
void *
-erealloc(ptr, size)
- void *ptr;
- size_t size;
+erealloc(void *ptr, size_t size)
{
if ((ptr = realloc(ptr, size)) == NULL)
enomem();
@@ -1339,7 +1324,7 @@
* die when out of memory.
*/
void
-enomem()
+enomem(void)
{
err(2, NULL);
}
@@ -1349,8 +1334,7 @@
* Remove a file carefully, avoiding directories.
*/
int
-eunlink(file)
- const char *file;
+eunlink(const char *file)
{
struct stat st;
@@ -1380,9 +1364,7 @@
int
-PrintAddr(a, b)
- void * a;
- void * b __unused;
+PrintAddr(void *a, void *b __unused)
{
printf("%p ", a);
return 0;
Index: main.c
===================================================================
RCS file: /usr/home/okumoto/Work/make/fbsd-cvs/src/usr.bin/make/main.c,v
--- main.c 9 Oct 2002 01:56:02 -0000 1.77
+++ main.c 9 Oct 2002 03:42:10 -0000 1.78
@@ -1369,7 +1353,7 @@
* exit with usage message
*/
static void
-usage()
+usage(void)
{
(void)fprintf(stderr, "%s\n%s\n%s\n",
"usage: make [-Beiknqrstv] [-D variable] [-d flags] [-E variable] [-f makefile]",
diff -ru dfly-src/make/var.c fbsd-src/make/var.c
--- dfly-src/make/var.c Wed Nov 17 03:37:57 2004
+++ fbsd-src/make/var.c Wed Nov 17 03:37:55 2004
@@ -169,9 +169,7 @@
*-----------------------------------------------------------------------
*/
static void
-VarPossiblyExpand(name, ctxt)
- char **name;
- GNode *ctxt;
+VarPossiblyExpand(char **name, GNode *ctxt)
{
if (strchr(*name, '$') != NULL)
*name = Var_Subst(NULL, *name, ctxt, 0);
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]