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): replace GNode macros with inline funct...



details:   https://anonhg.NetBSD.org/src/rev/4a094fcee37d
branches:  trunk
changeset: 976852:4a094fcee37d
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Oct 05 15:14:24 2020 +0000

description:
make(1): replace GNode macros with inline functions

Curiously, this affects the size of the generated code: it gets smaller
than before.

diffstat:

 usr.bin/make/make.h |  31 ++++++++++++++++++++-----------
 1 files changed, 20 insertions(+), 11 deletions(-)

diffs (59 lines):

diff -r f2b2bfd73e1c -r 4a094fcee37d usr.bin/make/make.h
--- a/usr.bin/make/make.h       Mon Oct 05 15:11:37 2020 +0000
+++ b/usr.bin/make/make.h       Mon Oct 05 15:14:24 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: make.h,v 1.152 2020/10/03 21:19:54 rillig Exp $        */
+/*     $NetBSD: make.h,v 1.153 2020/10/05 15:14:24 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -259,7 +259,9 @@
     /* Already processed by Suff_FindDeps */
     OP_DEPS_FOUND      = 1 << 25,
     /* Node found while expanding .ALLSRC */
-    OP_MARK            = 1 << 24
+    OP_MARK            = 1 << 24,
+
+    OP_NOTARGET                = OP_NOTMAIN | OP_USE | OP_EXEC | OP_TRANSFORM
 } GNodeType;
 
 typedef enum {
@@ -358,15 +360,6 @@
     int lineno;
 } GNode;
 
-#define NoExecute(gn) ((gn->type & OP_MAKE) ? noRecursiveExecute : noExecute)
-/*
- * OP_NOP will return TRUE if the node with the given type was not the
- * object of a dependency operator
- */
-#define OP_NOP(t)      (((t) & OP_OPMASK) == 0x00000000)
-
-#define OP_NOTARGET (OP_NOTMAIN|OP_USE|OP_EXEC|OP_TRANSFORM)
-
 /*
  * Error levels for parsing. PARSE_FATAL means the process cannot continue
  * once the makefile has been parsed. PARSE_WARNING means it can. Passed
@@ -568,6 +561,22 @@
 int str2Lst_Append(StringList *, char *, const char *);
 void GNode_FprintDetails(FILE *, const char *, const GNode *, const char *);
 
+static Boolean MAKE_ATTR_UNUSED
+NoExecute(GNode *gn)
+{
+    return (gn->type & OP_MAKE) ? noRecursiveExecute : noExecute;
+}
+
+/*
+ * See if the node with the given type was not the object of a dependency
+ * operator.
+ */
+static Boolean MAKE_ATTR_UNUSED
+OP_NOP(GNodeType t)
+{
+    return !(t & OP_OPMASK);
+}
+
 #ifdef __GNUC__
 #define UNCONST(ptr)   ({              \
     union __unconst {                  \



Home | Main Index | Thread Index | Old Index