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): define constants for enum zero-values



details:   https://anonhg.NetBSD.org/src/rev/488e7f7a611a
branches:  trunk
changeset: 978842:488e7f7a611a
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Dec 05 18:38:02 2020 +0000

description:
make(1): define constants for enum zero-values

diffstat:

 usr.bin/make/main.c  |   6 +++---
 usr.bin/make/make.h  |   3 ++-
 usr.bin/make/parse.c |  52 ++++++++++++++++++++++++++--------------------------
 usr.bin/make/suff.c  |   7 ++++---
 usr.bin/make/targ.c  |   8 ++++----
 usr.bin/make/var.c   |  19 +++++++++++--------
 6 files changed, 50 insertions(+), 45 deletions(-)

diffs (297 lines):

diff -r 0f5a3ea3a8f0 -r 488e7f7a611a usr.bin/make/main.c
--- a/usr.bin/make/main.c       Sat Dec 05 18:33:47 2020 +0000
+++ b/usr.bin/make/main.c       Sat Dec 05 18:38:02 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.491 2020/12/01 19:28:32 rillig Exp $        */
+/*     $NetBSD: main.c,v 1.492 2020/12/05 18:38:02 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.491 2020/12/01 19:28:32 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.492 2020/12/05 18:38:02 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
            "The Regents of the University of California.  "
@@ -1121,7 +1121,7 @@
 CmdOpts_Init(void)
 {
        opts.compatMake = FALSE;        /* No compat mode */
-       opts.debug = 0;                 /* No debug verbosity, please. */
+       opts.debug = DEBUG_NONE;        /* No debug verbosity, please. */
        /* opts.debug_file has been initialized earlier */
        opts.lint = FALSE;
        opts.debugVflag = FALSE;
diff -r 0f5a3ea3a8f0 -r 488e7f7a611a usr.bin/make/make.h
--- a/usr.bin/make/make.h       Sat Dec 05 18:33:47 2020 +0000
+++ b/usr.bin/make/make.h       Sat Dec 05 18:38:02 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: make.h,v 1.230 2020/11/29 09:27:40 rillig Exp $        */
+/*     $NetBSD: make.h,v 1.231 2020/12/05 18:38:02 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -322,6 +322,7 @@
 } GNodeType;
 
 typedef enum GNodeFlags {
+       GNF_NONE        = 0,
        /* this target needs to be (re)made */
        REMAKE          = 0x0001,
        /* children of this target were made */
diff -r 0f5a3ea3a8f0 -r 488e7f7a611a usr.bin/make/parse.c
--- a/usr.bin/make/parse.c      Sat Dec 05 18:33:47 2020 +0000
+++ b/usr.bin/make/parse.c      Sat Dec 05 18:38:02 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parse.c,v 1.465 2020/12/05 18:15:40 rillig Exp $       */
+/*     $NetBSD: parse.c,v 1.466 2020/12/05 18:38:02 rillig Exp $       */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -117,7 +117,7 @@
 #include "pathnames.h"
 
 /*     "@(#)parse.c    8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.465 2020/12/05 18:15:40 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.466 2020/12/05 18:38:02 rillig Exp $");
 
 /* types and constants */
 
@@ -299,50 +299,50 @@
     ParseSpecial  spec;                /* Type when used as a target */
     GNodeType    op;           /* Operator when used as a source */
 } parseKeywords[] = {
-    { ".BEGIN",                SP_BEGIN,       0 },
-    { ".DEFAULT",      SP_DEFAULT,     0 },
-    { ".DELETE_ON_ERROR", SP_DELETE_ON_ERROR, 0 },
-    { ".END",          SP_END,         0 },
-    { ".ERROR",                SP_ERROR,       0 },
+    { ".BEGIN",                SP_BEGIN,       OP_NONE },
+    { ".DEFAULT",      SP_DEFAULT,     OP_NONE },
+    { ".DELETE_ON_ERROR", SP_DELETE_ON_ERROR, OP_NONE },
+    { ".END",          SP_END,         OP_NONE },
+    { ".ERROR",                SP_ERROR,       OP_NONE },
     { ".EXEC",         SP_ATTRIBUTE,   OP_EXEC },
     { ".IGNORE",       SP_IGNORE,      OP_IGNORE },
-    { ".INCLUDES",     SP_INCLUDES,    0 },
-    { ".INTERRUPT",    SP_INTERRUPT,   0 },
+    { ".INCLUDES",     SP_INCLUDES,    OP_NONE },
+    { ".INTERRUPT",    SP_INTERRUPT,   OP_NONE },
     { ".INVISIBLE",    SP_ATTRIBUTE,   OP_INVISIBLE },
     { ".JOIN",         SP_ATTRIBUTE,   OP_JOIN },
-    { ".LIBS",         SP_LIBS,        0 },
+    { ".LIBS",         SP_LIBS,        OP_NONE },
     { ".MADE",         SP_ATTRIBUTE,   OP_MADE },
-    { ".MAIN",         SP_MAIN,        0 },
+    { ".MAIN",         SP_MAIN,        OP_NONE },
     { ".MAKE",         SP_ATTRIBUTE,   OP_MAKE },
-    { ".MAKEFLAGS",    SP_MFLAGS,      0 },
+    { ".MAKEFLAGS",    SP_MFLAGS,      OP_NONE },
     { ".META",         SP_META,        OP_META },
-    { ".MFLAGS",       SP_MFLAGS,      0 },
+    { ".MFLAGS",       SP_MFLAGS,      OP_NONE },
     { ".NOMETA",       SP_NOMETA,      OP_NOMETA },
     { ".NOMETA_CMP",   SP_NOMETA_CMP,  OP_NOMETA_CMP },
     { ".NOPATH",       SP_NOPATH,      OP_NOPATH },
     { ".NOTMAIN",      SP_ATTRIBUTE,   OP_NOTMAIN },
-    { ".NOTPARALLEL",  SP_NOTPARALLEL, 0 },
-    { ".NO_PARALLEL",  SP_NOTPARALLEL, 0 },
-    { ".NULL",         SP_NULL,        0 },
-    { ".OBJDIR",       SP_OBJDIR,      0 },
+    { ".NOTPARALLEL",  SP_NOTPARALLEL, OP_NONE },
+    { ".NO_PARALLEL",  SP_NOTPARALLEL, OP_NONE },
+    { ".NULL",         SP_NULL,        OP_NONE },
+    { ".OBJDIR",       SP_OBJDIR,      OP_NONE },
     { ".OPTIONAL",     SP_ATTRIBUTE,   OP_OPTIONAL },
-    { ".ORDER",                SP_ORDER,       0 },
-    { ".PARALLEL",     SP_PARALLEL,    0 },
-    { ".PATH",         SP_PATH,        0 },
+    { ".ORDER",                SP_ORDER,       OP_NONE },
+    { ".PARALLEL",     SP_PARALLEL,    OP_NONE },
+    { ".PATH",         SP_PATH,        OP_NONE },
     { ".PHONY",                SP_PHONY,       OP_PHONY },
 #ifdef POSIX
-    { ".POSIX",                SP_POSIX,       0 },
+    { ".POSIX",                SP_POSIX,       OP_NONE },
 #endif
     { ".PRECIOUS",     SP_PRECIOUS,    OP_PRECIOUS },
     { ".RECURSIVE",    SP_ATTRIBUTE,   OP_MAKE },
-    { ".SHELL",                SP_SHELL,       0 },
+    { ".SHELL",                SP_SHELL,       OP_NONE },
     { ".SILENT",       SP_SILENT,      OP_SILENT },
-    { ".SINGLESHELL",  SP_SINGLESHELL, 0 },
-    { ".STALE",                SP_STALE,       0 },
-    { ".SUFFIXES",     SP_SUFFIXES,    0 },
+    { ".SINGLESHELL",  SP_SINGLESHELL, OP_NONE },
+    { ".STALE",                SP_STALE,       OP_NONE },
+    { ".SUFFIXES",     SP_SUFFIXES,    OP_NONE },
     { ".USE",          SP_ATTRIBUTE,   OP_USE },
     { ".USEBEFORE",    SP_ATTRIBUTE,   OP_USEBEFORE },
-    { ".WAIT",         SP_WAIT,        0 },
+    { ".WAIT",         SP_WAIT,        OP_NONE },
 };
 
 /* file loader */
diff -r 0f5a3ea3a8f0 -r 488e7f7a611a usr.bin/make/suff.c
--- a/usr.bin/make/suff.c       Sat Dec 05 18:33:47 2020 +0000
+++ b/usr.bin/make/suff.c       Sat Dec 05 18:38:02 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: suff.c,v 1.325 2020/12/05 17:12:02 rillig Exp $        */
+/*     $NetBSD: suff.c,v 1.326 2020/12/05 18:38:02 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -114,7 +114,7 @@
 #include "dir.h"
 
 /*     "@(#)suff.c     8.4 (Berkeley) 3/21/94" */
-MAKE_RCSID("$NetBSD: suff.c,v 1.325 2020/12/05 17:12:02 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.326 2020/12/05 18:38:02 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -146,6 +146,7 @@
 static int sNum = 0;
 
 typedef enum SuffixFlags {
+       SUFF_NONE       = 0,
 
        /*
         * This suffix marks include files.  Their search path ends up in the
@@ -475,7 +476,7 @@
        Lst_Init(&suff->parents);
        Lst_Init(&suff->ref);
        suff->sNum = sNum++;
-       suff->flags = 0;
+       suff->flags = SUFF_NONE;
        suff->refCount = 1; /* XXX: why 1? It's not assigned anywhere yet. */
 
        return suff;
diff -r 0f5a3ea3a8f0 -r 488e7f7a611a usr.bin/make/targ.c
--- a/usr.bin/make/targ.c       Sat Dec 05 18:33:47 2020 +0000
+++ b/usr.bin/make/targ.c       Sat Dec 05 18:38:02 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: targ.c,v 1.151 2020/12/05 15:57:02 rillig Exp $        */
+/*     $NetBSD: targ.c,v 1.152 2020/12/05 18:38:02 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -119,7 +119,7 @@
 #include "dir.h"
 
 /*     "@(#)targ.c     8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: targ.c,v 1.151 2020/12/05 15:57:02 rillig Exp $");
+MAKE_RCSID("$NetBSD: targ.c,v 1.152 2020/12/05 18:38:02 rillig Exp $");
 
 /*
  * All target nodes that appeared on the left-hand side of one of the
@@ -192,8 +192,8 @@
        gn->name = bmake_strdup(name);
        gn->uname = NULL;
        gn->path = NULL;
-       gn->type = name[0] == '-' && name[1] == 'l' ? OP_LIB : 0;
-       gn->flags = 0;
+       gn->type = name[0] == '-' && name[1] == 'l' ? OP_LIB : OP_NONE;
+       gn->flags = GNF_NONE;
        gn->made = UNMADE;
        gn->unmade = 0;
        gn->mtime = 0;
diff -r 0f5a3ea3a8f0 -r 488e7f7a611a usr.bin/make/var.c
--- a/usr.bin/make/var.c        Sat Dec 05 18:33:47 2020 +0000
+++ b/usr.bin/make/var.c        Sat Dec 05 18:38:02 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.706 2020/12/05 18:15:40 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.707 2020/12/05 18:38:02 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -130,7 +130,7 @@
 #include "metachar.h"
 
 /*     "@(#)var.c      8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.706 2020/12/05 18:15:40 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.707 2020/12/05 18:38:02 rillig Exp $");
 
 #define VAR_DEBUG1(fmt, arg1) DEBUG1(VAR, fmt, arg1)
 #define VAR_DEBUG2(fmt, arg1, arg2) DEBUG2(VAR, fmt, arg1, arg2)
@@ -188,6 +188,7 @@
 GNode          *VAR_CMDLINE;   /* variables defined on the command-line */
 
 typedef enum VarFlags {
+       VAR_NONE        = 0,
 
        /*
         * The variable's value is currently being used by Var_Parse or
@@ -290,6 +291,7 @@
 
 /* Flags for pattern matching in the :S and :C modifiers */
 typedef enum VarPatternFlags {
+       VARP_NONE               = 0,
        /* Replace as often as possible ('g') */
        VARP_SUB_GLOBAL         = 1 << 0,
        /* Replace only once ('1') */
@@ -461,7 +463,7 @@
 {
        HashEntry *he = HashTable_CreateEntry(&ctxt->vars, name, NULL);
        Var *v = VarNew(he->key /* aliased */, NULL, val,
-           flags & VAR_SET_READONLY ? VAR_READONLY : 0);
+           flags & VAR_SET_READONLY ? VAR_READONLY : VAR_NONE);
        HashEntry_Set(he, v);
        if (!(ctxt->flags & INTERNAL)) {
                VAR_DEBUG3("%s:%s = %s\n", ctxt->name, name, val);
@@ -659,7 +661,7 @@
 
        if (isExport && strncmp(str, "-env", 4) == 0) {
                str += 4;
-               flags = 0;
+               flags = VAR_EXPORT_NORMAL;
        } else if (isExport && strncmp(str, "-literal", 8) == 0) {
                str += 8;
                flags = VAR_EXPORT_LITERAL;
@@ -1844,6 +1846,7 @@
  */
 
 typedef enum VarExprFlags {
+       VEF_NONE        = 0,
        /* The variable expression is based on an undefined variable. */
        VEF_UNDEF = 0x01,
        /*
@@ -2531,7 +2534,7 @@
 
        *pp += 2;
 
-       args.pflags = 0;
+       args.pflags = VARP_NONE;
        args.matched = FALSE;
 
        /*
@@ -2612,7 +2615,7 @@
                return AMR_CLEANUP;
        }
 
-       args.pflags = 0;
+       args.pflags = VARP_NONE;
        args.matched = FALSE;
        oneBigWord = st->oneBigWord;
        for (;; (*pp)++) {
@@ -3872,7 +3875,7 @@
                 * is still undefined, Var_Parse will return an empty string
                 * instead of the actually computed value.
                 */
-               v = VarNew(varname, varname, "", 0);
+               v = VarNew(varname, varname, "", VAR_NONE);
                *out_TRUE_exprFlags = VEF_UNDEF;
        } else
                free(varname);
@@ -3946,7 +3949,7 @@
        Var *v;
        char *value;
        char eflags_str[VarEvalFlags_ToStringSize];
-       VarExprFlags exprFlags = 0;
+       VarExprFlags exprFlags = VEF_NONE;
 
        VAR_DEBUG2("Var_Parse: %s with %s\n", start,
            Enum_FlagsToString(eflags_str, sizeof eflags_str, eflags,



Home | Main Index | Thread Index | Old Index