mirror of
https://github.com/freebsd/freebsd-src
synced 2024-11-05 18:22:52 +00:00
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
This commit is contained in:
parent
83c64295bd
commit
763d9eb177
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=104121
7 changed files with 69 additions and 69 deletions
|
@ -188,7 +188,7 @@ CompatRunCommand (cmdp, gnp)
|
|||
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 @@ CompatRunCommand (cmdp, gnp)
|
|||
*/
|
||||
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 @@ CompatRunCommand (cmdp, gnp)
|
|||
}
|
||||
break;
|
||||
} else {
|
||||
Fatal ("error in wait: %d", stat);
|
||||
Fatal ("error in wait: %d", rstat);
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
}
|
||||
|
|
|
@ -778,7 +778,7 @@ main(argc, argv)
|
|||
* <directory>:<directory>:<directory>...
|
||||
*/
|
||||
if (Var_Exists("VPATH", VAR_CMD)) {
|
||||
char *vpath, *path, *cp, savec;
|
||||
char *vpath, *path1, *cp1, savec;
|
||||
/*
|
||||
* GCC stores string constants in read-only memory, but
|
||||
* Var_Subst will want to write this thing, so store it
|
||||
|
@ -787,18 +787,18 @@ main(argc, argv)
|
|||
static char VPATH[] = "${VPATH}";
|
||||
|
||||
vpath = Var_Subst(NULL, VPATH, VAR_CMD, FALSE);
|
||||
path = vpath;
|
||||
path1 = vpath;
|
||||
do {
|
||||
/* skip to end of directory */
|
||||
for (cp = path; *cp != ':' && *cp != '\0'; cp++)
|
||||
for (cp1 = path1; *cp != ':' && *cp != '\0'; cp++)
|
||||
continue;
|
||||
/* Save terminator character so know when to stop */
|
||||
savec = *cp;
|
||||
*cp = '\0';
|
||||
savec = *cp1;
|
||||
*cp1 = '\0';
|
||||
/* Add directory to search path */
|
||||
Dir_AddDir(dirSearchPath, path);
|
||||
*cp = savec;
|
||||
path = cp + 1;
|
||||
Dir_AddDir(dirSearchPath, path1);
|
||||
*cp1 = savec;
|
||||
path1 = cp1 + 1;
|
||||
} while (savec == ':');
|
||||
(void)free(vpath);
|
||||
}
|
||||
|
@ -992,15 +992,15 @@ ReadMakefile(p, q)
|
|||
*
|
||||
* 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.
|
||||
*/
|
||||
char *
|
||||
Cmd_Exec(cmd, err)
|
||||
Cmd_Exec(cmd, error)
|
||||
char *cmd;
|
||||
char **err;
|
||||
char **error;
|
||||
{
|
||||
char *args[4]; /* Args for invoking the shell */
|
||||
int fds[2]; /* Pipe streams */
|
||||
|
@ -1013,7 +1013,7 @@ Cmd_Exec(cmd, err)
|
|||
int cc;
|
||||
|
||||
|
||||
*err = NULL;
|
||||
*error = NULL;
|
||||
|
||||
/*
|
||||
* Set up arguments for shell
|
||||
|
@ -1027,7 +1027,7 @@ Cmd_Exec(cmd, err)
|
|||
* Open a pipe for fetching its output
|
||||
*/
|
||||
if (pipe(fds) == -1) {
|
||||
*err = "Couldn't create pipe for \"%s\"";
|
||||
*error = "Couldn't create pipe for \"%s\"";
|
||||
goto bad;
|
||||
}
|
||||
|
||||
|
@ -1060,7 +1060,7 @@ Cmd_Exec(cmd, err)
|
|||
/*NOTREACHED*/
|
||||
|
||||
case -1:
|
||||
*err = "Couldn't exec \"%s\"";
|
||||
*error = "Couldn't exec \"%s\"";
|
||||
goto bad;
|
||||
|
||||
default:
|
||||
|
@ -1091,13 +1091,13 @@ Cmd_Exec(cmd, err)
|
|||
continue;
|
||||
|
||||
if (cc == -1)
|
||||
*err = "Error reading shell's output for \"%s\"";
|
||||
*error = "Error reading shell's output for \"%s\"";
|
||||
|
||||
res = (char *)Buf_GetAll (buf, &cc);
|
||||
Buf_Destroy (buf, FALSE);
|
||||
|
||||
if (status)
|
||||
*err = "\"%s\" returned non-zero status";
|
||||
*error = "\"%s\" returned non-zero status";
|
||||
|
||||
/*
|
||||
* Null-terminate the result, convert newlines to spaces and
|
||||
|
|
|
@ -511,8 +511,8 @@ Make_Update (cgn)
|
|||
* 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 @@ Make_Update (cgn)
|
|||
Var_Set (PREFIX, cpref, pgn);
|
||||
}
|
||||
}
|
||||
efree(p1);
|
||||
efree(ptr);
|
||||
Lst_Close (cgn->iParents);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1131,11 +1131,11 @@ ParseDoDependency (line)
|
|||
* 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 @@ ParseDoDependency (line)
|
|||
default:
|
||||
break;
|
||||
}
|
||||
*cp = savec;
|
||||
if (savec != '\0') {
|
||||
*cp = savech;
|
||||
if (savech != '\0') {
|
||||
cp++;
|
||||
}
|
||||
while (*cp && isspace ((unsigned char) *cp)) {
|
||||
|
@ -1190,7 +1190,7 @@ ParseDoDependency (line)
|
|||
}
|
||||
|
||||
if (*cp == '(') {
|
||||
GNode *gn;
|
||||
GNode *gnp;
|
||||
|
||||
sources = Lst_Init (FALSE);
|
||||
if (Arch_ParseArchive (&line, sources, VAR_CMD) != SUCCESS) {
|
||||
|
@ -1200,8 +1200,8 @@ ParseDoDependency (line)
|
|||
}
|
||||
|
||||
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 @@ Parse_DoVar (line, ctxt)
|
|||
} 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 @@ Parse_DoVar (line, ctxt)
|
|||
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);
|
||||
|
|
|
@ -1816,40 +1816,40 @@ SuffFindNormalDeps(gn, slst)
|
|||
|
||||
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...
|
||||
|
|
|
@ -456,13 +456,13 @@ Targ_PrintCmd (cmd, dummy)
|
|||
*-----------------------------------------------------------------------
|
||||
*/
|
||||
char *
|
||||
Targ_FmtTime (time)
|
||||
time_t time;
|
||||
Targ_FmtTime (modtime)
|
||||
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';
|
||||
|
|
|
@ -1868,11 +1868,11 @@ Var_Parse (str, ctxt, err, lengthPtr, freePtr)
|
|||
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 @@ Var_Parse (str, ctxt, err, lengthPtr, freePtr)
|
|||
* 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 @@ Var_Parse (str, ctxt, err, lengthPtr, freePtr)
|
|||
* 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 @@ Var_Parse (str, ctxt, err, lengthPtr, freePtr)
|
|||
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 @@ Var_Parse (str, ctxt, err, lengthPtr, freePtr)
|
|||
/*
|
||||
* 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 @@ Var_Parse (str, ctxt, err, lengthPtr, freePtr)
|
|||
#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;
|
||||
|
|
Loading…
Reference in a new issue