Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make make(1): fix position of MAKE_ATTR_UNUSED in in...



details:   https://anonhg.NetBSD.org/src/rev/b0a1074130f2
branches:  trunk
changeset: 938705:b0a1074130f2
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Sep 13 15:27:25 2020 +0000

description:
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.

diffstat:

 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(-)

diffs (106 lines):

diff -r e3da806a8db9 -r b0a1074130f2 usr.bin/make/buf.h
--- a/usr.bin/make/buf.h        Sun Sep 13 15:15:51 2020 +0000
+++ b/usr.bin/make/buf.h        Sun Sep 13 15:27:25 2020 +0000
@@ -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 @@
 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 @@
     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 -r e3da806a8db9 -r b0a1074130f2 usr.bin/make/hash.h
--- a/usr.bin/make/hash.h       Sun Sep 13 15:15:51 2020 +0000
+++ b/usr.bin/make/hash.h       Sun Sep 13 15:27:25 2020 +0000
@@ -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 @@
     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 -r e3da806a8db9 -r b0a1074130f2 usr.bin/make/make_malloc.h
--- a/usr.bin/make/make_malloc.h        Sun Sep 13 15:15:51 2020 +0000
+++ b/usr.bin/make/make_malloc.h        Sun Sep 13 15:27:25 2020 +0000
@@ -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 @@
  *
  * 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 -r e3da806a8db9 -r b0a1074130f2 usr.bin/make/metachar.h
--- a/usr.bin/make/metachar.h   Sun Sep 13 15:15:51 2020 +0000
+++ b/usr.bin/make/metachar.h   Sun Sep 13 15:27:25 2020 +0000
@@ -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 @@
 
 #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 -r e3da806a8db9 -r b0a1074130f2 usr.bin/make/nonints.h
--- a/usr.bin/make/nonints.h    Sun Sep 13 15:15:51 2020 +0000
+++ b/usr.bin/make/nonints.h    Sun Sep 13 15:27:25 2020 +0000
@@ -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 @@
 } 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);



Home | Main Index | Thread Index | Old Index