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): add tags to enum types



details:   https://anonhg.NetBSD.org/src/rev/aad8bc933d92
branches:  trunk
changeset: 941092:aad8bc933d92
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Oct 18 17:19:54 2020 +0000

description:
make(1): add tags to enum types

This allows IDEs to offer better type information than "anonymous enum".

diffstat:

 usr.bin/make/cond.c    |   6 +++---
 usr.bin/make/dir.c     |   6 +++---
 usr.bin/make/for.c     |   6 +++---
 usr.bin/make/lst.h     |   4 ++--
 usr.bin/make/make.h    |  10 +++++-----
 usr.bin/make/nonints.h |   8 ++++----
 usr.bin/make/parse.c   |   6 +++---
 usr.bin/make/suff.c    |   6 +++---
 usr.bin/make/trace.h   |   4 ++--
 usr.bin/make/var.c     |  16 ++++++++--------
 10 files changed, 36 insertions(+), 36 deletions(-)

diffs (truncated from 316 to 300 lines):

diff -r 8ff9cc710083 -r aad8bc933d92 usr.bin/make/cond.c
--- a/usr.bin/make/cond.c       Sun Oct 18 17:12:43 2020 +0000
+++ b/usr.bin/make/cond.c       Sun Oct 18 17:19:54 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cond.c,v 1.163 2020/10/17 17:47:14 rillig Exp $        */
+/*     $NetBSD: cond.c,v 1.164 2020/10/18 17:19:54 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -93,7 +93,7 @@
 #include "dir.h"
 
 /*     "@(#)cond.c     8.2 (Berkeley) 1/2/94"  */
-MAKE_RCSID("$NetBSD: cond.c,v 1.163 2020/10/17 17:47:14 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.164 2020/10/18 17:19:54 rillig Exp $");
 
 /*
  * The parsing of conditional expressions is based on this grammar:
@@ -133,7 +133,7 @@
  * All non-terminal functions (CondParser_Expr, CondParser_Factor and
  * CondParser_Term) return either TOK_FALSE, TOK_TRUE, or TOK_ERROR on error.
  */
-typedef enum {
+typedef enum Token {
     TOK_FALSE = 0, TOK_TRUE = 1, TOK_AND, TOK_OR, TOK_NOT,
     TOK_LPAREN, TOK_RPAREN, TOK_EOF, TOK_NONE, TOK_ERROR
 } Token;
diff -r 8ff9cc710083 -r aad8bc933d92 usr.bin/make/dir.c
--- a/usr.bin/make/dir.c        Sun Oct 18 17:12:43 2020 +0000
+++ b/usr.bin/make/dir.c        Sun Oct 18 17:19:54 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dir.c,v 1.169 2020/10/18 14:36:09 rillig Exp $ */
+/*     $NetBSD: dir.c,v 1.170 2020/10/18 17:19:54 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -135,7 +135,7 @@
 #include "job.h"
 
 /*     "@(#)dir.c      8.2 (Berkeley) 1/2/94"  */
-MAKE_RCSID("$NetBSD: dir.c,v 1.169 2020/10/18 14:36:09 rillig Exp $");
+MAKE_RCSID("$NetBSD: dir.c,v 1.170 2020/10/18 17:19:54 rillig Exp $");
 
 #define DIR_DEBUG0(text) DEBUG0(DIR, text)
 #define DIR_DEBUG1(fmt, arg1) DEBUG1(DIR, fmt, arg1)
@@ -313,7 +313,7 @@
 };
 
 /* minimize changes below */
-typedef enum {
+typedef enum CachedStatsFlags {
     CST_LSTAT = 0x01,          /* call lstat(2) instead of stat(2) */
     CST_UPDATE = 0x02          /* ignore existing cached entry */
 } CachedStatsFlags;
diff -r 8ff9cc710083 -r aad8bc933d92 usr.bin/make/for.c
--- a/usr.bin/make/for.c        Sun Oct 18 17:12:43 2020 +0000
+++ b/usr.bin/make/for.c        Sun Oct 18 17:19:54 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: for.c,v 1.93 2020/10/05 20:21:30 rillig Exp $  */
+/*     $NetBSD: for.c,v 1.94 2020/10/18 17:19:54 rillig Exp $  */
 
 /*
  * Copyright (c) 1992, The Regents of the University of California.
@@ -61,9 +61,9 @@
 #include    "strlist.h"
 
 /*     "@(#)for.c      8.1 (Berkeley) 6/6/93"  */
-MAKE_RCSID("$NetBSD: for.c,v 1.93 2020/10/05 20:21:30 rillig Exp $");
+MAKE_RCSID("$NetBSD: for.c,v 1.94 2020/10/18 17:19:54 rillig Exp $");
 
-typedef enum {
+typedef enum ForEscapes {
     FOR_SUB_ESCAPE_CHAR = 0x0001,
     FOR_SUB_ESCAPE_BRACE = 0x0002,
     FOR_SUB_ESCAPE_PAREN = 0x0004
diff -r 8ff9cc710083 -r aad8bc933d92 usr.bin/make/lst.h
--- a/usr.bin/make/lst.h        Sun Oct 18 17:12:43 2020 +0000
+++ b/usr.bin/make/lst.h        Sun Oct 18 17:19:54 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lst.h,v 1.71 2020/10/18 13:02:10 rillig Exp $  */
+/*     $NetBSD: lst.h,v 1.72 2020/10/18 17:19:54 rillig Exp $  */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -101,7 +101,7 @@
     };
 };
 
-typedef enum {
+typedef enum ListForEachUntilWhere {
     Head, Middle, Tail, Unknown
 } ListForEachUntilWhere;
 
diff -r 8ff9cc710083 -r aad8bc933d92 usr.bin/make/make.h
--- a/usr.bin/make/make.h       Sun Oct 18 17:12:43 2020 +0000
+++ b/usr.bin/make/make.h       Sun Oct 18 17:19:54 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: make.h,v 1.158 2020/10/18 12:36:43 rillig Exp $        */
+/*     $NetBSD: make.h,v 1.159 2020/10/18 17:19:54 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -145,7 +145,7 @@
 #define TRUE ((unsigned char)0xFF)
 #define FALSE ((unsigned char)0x00)
 #elif defined(USE_ENUM_BOOLEAN)
-typedef enum { FALSE, TRUE } Boolean;
+typedef enum Boolean { FALSE, TRUE } Boolean;
 #else
 typedef int Boolean;
 #endif
@@ -185,7 +185,7 @@
  * of each node. Any node that has a 'type' field which satisfies the OP_NOP
  * function was never never on the left-hand side of an operator, though it
  * may have been on the right-hand side... */
-typedef enum {
+typedef enum GNodeType {
     /* Execution of commands depends on children (:) */
     OP_DEPENDS         = 1 << 0,
     /* Always execute commands (!) */
@@ -264,7 +264,7 @@
     OP_NOTARGET                = OP_NOTMAIN | OP_USE | OP_EXEC | OP_TRANSFORM
 } GNodeType;
 
-typedef enum {
+typedef enum GNodeFlags {
     REMAKE     = 0x0001,       /* this target needs to be (re)made */
     CHILDMADE  = 0x0002,       /* children of this target were made */
     FORCE      = 0x0004,       /* children don't exist, and we pretend made */
@@ -372,7 +372,7 @@
 /*
  * Values returned by Cond_EvalLine and Cond_EvalCondition.
  */
-typedef enum {
+typedef enum CondEvalResult {
     COND_PARSE,                        /* Parse the next lines */
     COND_SKIP,                 /* Skip the next lines */
     COND_INVALID               /* Not a conditional statement */
diff -r 8ff9cc710083 -r aad8bc933d92 usr.bin/make/nonints.h
--- a/usr.bin/make/nonints.h    Sun Oct 18 17:12:43 2020 +0000
+++ b/usr.bin/make/nonints.h    Sun Oct 18 17:19:54 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nonints.h,v 1.142 2020/10/18 07:46:04 rillig Exp $     */
+/*     $NetBSD: nonints.h,v 1.143 2020/10/18 17:19:54 rillig Exp $     */
 
 /*-
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -214,7 +214,7 @@
 void Var_Init(void);
 void Var_End(void);
 
-typedef enum {
+typedef enum VarEvalFlags {
     VARE_NONE          = 0,
     /* Treat undefined variables as errors. */
     VARE_UNDEFERR      = 0x01,
@@ -225,7 +225,7 @@
     VARE_ASSIGN                = 0x04
 } VarEvalFlags;
 
-typedef enum {
+typedef enum VarSet_Flags {
     VAR_NO_EXPORT      = 0x01, /* do not export */
     /* Make the variable read-only. No further modification is possible,
      * except for another call to Var_Set with the same flag. */
@@ -241,7 +241,7 @@
  * and then migrate away from the SILENT constants, step by step,
  * as these are not suited for reliable, consistent error handling
  * and reporting. */
-typedef enum {
+typedef enum VarParseResult {
 
     /* Both parsing and evaluation succeeded. */
     VPR_OK             = 0x0000,
diff -r 8ff9cc710083 -r aad8bc933d92 usr.bin/make/parse.c
--- a/usr.bin/make/parse.c      Sun Oct 18 17:12:43 2020 +0000
+++ b/usr.bin/make/parse.c      Sun Oct 18 17:19:54 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parse.c,v 1.385 2020/10/18 13:02:10 rillig Exp $       */
+/*     $NetBSD: parse.c,v 1.386 2020/10/18 17:19:54 rillig Exp $       */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -131,7 +131,7 @@
 #include "pathnames.h"
 
 /*     "@(#)parse.c    8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.385 2020/10/18 13:02:10 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.386 2020/10/18 17:19:54 rillig Exp $");
 
 /* types and constants */
 
@@ -156,7 +156,7 @@
 /*
  * Tokens for target attributes
  */
-typedef enum {
+typedef enum ParseSpecial {
     Begin,             /* .BEGIN */
     Default,           /* .DEFAULT */
     DeleteOnError,     /* .DELETE_ON_ERROR */
diff -r 8ff9cc710083 -r aad8bc933d92 usr.bin/make/suff.c
--- a/usr.bin/make/suff.c       Sun Oct 18 17:12:43 2020 +0000
+++ b/usr.bin/make/suff.c       Sun Oct 18 17:19:54 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: suff.c,v 1.188 2020/10/18 17:12:43 rillig Exp $        */
+/*     $NetBSD: suff.c,v 1.189 2020/10/18 17:19:54 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -129,7 +129,7 @@
 #include "dir.h"
 
 /*     "@(#)suff.c     8.4 (Berkeley) 3/21/94" */
-MAKE_RCSID("$NetBSD: suff.c,v 1.188 2020/10/18 17:12:43 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.189 2020/10/18 17:19:54 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -151,7 +151,7 @@
 
 static int        sNum = 0;    /* Counter for assigning suffix numbers */
 
-typedef enum {
+typedef enum SuffFlags {
     SUFF_INCLUDE       = 0x01, /* One which is #include'd */
     SUFF_LIBRARY       = 0x02, /* One which contains a library */
     SUFF_NULL          = 0x04  /* The empty suffix */
diff -r 8ff9cc710083 -r aad8bc933d92 usr.bin/make/trace.h
--- a/usr.bin/make/trace.h      Sun Oct 18 17:12:43 2020 +0000
+++ b/usr.bin/make/trace.h      Sun Oct 18 17:19:54 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trace.h,v 1.3 2008/04/28 20:24:14 martin Exp $ */
+/*     $NetBSD: trace.h,v 1.4 2020/10/18 17:19:54 rillig Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  *     Definitions pertaining to the tracing of jobs in parallel mode.
  */
 
-typedef enum {
+typedef enum TrEvent {
        MAKESTART,
        MAKEEND,
        MAKEERROR,
diff -r 8ff9cc710083 -r aad8bc933d92 usr.bin/make/var.c
--- a/usr.bin/make/var.c        Sun Oct 18 17:12:43 2020 +0000
+++ b/usr.bin/make/var.c        Sun Oct 18 17:19:54 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.577 2020/10/18 12:47:43 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.578 2020/10/18 17:19:54 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -121,7 +121,7 @@
 #include    "metachar.h"
 
 /*     "@(#)var.c      8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.577 2020/10/18 12:47:43 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.578 2020/10/18 17:19:54 rillig Exp $");
 
 #define VAR_DEBUG1(fmt, arg1) DEBUG1(VAR, fmt, arg1)
 #define VAR_DEBUG2(fmt, arg1, arg2) DEBUG2(VAR, fmt, arg1, arg2)
@@ -182,13 +182,13 @@
 GNode          *VAR_GLOBAL;    /* variables from the makefile */
 GNode          *VAR_CMD;       /* variables defined on the command-line */
 
-typedef enum {
+typedef enum VarFindFlags {
     FIND_CMD           = 0x01, /* look in VAR_CMD when searching */
     FIND_GLOBAL                = 0x02, /* look in VAR_GLOBAL as well */
     FIND_ENV           = 0x04  /* look in the environment also */
 } VarFindFlags;
 
-typedef enum {
+typedef enum VarFlags {
     /* The variable's value is currently being used by Var_Parse or Var_Subst.
      * This marker is used to avoid endless recursion. */
     VAR_IN_USE = 0x01,
@@ -245,7 +245,7 @@
 /*
  * Exporting vars is expensive so skip it if we can
  */
-typedef enum {
+typedef enum VarExportedMode {
     VAR_EXPORTED_NONE,
     VAR_EXPORTED_YES,
     VAR_EXPORTED_ALL
@@ -253,7 +253,7 @@
 
 static VarExportedMode var_exportedVars = VAR_EXPORTED_NONE;
 
-typedef enum {
+typedef enum VarExportFlags {
     /*
      * We pass this to Var_Export when doing the initial export
      * or after updating an exported var.
@@ -266,7 +266,7 @@
 } VarExportFlags;



Home | Main Index | Thread Index | Old Index