Module Name: src
Committed By: rillig
Date: Sat Nov 28 08:40:05 UTC 2020
Modified Files:
src/usr.bin/make: job.c main.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.330 -r1.331 src/usr.bin/make/job.c
cvs rdiff -u -r1.480 -r1.481 src/usr.bin/make/main.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/make/job.c
diff -u src/usr.bin/make/job.c:1.330 src/usr.bin/make/job.c:1.331
--- src/usr.bin/make/job.c:1.330 Sat Nov 28 08:31:41 2020
+++ src/usr.bin/make/job.c Sat Nov 28 08:40:05 2020
@@ -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. */
Index: src/usr.bin/make/main.c
diff -u src/usr.bin/make/main.c:1.480 src/usr.bin/make/main.c:1.481
--- src/usr.bin/make/main.c:1.480 Wed Nov 25 00:50:44 2020
+++ src/usr.bin/make/main.c Sat Nov 28 08:40:05 2020
@@ -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,