From de337db564541c3da53081c0317e0c993e1516a2 Mon Sep 17 00:00:00 2001 From: rillig Date: Sun, 13 Sep 2020 15:27:25 +0000 Subject: [PATCH] make(1): fix position of MAKE_ATTR_UNUSED in inline functions The attribute needs to be before the return type, otherwise GCC 5 complains that Hash_GetValue is defined but not used, when compiling with USER_CPPFLAGS=-Dinline=. The other functions don't get any warnings. It's probably because Hash_GetValue is the only inline function that returns a pointer. --- usr.bin/make/buf.h | 6 +++--- usr.bin/make/hash.h | 6 +++--- usr.bin/make/make_malloc.h | 4 ++-- usr.bin/make/metachar.h | 4 ++-- usr.bin/make/nonints.h | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/usr.bin/make/buf.h b/usr.bin/make/buf.h index 1dc3cdbf58f3..f9340b479b9e 100644 --- a/usr.bin/make/buf.h +++ b/usr.bin/make/buf.h @@ -1,4 +1,4 @@ -/* $NetBSD: buf.h,v 1.28 2020/09/01 17:38:26 rillig Exp $ */ +/* $NetBSD: buf.h,v 1.29 2020/09/13 15:27:25 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 void MAKE_ATTR_UNUSED +static inline MAKE_ATTR_UNUSED void Buf_AddByte(Buffer *bp, char byte) { size_t count = ++bp->count; @@ -106,7 +106,7 @@ Buf_AddByte(Buffer *bp, char byte) ptr[0] = 0; } -static inline size_t MAKE_ATTR_UNUSED +static inline MAKE_ATTR_UNUSED size_t Buf_Size(const Buffer *bp) { return bp->count; diff --git a/usr.bin/make/hash.h b/usr.bin/make/hash.h index 61a248e38c14..1ded21d4fa80 100644 --- a/usr.bin/make/hash.h +++ b/usr.bin/make/hash.h @@ -1,4 +1,4 @@ -/* $NetBSD: hash.h,v 1.22 2020/09/05 13:55:08 rillig Exp $ */ +/* $NetBSD: hash.h,v 1.23 2020/09/13 15:27:25 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -106,13 +106,13 @@ typedef struct Hash_Search { Hash_Entry *entry; /* Next entry to check in current bucket. */ } Hash_Search; -static inline void * MAKE_ATTR_UNUSED +static inline MAKE_ATTR_UNUSED void * Hash_GetValue(Hash_Entry *h) { return h->value; } -static inline void MAKE_ATTR_UNUSED +static inline MAKE_ATTR_UNUSED void Hash_SetValue(Hash_Entry *h, void *datum) { h->value = datum; diff --git a/usr.bin/make/make_malloc.h b/usr.bin/make/make_malloc.h index ac804d79c711..492ff0b6961b 100644 --- a/usr.bin/make/make_malloc.h +++ b/usr.bin/make/make_malloc.h @@ -1,4 +1,4 @@ -/* $NetBSD: make_malloc.h,v 1.10 2020/08/29 16:47:45 rillig Exp $ */ +/* $NetBSD: make_malloc.h,v 1.11 2020/09/13 15:27:25 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 void MAKE_ATTR_UNUSED +static inline MAKE_ATTR_UNUSED void bmake_free(void *p) { if (p != NULL) diff --git a/usr.bin/make/metachar.h b/usr.bin/make/metachar.h index 54d69b23ed09..10077187f581 100644 --- a/usr.bin/make/metachar.h +++ b/usr.bin/make/metachar.h @@ -1,4 +1,4 @@ -/* $NetBSD: metachar.h,v 1.8 2020/09/11 17:32:36 rillig Exp $ */ +/* $NetBSD: metachar.h,v 1.9 2020/09/13 15:27:25 rillig Exp $ */ /*- * Copyright (c) 2015 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ extern unsigned char _metachar[]; #define ismeta(c) _metachar[(c) & 0x7f] -static inline int MAKE_ATTR_UNUSED +static inline MAKE_ATTR_UNUSED int needshell(const char *cmd, int white) { while (!ismeta(*cmd) && *cmd != ':' && *cmd != '=') { diff --git a/usr.bin/make/nonints.h b/usr.bin/make/nonints.h index e1e1bdc01913..8f50bf9b47d6 100644 --- a/usr.bin/make/nonints.h +++ b/usr.bin/make/nonints.h @@ -1,4 +1,4 @@ -/* $NetBSD: nonints.h,v 1.117 2020/09/13 13:50:27 rillig Exp $ */ +/* $NetBSD: nonints.h,v 1.118 2020/09/13 15:27:25 rillig Exp $ */ /*- * Copyright (c) 1988, 1989, 1990, 1993 @@ -138,7 +138,7 @@ typedef struct { } Words; Words Str_Words(const char *, Boolean); -static inline void MAKE_ATTR_UNUSED +static inline MAKE_ATTR_UNUSED void Words_Free(Words w) { free(w.words); free(w.freeIt);