Module Name:    src
Committed By:   rillig
Date:           Mon Oct  5 15:14:25 UTC 2020

Modified Files:
        src/usr.bin/make: make.h

Log Message:
make(1): replace GNode macros with inline functions

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


To generate a diff of this commit:
cvs rdiff -u -r1.152 -r1.153 src/usr.bin/make/make.h

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/make.h
diff -u src/usr.bin/make/make.h:1.152 src/usr.bin/make/make.h:1.153
--- src/usr.bin/make/make.h:1.152	Sat Oct  3 21:19:54 2020
+++ src/usr.bin/make/make.h	Mon Oct  5 15:14:24 2020
@@ -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 @@ typedef enum {
     /* 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 @@ typedef struct GNode {
     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 mkTempFile(const char *, char **);
 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 {			\

Reply via email to