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): convert Suff.flags from #define to enum



details:   https://anonhg.NetBSD.org/src/rev/cf05f67548d5
branches:  trunk
changeset: 1012837:cf05f67548d5
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Aug 11 18:44:52 2020 +0000

description:
make(1): convert Suff.flags from #define to enum

This increases debugging support since the debugger can now display
symbolic names instead of an integer bit mask.

diffstat:

 usr.bin/make/make.h |   4 ++--
 usr.bin/make/suff.c |  19 +++++++++++--------
 2 files changed, 13 insertions(+), 10 deletions(-)

diffs (69 lines):

diff -r 6bf3f38a0603 -r cf05f67548d5 usr.bin/make/make.h
--- a/usr.bin/make/make.h       Tue Aug 11 18:41:46 2020 +0000
+++ b/usr.bin/make/make.h       Tue Aug 11 18:44:52 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: make.h,v 1.114 2020/08/10 19:30:30 rillig Exp $        */
+/*     $NetBSD: make.h,v 1.115 2020/08/11 18:44:52 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -224,7 +224,7 @@
     Hash_Table      context;   /* The local variables */
     Lst             commands;          /* Creation commands */
 
-    struct _Suff    *suffix;   /* Suffix for the node (determined by
+    struct Suff     *suffix;   /* Suffix for the node (determined by
                                 * Suff_FindDeps and opaque to everyone
                                 * but the Suff module) */
     const char     *fname;     /* filename where the GNode got defined */
diff -r 6bf3f38a0603 -r cf05f67548d5 usr.bin/make/suff.c
--- a/usr.bin/make/suff.c       Tue Aug 11 18:41:46 2020 +0000
+++ b/usr.bin/make/suff.c       Tue Aug 11 18:44:52 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: suff.c,v 1.95 2020/08/10 19:53:19 rillig Exp $ */
+/*     $NetBSD: suff.c,v 1.96 2020/08/11 18:44:52 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: suff.c,v 1.95 2020/08/10 19:53:19 rillig Exp $";
+static char rcsid[] = "$NetBSD: suff.c,v 1.96 2020/08/11 18:44:52 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)suff.c     8.4 (Berkeley) 3/21/94";
 #else
-__RCSID("$NetBSD: suff.c,v 1.95 2020/08/10 19:53:19 rillig Exp $");
+__RCSID("$NetBSD: suff.c,v 1.96 2020/08/11 18:44:52 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -150,16 +150,19 @@
 
 static int        sNum = 0;    /* Counter for assigning suffix numbers */
 
+typedef enum {
+    SUFF_INCLUDE       = 0x01, /* One which is #include'd */
+    SUFF_LIBRARY       = 0x02, /* One which contains a library */
+    SUFF_NULL          = 0x04  /* The empty suffix */
+} SuffFlags;
+
 /*
  * Structure describing an individual suffix.
  */
-typedef struct _Suff {
+typedef struct Suff {
     char         *name;                /* The suffix itself */
     int                 nameLen;       /* Length of the suffix */
-    short       flags;         /* Type of suffix */
-#define SUFF_INCLUDE     0x01      /* One which is #include'd */
-#define SUFF_LIBRARY     0x02      /* One which contains a library */
-#define SUFF_NULL        0x04      /* The empty suffix */
+    SuffFlags   flags;         /* Type of suffix */
     Lst         searchPath;    /* The path along which files of this suffix
                                 * may be found */
     int          sNum;         /* The suffix number */



Home | Main Index | Thread Index | Old Index