make(1): use consistent definition for MAKE_INLINE

This commit is contained in:
rillig 2020-11-10 00:32:12 +00:00
parent 443ce526fa
commit a40fe9f746
8 changed files with 43 additions and 41 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: buf.h,v 1.35 2020/11/07 14:11:58 rillig Exp $ */
/* $NetBSD: buf.h,v 1.36 2020/11/10 00:32:12 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@ -94,7 +94,7 @@ typedef struct Buffer {
void Buf_Expand_1(Buffer *);
/* Buf_AddByte adds a single byte to a buffer. */
static inline MAKE_ATTR_UNUSED void
MAKE_INLINE void
Buf_AddByte(Buffer *buf, char byte)
{
size_t old_len = buf->len++;
@ -106,13 +106,13 @@ Buf_AddByte(Buffer *buf, char byte)
end[1] = '\0';
}
static inline MAKE_ATTR_UNUSED size_t
MAKE_INLINE size_t
Buf_Len(const Buffer *buf)
{
return buf->len;
}
static inline MAKE_ATTR_UNUSED Boolean
MAKE_INLINE Boolean
Buf_EndsWith(const Buffer *buf, char ch)
{
return buf->len > 0 && buf->data[buf->len - 1] == ch;

View File

@ -1,4 +1,4 @@
/* $NetBSD: hash.h,v 1.31 2020/10/25 19:19:07 rillig Exp $ */
/* $NetBSD: hash.h,v 1.32 2020/11/10 00:32:12 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@ -103,13 +103,13 @@ typedef struct HashIter {
HashEntry *entry; /* Next entry to check in current bucket. */
} HashIter;
static inline MAKE_ATTR_UNUSED void *
MAKE_INLINE void *
HashEntry_Get(HashEntry *h)
{
return h->value;
}
static inline MAKE_ATTR_UNUSED void
MAKE_INLINE void
HashEntry_Set(HashEntry *h, void *datum)
{
h->value = datum;

View File

@ -1,4 +1,4 @@
/* $NetBSD: lst.h,v 1.84 2020/10/28 02:43:16 rillig Exp $ */
/* $NetBSD: lst.h,v 1.85 2020/11/10 00:32:12 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@ -118,7 +118,7 @@ void Lst_Destroy(List *, LstFreeProc);
/* Get information about a list */
static inline MAKE_ATTR_UNUSED Boolean
MAKE_INLINE Boolean
Lst_IsEmpty(List *list) { return list->first == NULL; }
/* Find the first node that contains the given datum, or NULL. */
@ -173,7 +173,7 @@ void Vector_Init(Vector *, size_t);
/* Return the pointer to the given item in the vector.
* The returned data is valid until the next modifying operation. */
static inline MAKE_ATTR_UNUSED void *
MAKE_INLINE void *
Vector_Get(Vector *v, size_t i)
{
unsigned char *items = v->items;

View File

@ -1,4 +1,4 @@
/* $NetBSD: make.h,v 1.204 2020/11/08 23:38:02 rillig Exp $ */
/* $NetBSD: make.h,v 1.205 2020/11/10 00:32:12 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -130,6 +130,8 @@
#define MAKE_ATTR_PRINTFLIKE(fmtarg, firstvararg) /* delete */
#endif
#define MAKE_INLINE static inline MAKE_ATTR_UNUSED
/*
* A boolean type is defined as an integer, not an enum, for historic reasons.
* The only allowed values are the constants TRUE and FALSE (1 and 0).
@ -657,31 +659,31 @@ void GNode_FprintDetails(FILE *, const char *, const GNode *, const char *);
Boolean GNode_ShouldExecute(GNode *gn);
/* See if the node was seen on the left-hand side of a dependency operator. */
static MAKE_ATTR_UNUSED Boolean
MAKE_INLINE Boolean
GNode_IsTarget(const GNode *gn)
{
return (gn->type & OP_OPMASK) != 0;
}
static MAKE_ATTR_UNUSED const char *
MAKE_INLINE const char *
GNode_Path(const GNode *gn)
{
return gn->path != NULL ? gn->path : gn->name;
}
static MAKE_ATTR_UNUSED const char *
MAKE_INLINE const char *
GNode_VarTarget(GNode *gn) { return Var_ValueDirect(TARGET, gn); }
static MAKE_ATTR_UNUSED const char *
MAKE_INLINE const char *
GNode_VarOodate(GNode *gn) { return Var_ValueDirect(OODATE, gn); }
static MAKE_ATTR_UNUSED const char *
MAKE_INLINE const char *
GNode_VarAllsrc(GNode *gn) { return Var_ValueDirect(ALLSRC, gn); }
static MAKE_ATTR_UNUSED const char *
MAKE_INLINE const char *
GNode_VarImpsrc(GNode *gn) { return Var_ValueDirect(IMPSRC, gn); }
static MAKE_ATTR_UNUSED const char *
MAKE_INLINE const char *
GNode_VarPrefix(GNode *gn) { return Var_ValueDirect(PREFIX, gn); }
static MAKE_ATTR_UNUSED const char *
MAKE_INLINE const char *
GNode_VarArchive(GNode *gn) { return Var_ValueDirect(ARCHIVE, gn); }
static MAKE_ATTR_UNUSED const char *
MAKE_INLINE const char *
GNode_VarMember(GNode *gn) { return Var_ValueDirect(MEMBER, gn); }
#ifdef __GNUC__
@ -710,43 +712,43 @@ GNode_VarMember(GNode *gn) { return Var_ValueDirect(MEMBER, gn); }
#define KILLPG(pid, sig) killpg((pid), (sig))
#endif
static inline MAKE_ATTR_UNUSED Boolean
MAKE_INLINE Boolean
ch_isalnum(char ch) { return isalnum((unsigned char)ch) != 0; }
static inline MAKE_ATTR_UNUSED Boolean
MAKE_INLINE Boolean
ch_isalpha(char ch) { return isalpha((unsigned char)ch) != 0; }
static inline MAKE_ATTR_UNUSED Boolean
MAKE_INLINE Boolean
ch_isdigit(char ch) { return isdigit((unsigned char)ch) != 0; }
static inline MAKE_ATTR_UNUSED Boolean
MAKE_INLINE Boolean
ch_isspace(char ch) { return isspace((unsigned char)ch) != 0; }
static inline MAKE_ATTR_UNUSED Boolean
MAKE_INLINE Boolean
ch_isupper(char ch) { return isupper((unsigned char)ch) != 0; }
static inline MAKE_ATTR_UNUSED char
MAKE_INLINE char
ch_tolower(char ch) { return (char)tolower((unsigned char)ch); }
static inline MAKE_ATTR_UNUSED char
MAKE_INLINE char
ch_toupper(char ch) { return (char)toupper((unsigned char)ch); }
static inline MAKE_ATTR_UNUSED void
MAKE_INLINE void
cpp_skip_whitespace(const char **pp)
{
while (ch_isspace(**pp))
(*pp)++;
}
static inline MAKE_ATTR_UNUSED void
MAKE_INLINE void
cpp_skip_hspace(const char **pp)
{
while (**pp == ' ' || **pp == '\t')
(*pp)++;
}
static inline MAKE_ATTR_UNUSED void
MAKE_INLINE void
pp_skip_whitespace(char **pp)
{
while (ch_isspace(**pp))
(*pp)++;
}
static inline MAKE_ATTR_UNUSED void
MAKE_INLINE void
pp_skip_hspace(char **pp)
{
while (**pp == ' ' || **pp == '\t')

View File

@ -1,4 +1,4 @@
/* $NetBSD: make_malloc.h,v 1.12 2020/10/19 23:43:55 rillig Exp $ */
/* $NetBSD: make_malloc.h,v 1.13 2020/11/10 00:32:12 rillig Exp $ */
/*-
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@ -46,7 +46,7 @@ char *bmake_strsedup(const char *, const char *);
*
* The case of a NULL pointer happens especially often after Var_Value,
* since only environment variables need to be freed, but not others. */
static inline MAKE_ATTR_UNUSED void
MAKE_INLINE void
bmake_free(void *p)
{
if (p != NULL)

View File

@ -1,4 +1,4 @@
/* $NetBSD: metachar.h,v 1.11 2020/10/31 18:20:00 rillig Exp $ */
/* $NetBSD: metachar.h,v 1.12 2020/11/10 00:32:12 rillig Exp $ */
/*-
* Copyright (c) 2015 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@ extern unsigned char _metachar[];
#define is_shell_metachar(c) _metachar[(c) & 0x7f]
static inline MAKE_ATTR_UNUSED int
MAKE_INLINE int
needshell(const char *cmd)
{
while (!is_shell_metachar(*cmd) && *cmd != ':' && *cmd != '=')

View File

@ -1,4 +1,4 @@
/* $NetBSD: nonints.h,v 1.159 2020/11/08 16:58:33 rillig Exp $ */
/* $NetBSD: nonints.h,v 1.160 2020/11/10 00:32:12 rillig Exp $ */
/*-
* Copyright (c) 1988, 1989, 1990, 1993
@ -156,7 +156,7 @@ typedef struct Words {
} Words;
Words Str_Words(const char *, Boolean);
static inline MAKE_ATTR_UNUSED void
MAKE_INLINE void
Words_Free(Words w) {
free(w.words);
free(w.freeIt);

View File

@ -1,4 +1,4 @@
/* $NetBSD: var.c,v 1.683 2020/11/08 23:38:02 rillig Exp $ */
/* $NetBSD: var.c,v 1.684 2020/11/10 00:32:12 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -130,7 +130,7 @@
#include "metachar.h"
/* "@(#)var.c 8.3 (Berkeley) 3/19/94" */
MAKE_RCSID("$NetBSD: var.c,v 1.683 2020/11/08 23:38:02 rillig Exp $");
MAKE_RCSID("$NetBSD: var.c,v 1.684 2020/11/10 00:32:12 rillig Exp $");
#define VAR_DEBUG1(fmt, arg1) DEBUG1(VAR, fmt, arg1)
#define VAR_DEBUG2(fmt, arg1, arg2) DEBUG2(VAR, fmt, arg1, arg2)
@ -1985,7 +1985,7 @@ ParseModifierPart(
}
/* Test whether mod starts with modname, followed by a delimiter. */
static Boolean
MAKE_INLINE Boolean
ModMatch(const char *mod, const char *modname, char endc)
{
size_t n = strlen(modname);
@ -1994,7 +1994,7 @@ ModMatch(const char *mod, const char *modname, char endc)
}
/* Test whether mod starts with modname, followed by a delimiter or '='. */
static inline Boolean
MAKE_INLINE Boolean
ModMatchEq(const char *mod, const char *modname, char endc)
{
size_t n = strlen(modname);