Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make make(1): rename conflicting global variables ca...



details:   https://anonhg.NetBSD.org/src/rev/2694c1e038ee
branches:  trunk
changeset: 946440:2694c1e038ee
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Nov 28 08:40:05 2020 +0000

description:
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.

diffstat:

 usr.bin/make/job.c  |  20 ++++++++++----------
 usr.bin/make/main.c |  10 +++++-----
 2 files changed, 15 insertions(+), 15 deletions(-)

diffs (128 lines):

diff -r b5b22d0c452f -r 2694c1e038ee usr.bin/make/job.c
--- a/usr.bin/make/job.c        Sat Nov 28 08:31:41 2020 +0000
+++ b/usr.bin/make/job.c        Sat Nov 28 08:40:05 2020 +0000
@@ -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 @@
 /*
  * 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 @@
  *
  * 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 @@
        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 @@
     wantToken =        0;
 
     aborting = ABORT_NONE;
-    errors = 0;
+    job_errors = 0;
 
     lastNode = NULL;
 
@@ -2452,13 +2452,13 @@
 {
     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. */
diff -r b5b22d0c452f -r 2694c1e038ee usr.bin/make/main.c
--- a/usr.bin/make/main.c       Sat Nov 28 08:31:41 2020 +0000
+++ b/usr.bin/make/main.c       Sat Nov 28 08:40:05 2020 +0000
@@ -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 @@
 int makelevel;
 
 Boolean forceJobs = FALSE;
-static int errors = 0;
+static int main_errors = 0;
 static HashTable cached_realpaths;
 
 /*
@@ -1654,7 +1654,7 @@
 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 @@
                        break;
                err_file = stderr;
        }
-       errors++;
+       main_errors++;
 }
 
 /* Wait for any running jobs to finish, then produce an error message,



Home | Main Index | Thread Index | Old Index