make(1): rename conflicting global variables called 'error'

When compiling make in all-in-one mode, these variable names conflict.
They could have been merged into a single variable, but that would have
required to make it a global variable for the other modules as well.
The parse module has a similar variable called 'fatals'.  All these can
possibly be merged into a single variable, but not now.
This commit is contained in:
rillig 2020-11-28 08:40:05 +00:00
parent 3330831119
commit 8b03784eeb
2 changed files with 15 additions and 15 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: job.c,v 1.330 2020/11/28 08:31:41 rillig Exp $ */
/* $NetBSD: job.c,v 1.331 2020/11/28 08:40:05 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@ -143,7 +143,7 @@
#include "trace.h"
/* "@(#)job.c 8.2 (Berkeley) 3/19/94" */
MAKE_RCSID("$NetBSD: job.c,v 1.330 2020/11/28 08:31:41 rillig Exp $");
MAKE_RCSID("$NetBSD: job.c,v 1.331 2020/11/28 08:40:05 rillig Exp $");
/* A shell defines how the commands are run. All commands for a target are
* written into a single file, which is then given to the shell to execute
@ -215,7 +215,7 @@ typedef struct Shell {
/*
* error handling variables
*/
static int errors = 0; /* number of errors reported */
static int job_errors = 0; /* number of errors reported */
typedef enum AbortReason { /* why is the make aborting? */
ABORT_NONE,
ABORT_ERROR, /* Because of an error */
@ -952,7 +952,7 @@ JobClosePipes(Job *job)
*
* Deferred commands for the job are placed on the .END node.
*
* If there was a serious error (errors != 0; not an ignored one), no more
* If there was a serious error (job_errors != 0; not an ignored one), no more
* jobs will be started.
*
* Input:
@ -1080,18 +1080,18 @@ JobFinish(Job *job, int status)
Make_Update(job->node);
job->status = JOB_ST_FREE;
} else if (status != 0) {
errors++;
job_errors++;
job->status = JOB_ST_FREE;
}
if (errors > 0 && !opts.keepgoing && aborting != ABORT_INTERRUPT)
if (job_errors > 0 && !opts.keepgoing && aborting != ABORT_INTERRUPT)
aborting = ABORT_ERROR; /* Prevent more jobs from getting started. */
if (return_job_token)
Job_TokenReturn();
if (aborting == ABORT_ERROR && jobTokensRunning == 0)
Finish(errors);
Finish(job_errors);
}
static void
@ -2082,7 +2082,7 @@ Job_Init(void)
wantToken = 0;
aborting = ABORT_NONE;
errors = 0;
job_errors = 0;
lastNode = NULL;
@ -2452,13 +2452,13 @@ Job_Finish(void)
{
GNode *endNode = Targ_GetEndNode();
if (!Lst_IsEmpty(endNode->commands) || !Lst_IsEmpty(endNode->children)) {
if (errors != 0) {
if (job_errors != 0) {
Error("Errors reported so .END ignored");
} else {
JobRun(endNode);
}
}
return errors;
return job_errors;
}
/* Clean up any memory used by the jobs module. */

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.480 2020/11/25 00:50:44 sjg Exp $ */
/* $NetBSD: main.c,v 1.481 2020/11/28 08:40:05 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -109,7 +109,7 @@
#include "trace.h"
/* "@(#)main.c 8.3 (Berkeley) 3/19/94" */
MAKE_RCSID("$NetBSD: main.c,v 1.480 2020/11/25 00:50:44 sjg Exp $");
MAKE_RCSID("$NetBSD: main.c,v 1.481 2020/11/28 08:40:05 rillig Exp $");
#if defined(MAKE_NATIVE) && !defined(lint)
__COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
"The Regents of the University of California. "
@ -146,7 +146,7 @@ pid_t myPid;
int makelevel;
Boolean forceJobs = FALSE;
static int errors = 0;
static int main_errors = 0;
static HashTable cached_realpaths;
/*
@ -1654,7 +1654,7 @@ main_CleanUp(void)
static int
main_Exit(Boolean outOfDate)
{
if (opts.lint && (errors > 0 || Parse_GetFatals() > 0))
if (opts.lint && (main_errors > 0 || Parse_GetFatals() > 0))
return 2; /* Not 1 so -q can distinguish error */
return outOfDate ? 1 : 0;
}
@ -1880,7 +1880,7 @@ Error(const char *fmt, ...)
break;
err_file = stderr;
}
errors++;
main_errors++;
}
/* Wait for any running jobs to finish, then produce an error message,