make(1): make some GNode functions const

This commit is contained in:
rillig 2020-11-16 21:48:18 +00:00
parent e99bba9c48
commit 73f094ffae
2 changed files with 10 additions and 9 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: nonints.h,v 1.161 2020/11/16 21:39:22 rillig Exp $ */
/* $NetBSD: nonints.h,v 1.162 2020/11/16 21:48:18 rillig Exp $ */
/*-
* Copyright (c) 1988, 1989, 1990, 1993
@ -197,9 +197,9 @@ GNode *Targ_GetNode(const char *);
GNode *Targ_NewInternalNode(const char *);
GNode *Targ_GetEndNode(void);
GNodeList *Targ_FindList(StringList *);
Boolean Targ_Ignore(GNode *);
Boolean Targ_Silent(GNode *);
Boolean Targ_Precious(GNode *);
Boolean Targ_Ignore(const GNode *);
Boolean Targ_Silent(const GNode *);
Boolean Targ_Precious(const GNode *);
void Targ_SetMain(GNode *);
void Targ_PrintCmds(GNode *);
void Targ_PrintNode(GNode *, int);

View File

@ -1,4 +1,4 @@
/* $NetBSD: targ.c,v 1.130 2020/11/16 21:44:29 rillig Exp $ */
/* $NetBSD: targ.c,v 1.131 2020/11/16 21:48:18 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -121,7 +121,7 @@
#include "dir.h"
/* "@(#)targ.c 8.2 (Berkeley) 3/19/94" */
MAKE_RCSID("$NetBSD: targ.c,v 1.130 2020/11/16 21:44:29 rillig Exp $");
MAKE_RCSID("$NetBSD: targ.c,v 1.131 2020/11/16 21:48:18 rillig Exp $");
static GNodeList *allTargets; /* the list of all targets found so far */
static HashTable targets; /* a hash table of same */
@ -304,22 +304,23 @@ Targ_FindList(StringList *names)
/* Return true if should ignore errors when creating gn. */
Boolean
Targ_Ignore(GNode *gn)
Targ_Ignore(const GNode *gn)
{
return opts.ignoreErrors || gn->type & OP_IGNORE;
}
/* Return true if be silent when creating gn. */
Boolean
Targ_Silent(GNode *gn)
Targ_Silent(const GNode *gn)
{
return opts.beSilent || gn->type & OP_SILENT;
}
/* See if the given target is precious. */
Boolean
Targ_Precious(GNode *gn)
Targ_Precious(const GNode *gn)
{
/* XXX: Why are '::' targets precious? */
return allPrecious || gn->type & (OP_PRECIOUS | OP_DOUBLEDEP);
}