Module Name:    src
Committed By:   rillig
Date:           Sun Oct 18 17:19:54 UTC 2020

Modified Files:
        src/usr.bin/make: cond.c dir.c for.c lst.h make.h nonints.h parse.c
            suff.c trace.h var.c

Log Message:
make(1): add tags to enum types

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


To generate a diff of this commit:
cvs rdiff -u -r1.163 -r1.164 src/usr.bin/make/cond.c
cvs rdiff -u -r1.169 -r1.170 src/usr.bin/make/dir.c
cvs rdiff -u -r1.93 -r1.94 src/usr.bin/make/for.c
cvs rdiff -u -r1.71 -r1.72 src/usr.bin/make/lst.h
cvs rdiff -u -r1.158 -r1.159 src/usr.bin/make/make.h
cvs rdiff -u -r1.142 -r1.143 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.385 -r1.386 src/usr.bin/make/parse.c
cvs rdiff -u -r1.188 -r1.189 src/usr.bin/make/suff.c
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/trace.h
cvs rdiff -u -r1.577 -r1.578 src/usr.bin/make/var.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/cond.c
diff -u src/usr.bin/make/cond.c:1.163 src/usr.bin/make/cond.c:1.164
--- src/usr.bin/make/cond.c:1.163	Sat Oct 17 17:47:14 2020
+++ src/usr.bin/make/cond.c	Sun Oct 18 17:19:54 2020
@@ -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 @@ MAKE_RCSID("$NetBSD: cond.c,v 1.163 2020
  * 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;

Index: src/usr.bin/make/dir.c
diff -u src/usr.bin/make/dir.c:1.169 src/usr.bin/make/dir.c:1.170
--- src/usr.bin/make/dir.c:1.169	Sun Oct 18 14:36:09 2020
+++ src/usr.bin/make/dir.c	Sun Oct 18 17:19:54 2020
@@ -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 @@ struct cache_st {
 };
 
 /* 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;

Index: src/usr.bin/make/for.c
diff -u src/usr.bin/make/for.c:1.93 src/usr.bin/make/for.c:1.94
--- src/usr.bin/make/for.c:1.93	Mon Oct  5 20:21:30 2020
+++ src/usr.bin/make/for.c	Sun Oct 18 17:19:54 2020
@@ -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

Index: src/usr.bin/make/lst.h
diff -u src/usr.bin/make/lst.h:1.71 src/usr.bin/make/lst.h:1.72
--- src/usr.bin/make/lst.h:1.71	Sun Oct 18 13:02:10 2020
+++ src/usr.bin/make/lst.h	Sun Oct 18 17:19:54 2020
@@ -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 @@ struct ListNode {
     };
 };
 
-typedef enum {
+typedef enum ListForEachUntilWhere {
     Head, Middle, Tail, Unknown
 } ListForEachUntilWhere;
 

Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.158 src/usr.bin/make/make.h:1.159
--- src/usr.bin/make/make.h:1.158	Sun Oct 18 12:36:43 2020
+++ src/usr.bin/make/make.h	Sun Oct 18 17:19:54 2020
@@ -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 @@ typedef unsigned char Boolean;
 #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 @@ typedef enum  {
  * 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 @@ typedef enum {
     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 @@ typedef struct GNode {
 /*
  * 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 */

Index: src/usr.bin/make/nonints.h
diff -u src/usr.bin/make/nonints.h:1.142 src/usr.bin/make/nonints.h:1.143
--- src/usr.bin/make/nonints.h:1.142	Sun Oct 18 07:46:04 2020
+++ src/usr.bin/make/nonints.h	Sun Oct 18 17:19:54 2020
@@ -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 Targ_Propagate(void);
 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 @@ typedef enum {
     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 @@ typedef enum {
  * 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,

Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.385 src/usr.bin/make/parse.c:1.386
--- src/usr.bin/make/parse.c:1.385	Sun Oct 18 13:02:10 2020
+++ src/usr.bin/make/parse.c	Sun Oct 18 17:19:54 2020
@@ -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 @@ typedef struct IFile {
 /*
  * Tokens for target attributes
  */
-typedef enum {
+typedef enum ParseSpecial {
     Begin,		/* .BEGIN */
     Default,		/* .DEFAULT */
     DeleteOnError,	/* .DELETE_ON_ERROR */

Index: src/usr.bin/make/suff.c
diff -u src/usr.bin/make/suff.c:1.188 src/usr.bin/make/suff.c:1.189
--- src/usr.bin/make/suff.c:1.188	Sun Oct 18 17:12:43 2020
+++ src/usr.bin/make/suff.c	Sun Oct 18 17:19:54 2020
@@ -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 GNodeList *transforms;	/* List of
 
 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 */

Index: src/usr.bin/make/trace.h
diff -u src/usr.bin/make/trace.h:1.3 src/usr.bin/make/trace.h:1.4
--- src/usr.bin/make/trace.h:1.3	Mon Apr 28 20:24:14 2008
+++ src/usr.bin/make/trace.h	Sun Oct 18 17:19:54 2020
@@ -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,

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.577 src/usr.bin/make/var.c:1.578
--- src/usr.bin/make/var.c:1.577	Sun Oct 18 12:47:43 2020
+++ src/usr.bin/make/var.c	Sun Oct 18 17:19:54 2020
@@ -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_INTERNAL;	/* variabl
 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 @@ typedef struct Var {
 /*
  * 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 @@ typedef enum {
 
 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 @@ typedef enum {
 } VarExportFlags;
 
 /* Flags for pattern matching in the :S and :C modifiers */
-typedef enum {
+typedef enum VarPatternFlags {
     VARP_SUB_GLOBAL	= 0x01,	/* Apply substitution globally */
     VARP_SUB_ONE	= 0x02,	/* Apply substitution to one word */
     VARP_ANCHOR_START	= 0x04,	/* Match at start of word */
@@ -1820,7 +1820,7 @@ ApplyModifiersState_Define(ApplyModifier
 	st->exprFlags |= VEF_DEF;
 }
 
-typedef enum {
+typedef enum ApplyModifierResult {
     AMR_OK,			/* Continue parsing */
     AMR_UNKNOWN,		/* Not a match, try other modifiers as well */
     AMR_BAD,			/* Error out with "Bad modifier" message */

Reply via email to