git: b207b1562a2f - main - sys/systm.h: use __nodiscard consistently and correctly
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 26 Jun 2026 16:48:19 UTC
The branch main has been updated by brooks:
URL: https://cgit.FreeBSD.org/src/commit/?id=b207b1562a2f099b4e763460891fa6761549091a
commit b207b1562a2f099b4e763460891fa6761549091a
Author: Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2026-06-26 16:42:06 +0000
Commit: Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2026-06-26 16:42:06 +0000
sys/systm.h: use __nodiscard consistently and correctly
__nodiscard is closer to (and sometimes expands to) [[nodiscard]] from
C23 and C++17 so prefer it to the homegrown __result_use_check and put
it in the right place so it is correct when expanded to [[nodiscard]].
Reviewed by: markj, emaste
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D57882
---
sys/sys/systm.h | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/sys/sys/systm.h b/sys/sys/systm.h
index 88c25f06e0cb..e50b02bfb7cf 100644
--- a/sys/sys/systm.h
+++ b/sys/sys/systm.h
@@ -300,12 +300,12 @@ void *memmove_early(void * _Nonnull dest, const void * _Nonnull src, size_t n);
((__r >= __len) ? ENAMETOOLONG : 0); \
})
-int __result_use_check copyinstr(const void * __restrict udaddr,
+__nodiscard int copyinstr(const void * __restrict udaddr,
void * _Nonnull __restrict kaddr, size_t len,
size_t * __restrict lencopied);
-int __result_use_check copyin(const void * __restrict udaddr,
+__nodiscard int copyin(const void * __restrict udaddr,
void * _Nonnull __restrict kaddr, size_t len);
-int __result_use_check copyin_nofault(const void * __restrict udaddr,
+__nodiscard int copyin_nofault(const void * __restrict udaddr,
void * _Nonnull __restrict kaddr, size_t len);
__nodiscard int copyout(const void * _Nonnull __restrict kaddr,
void * __restrict udaddr, size_t len);
@@ -329,9 +329,9 @@ long fuword(volatile const void *base);
int fuword16(volatile const void *base);
int32_t fuword32(volatile const void *base);
int64_t fuword64(volatile const void *base);
-int __result_use_check fueword(volatile const void *base, long *val);
-int __result_use_check fueword32(volatile const void *base, int32_t *val);
-int __result_use_check fueword64(volatile const void *base, int64_t *val);
+__nodiscard int fueword(volatile const void *base, long *val);
+__nodiscard int fueword32(volatile const void *base, int32_t *val);
+__nodiscard int fueword64(volatile const void *base, int64_t *val);
__nodiscard int subyte(volatile void *base, int byte);
__nodiscard int suword(volatile void *base, long word);
__nodiscard int suword16(volatile void *base, int word);