Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Jan 2021 15:11:15 GMT
From:      Alex Richardson <arichardson@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 8d55837dc133 - main - qeueue.h: Add {SLIST, STAILQ, LIST, TAILQ}_END()
Message-ID:  <202101251511.10PFBFjO039527@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by arichardson:

URL: https://cgit.FreeBSD.org/src/commit/?id=8d55837dc1331a5cdacad539b1788ab1070159b4

commit 8d55837dc1331a5cdacad539b1788ab1070159b4
Author:     Alex Richardson <arichardson@FreeBSD.org>
AuthorDate: 2021-01-25 14:11:45 +0000
Commit:     Alex Richardson <arichardson@FreeBSD.org>
CommitDate: 2021-01-25 15:09:35 +0000

    qeueue.h: Add {SLIST,STAILQ,LIST,TAILQ}_END()
    
    We provide these for compat with other queue.h headers since some software
    assumes it exists (e.g. the libevent contrib code), but we are not
    encouraging their use (NULL should be used instead).
    
    This fixes the following warning (which should arguable be an error since
    it results in a function call to an undefined function):
    
    .../contrib/libevent/buffer.c:495:16: warning: implicit declaration of function 'LIST_END' is invalid in C99 [-Wimplicit-function-declaration]
                 cbent != LIST_END(&buffer->callbacks);
                          ^
    .../contrib/libevent/buffer.c:495:13: warning: comparison between pointer and integer ('struct evbuffer_cb_entry *' and 'int') [-Wpointer-integer-compare]
                 cbent != LIST_END(&buffer->callbacks);
                 ~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    Reviewed By:    jhb
    Differential Revision: https://reviews.freebsd.org/D27151
---
 sys/fs/nfs/nfsport.h |  2 ++
 sys/sys/queue.h      | 10 ++++++++++
 2 files changed, 12 insertions(+)

diff --git a/sys/fs/nfs/nfsport.h b/sys/fs/nfs/nfsport.h
index 7d1c3b1c8cea..9f2789f57bec 100644
--- a/sys/fs/nfs/nfsport.h
+++ b/sys/fs/nfs/nfsport.h
@@ -880,9 +880,11 @@ int nfsmsleep(void *, void *, int, const char *, struct timespec *);
 /*
  * Some queue.h files don't have these dfined in them.
  */
+#ifndef LIST_END
 #define	LIST_END(head)		NULL
 #define	SLIST_END(head)		NULL
 #define	TAILQ_END(head)		NULL
+#endif
 
 /*
  * This must be defined to be a global variable that increments once
diff --git a/sys/sys/queue.h b/sys/sys/queue.h
index 14d55905dfc0..25091ec815f1 100644
--- a/sys/sys/queue.h
+++ b/sys/sys/queue.h
@@ -91,6 +91,7 @@
  * _CLASS_ENTRY			+	+	+	+
  * _INIT			+	+	+	+
  * _EMPTY			+	+	+	+
+ * _END				+	+	+	+
  * _FIRST			+	+	+	+
  * _NEXT			+	+	+	+
  * _PREV			-	+	-	+
@@ -305,6 +306,8 @@ struct {								\
 	SLIST_FIRST(head2) = swap_first;				\
 } while (0)
 
+#define	SLIST_END(head)		NULL
+
 /*
  * Singly-linked Tail queue declarations.
  */
@@ -437,6 +440,9 @@ struct {								\
 		(head2)->stqh_last = &STAILQ_FIRST(head2);		\
 } while (0)
 
+#define	STAILQ_END(head)	NULL
+
+
 /*
  * List declarations.
  */
@@ -611,6 +617,8 @@ struct {								\
 		swap_tmp->field.le_prev = &LIST_FIRST((head2));		\
 } while (0)
 
+#define	LIST_END(head)	NULL
+
 /*
  * Tail queue declarations.
  */
@@ -867,4 +875,6 @@ struct {								\
 		(head2)->tqh_last = &(head2)->tqh_first;		\
 } while (0)
 
+#define	TAILQ_END(head)		NULL
+
 #endif /* !_SYS_QUEUE_H_ */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202101251511.10PFBFjO039527>