git: 175920c9d0f7 - stable/14 - libnetbsd: import the `__nothing` macro
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 22 Feb 2026 03:34:15 UTC
The branch stable/14 has been updated by ngie:
URL: https://cgit.FreeBSD.org/src/commit/?id=175920c9d0f71bf9b7beb4854836e340c0c563da
commit 175920c9d0f71bf9b7beb4854836e340c0c563da
Author: Enji Cooper <ngie@FreeBSD.org>
AuthorDate: 2026-02-15 18:41:43 +0000
Commit: Enji Cooper <ngie@FreeBSD.org>
CommitDate: 2026-02-22 03:34:11 +0000
libnetbsd: import the `__nothing` macro
This macro is widely used in new NetBSD tests. Please see the comment
next to the imported macro for more details on its use.
Obtained from: NetBSD (c26cc77b3a0b2)
MFC after: 1 week
(cherry picked from commit faaeb6e62ae2f7371ac3ed37aae102f8e066a4b9)
---
lib/libnetbsd/sys/cdefs.h | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/lib/libnetbsd/sys/cdefs.h b/lib/libnetbsd/sys/cdefs.h
index 8da812693961..fcc3cc6f15be 100644
--- a/lib/libnetbsd/sys/cdefs.h
+++ b/lib/libnetbsd/sys/cdefs.h
@@ -1,4 +1,3 @@
-
/*-
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -81,4 +80,18 @@
#define __BITS(__m, __n) \
((__BIT(MAX((__m), (__n)) + 1) - 1) ^ (__BIT(MIN((__m), (__n))) - 1))
+/*
+ * To be used when an empty body is required like:
+ *
+ * #ifdef DEBUG
+ * # define dprintf(a) printf(a)
+ * #else
+ * # define dprintf(a) __nothing
+ * #endif
+ *
+ * We use ((void)0) instead of do {} while (0) so that it
+ * works on , expressions.
+ */
+#define __nothing (/*LINTED*/(void)0)
+
#endif /* _LIBNETBSD_SYS_CDEFS_H_ */