Module Name: src
Committed By: rillig
Date: Sun Sep 13 15:27:25 UTC 2020
Modified Files:
src/usr.bin/make: buf.h hash.h make_malloc.h metachar.h nonints.h
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/usr.bin/make/buf.h
cvs rdiff -u -r1.22 -r1.23 src/usr.bin/make/hash.h
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/make_malloc.h
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/metachar.h
cvs rdiff -u -r1.117 -r1.118 src/usr.bin/make/nonints.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/buf.h
diff -u src/usr.bin/make/buf.h:1.28 src/usr.bin/make/buf.h:1.29
--- src/usr.bin/make/buf.h:1.28 Tue Sep 1 17:38:26 2020
+++ src/usr.bin/make/buf.h Sun Sep 13 15:27:25 2020
@@ -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;
Index: src/usr.bin/make/hash.h
diff -u src/usr.bin/make/hash.h:1.22 src/usr.bin/make/hash.h:1.23
--- src/usr.bin/make/hash.h:1.22 Sat Sep 5 13:55:08 2020
+++ src/usr.bin/make/hash.h Sun Sep 13 15:27:25 2020
@@ -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;
Index: src/usr.bin/make/make_malloc.h
diff -u src/usr.bin/make/make_malloc.h:1.10 src/usr.bin/make/make_malloc.h:1.11
--- src/usr.bin/make/make_malloc.h:1.10 Sat Aug 29 16:47:45 2020
+++ src/usr.bin/make/make_malloc.h Sun Sep 13 15:27:25 2020
@@ -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
*
* 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)
Index: src/usr.bin/make/metachar.h
diff -u src/usr.bin/make/metachar.h:1.8 src/usr.bin/make/metachar.h:1.9
--- src/usr.bin/make/metachar.h:1.8 Fri Sep 11 17:32:36 2020
+++ src/usr.bin/make/metachar.h Sun Sep 13 15:27:25 2020
@@ -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 != '=') {
Index: src/usr.bin/make/nonints.h
diff -u src/usr.bin/make/nonints.h:1.117 src/usr.bin/make/nonints.h:1.118
--- src/usr.bin/make/nonints.h:1.117 Sun Sep 13 13:50:27 2020
+++ src/usr.bin/make/nonints.h Sun Sep 13 15:27:25 2020
@@ -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);