From da5a66a335008f71600c56adc0964d7c8148655f Mon Sep 17 00:00:00 2001 From: rillig Date: Mon, 5 Oct 2020 15:14:24 +0000 Subject: [PATCH] make(1): replace GNode macros with inline functions Curiously, this affects the size of the generated code: it gets smaller than before. --- usr.bin/make/make.h | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/usr.bin/make/make.h b/usr.bin/make/make.h index 738dcbd0fb64..f2b774676ffd 100644 --- a/usr.bin/make/make.h +++ b/usr.bin/make/make.h @@ -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 { \