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: remove unnecessary words from command lin...



details:   https://anonhg.NetBSD.org/src/rev/87d2f4ee96c2
branches:  trunk
changeset: 1029208:87d2f4ee96c2
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Dec 27 18:26:22 2021 +0000

description:
make: remove unnecessary words from command line options

Several years ago, the command line options were individual global
variables.  The global variable could therefore not be named 'silent'
since that would have conflicted with local variables of the same name.
After moving the global variable to the namespace 'struct CmdOpts',
there is no conflict anymore.

There doesn't seem to be any risk of naming collisions for the names
'touch' and 'query'.

No functional change.

diffstat:

 usr.bin/make/compat.c |  12 ++++++------
 usr.bin/make/job.c    |  12 ++++++------
 usr.bin/make/main.c   |  18 +++++++++---------
 usr.bin/make/make.c   |   8 ++++----
 usr.bin/make/make.h   |   8 ++++----
 usr.bin/make/parse.c  |   6 +++---
 6 files changed, 32 insertions(+), 32 deletions(-)

diffs (267 lines):

diff -r cb671014428d -r 87d2f4ee96c2 usr.bin/make/compat.c
--- a/usr.bin/make/compat.c     Mon Dec 27 17:18:57 2021 +0000
+++ b/usr.bin/make/compat.c     Mon Dec 27 18:26:22 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat.c,v 1.234 2021/12/27 17:18:57 rillig Exp $      */
+/*     $NetBSD: compat.c,v 1.235 2021/12/27 18:26:22 rillig Exp $      */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -96,7 +96,7 @@
 #include "pathnames.h"
 
 /*     "@(#)compat.c   8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: compat.c,v 1.234 2021/12/27 17:18:57 rillig Exp $");
+MAKE_RCSID("$NetBSD: compat.c,v 1.235 2021/12/27 18:26:22 rillig Exp $");
 
 static GNode *curTarg = NULL;
 static pid_t compatChild;
@@ -531,7 +531,7 @@
         * to tell him/her "yes".
         */
        DEBUG0(MAKE, "out-of-date.\n");
-       if (opts.queryFlag)
+       if (opts.query)
                exit(1);
 
        /*
@@ -546,7 +546,7 @@
         */
        if (opts.ignoreErrors)
                gn->type |= OP_IGNORE;
-       if (opts.beSilent)
+       if (opts.silent)
                gn->type |= OP_SILENT;
 
        if (Job_CheckCommands(gn, Fatal)) {
@@ -554,7 +554,7 @@
                 * Our commands are ok, but we still have to worry about
                 * the -t flag.
                 */
-               if (!opts.touchFlag || (gn->type & OP_MAKE)) {
+               if (!opts.touch || (gn->type & OP_MAKE)) {
                        curTarg = gn;
 #ifdef USE_META
                        if (useMeta && GNode_ShouldExecute(gn)) {
@@ -721,7 +721,7 @@
         */
        (void)Targ_GetEndNode();
 
-       if (!opts.queryFlag)
+       if (!opts.query)
                MakeBeginNode();
 
        /*
diff -r cb671014428d -r 87d2f4ee96c2 usr.bin/make/job.c
--- a/usr.bin/make/job.c        Mon Dec 27 17:18:57 2021 +0000
+++ b/usr.bin/make/job.c        Mon Dec 27 18:26:22 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: job.c,v 1.444 2021/12/27 17:18:57 rillig Exp $ */
+/*     $NetBSD: job.c,v 1.445 2021/12/27 18:26:22 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -142,7 +142,7 @@
 #include "trace.h"
 
 /*     "@(#)job.c      8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: job.c,v 1.444 2021/12/27 17:18:57 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.445 2021/12/27 18:26:22 rillig Exp $");
 
 /*
  * A shell defines how the commands are run.  All commands for a target are
@@ -1668,7 +1668,7 @@
 
        job->special = special || gn->type & OP_SPECIAL;
        job->ignerr = opts.ignoreErrors || gn->type & OP_IGNORE;
-       job->echo = !(opts.beSilent || gn->type & OP_SILENT);
+       job->echo = !(opts.silent || gn->type & OP_SILENT);
 
        /*
         * Check the commands now so any attributes from .DEFAULT have a
@@ -1691,7 +1691,7 @@
                        DieHorribly();
                }
        } else if (((gn->type & OP_MAKE) && !opts.noRecursiveExecute) ||
-           (!opts.noExecute && !opts.touchFlag)) {
+           (!opts.noExecute && !opts.touch)) {
                /*
                 * The above condition looks very similar to
                 * GNode_ShouldExecute but is subtly different.  It prevents
@@ -1924,7 +1924,7 @@
                         * we add one of our own free will.
                         */
                        if (*cp != '\0') {
-                               if (!opts.beSilent)
+                               if (!opts.silent)
                                        SwitchOutputTo(job->node);
 #ifdef USE_META
                                if (useMeta) {
@@ -2608,7 +2608,7 @@
 
        JobSigUnlock(&mask);
 
-       if (runINTERRUPT && !opts.touchFlag) {
+       if (runINTERRUPT && !opts.touch) {
                interrupt = Targ_FindNode(".INTERRUPT");
                if (interrupt != NULL) {
                        opts.ignoreErrors = false;
diff -r cb671014428d -r 87d2f4ee96c2 usr.bin/make/main.c
--- a/usr.bin/make/main.c       Mon Dec 27 17:18:57 2021 +0000
+++ b/usr.bin/make/main.c       Mon Dec 27 18:26:22 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.548 2021/12/27 17:18:57 rillig Exp $        */
+/*     $NetBSD: main.c,v 1.549 2021/12/27 18:26:22 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -111,7 +111,7 @@
 #include "trace.h"
 
 /*     "@(#)main.c     8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: main.c,v 1.548 2021/12/27 17:18:57 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.549 2021/12/27 18:26:22 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
            "The Regents of the University of California.  "
@@ -546,7 +546,7 @@
                Global_Append(MAKEFLAGS, "-n");
                break;
        case 'q':
-               opts.queryFlag = true;
+               opts.query = true;
                /* Kind of nonsensical, wot? */
                Global_Append(MAKEFLAGS, "-q");
                break;
@@ -555,11 +555,11 @@
                Global_Append(MAKEFLAGS, "-r");
                break;
        case 's':
-               opts.beSilent = true;
+               opts.silent = true;
                Global_Append(MAKEFLAGS, "-s");
                break;
        case 't':
-               opts.touchFlag = true;
+               opts.touch = true;
                Global_Append(MAKEFLAGS, "-t");
                break;
        case 'w':
@@ -930,7 +930,7 @@
                 * (to prevent the .BEGIN from being executed should
                 * it exist).
                 */
-               if (!opts.queryFlag) {
+               if (!opts.query) {
                        Job_Init();
                        jobsRunning = true;
                }
@@ -1129,10 +1129,10 @@
        opts.keepgoing = false;         /* Stop on error */
        opts.noRecursiveExecute = false; /* Execute all .MAKE targets */
        opts.noExecute = false;         /* Execute all commands */
-       opts.queryFlag = false;
+       opts.query = false;
        opts.noBuiltins = false;        /* Read the built-in rules */
-       opts.beSilent = false;          /* Print commands as executed */
-       opts.touchFlag = false;
+       opts.silent = false;            /* Print commands as executed */
+       opts.touch = false;
        opts.printVars = PVM_NONE;
        Lst_Init(&opts.variables);
        opts.parseWarnFatal = false;
diff -r cb671014428d -r 87d2f4ee96c2 usr.bin/make/make.c
--- a/usr.bin/make/make.c       Mon Dec 27 17:18:57 2021 +0000
+++ b/usr.bin/make/make.c       Mon Dec 27 18:26:22 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: make.c,v 1.249 2021/12/15 12:58:01 rillig Exp $        */
+/*     $NetBSD: make.c,v 1.250 2021/12/27 18:26:22 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -104,7 +104,7 @@
 #include "job.h"
 
 /*     "@(#)make.c     8.1 (Berkeley) 6/6/93"  */
-MAKE_RCSID("$NetBSD: make.c,v 1.249 2021/12/15 12:58:01 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.250 2021/12/27 18:26:22 rillig Exp $");
 
 /* Sequence # to detect recursion. */
 static unsigned int checked_seqno = 1;
@@ -1073,7 +1073,7 @@
                gn->made = BEINGMADE;
                if (GNode_IsOODate(gn)) {
                        DEBUG0(MAKE, "out-of-date\n");
-                       if (opts.queryFlag)
+                       if (opts.query)
                                return true;
                        GNode_SetLocalVars(gn);
                        Job_Make(gn);
@@ -1441,7 +1441,7 @@
                Targ_PrintGraph(1);
        }
 
-       if (opts.queryFlag) {
+       if (opts.query) {
                /*
                 * We wouldn't do any work unless we could start some jobs
                 * in the next loop... (we won't actually start any, of
diff -r cb671014428d -r 87d2f4ee96c2 usr.bin/make/make.h
--- a/usr.bin/make/make.h       Mon Dec 27 17:18:57 2021 +0000
+++ b/usr.bin/make/make.h       Mon Dec 27 18:26:22 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: make.h,v 1.278 2021/12/15 13:03:33 rillig Exp $        */
+/*     $NetBSD: make.h,v 1.279 2021/12/27 18:26:22 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -718,19 +718,19 @@
         * -q: if true, do not really make anything, just see if the targets
         * are out-of-date
         */
-       bool queryFlag;
+       bool query;
 
        /* -r: raw mode, do not load the builtin rules. */
        bool noBuiltins;
 
        /* -s: don't echo the shell commands before executing them */
-       bool beSilent;
+       bool silent;
 
        /*
         * -t: touch the targets if they are out-of-date, but don't actually
         * make them
         */
-       bool touchFlag;
+       bool touch;
 
        /* -[Vv]: print expanded or unexpanded selected variables */
        PrintVarsMode printVars;
diff -r cb671014428d -r 87d2f4ee96c2 usr.bin/make/parse.c
--- a/usr.bin/make/parse.c      Mon Dec 27 17:18:57 2021 +0000
+++ b/usr.bin/make/parse.c      Mon Dec 27 18:26:22 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parse.c,v 1.583 2021/12/15 12:58:01 rillig Exp $       */
+/*     $NetBSD: parse.c,v 1.584 2021/12/27 18:26:22 rillig Exp $       */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
 #include "pathnames.h"
 
 /*     "@(#)parse.c    8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.583 2021/12/15 12:58:01 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.584 2021/12/27 18:26:22 rillig Exp $");
 
 /* types and constants */
 
@@ -1315,7 +1315,7 @@
                opts.ignoreErrors = true;
                break;
        case SP_SILENT:
-               opts.beSilent = true;
+               opts.silent = true;
                break;
        case SP_PATH:
                ClearPaths(paths);



Home | Main Index | Thread Index | Old Index