summaryrefslogtreecommitdiff
path: root/kern/thread.h
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2017-09-01 23:58:41 +0200
committerRichard Braun <rbraun@sceen.net>2017-09-02 15:25:37 +0200
commitd18d0e85596f90e0bd597b33d58209d0b3973c95 (patch)
tree6c3472f59cf64244ab86d2fc13b220b1c8f61165 /kern/thread.h
parent897ad6a062ea2a32a2759613608faf3271211832 (diff)
Make assert have no side effects
This makes sure symbols referenced by assert uses may not be generated if unused. The recently introduced __unused macro is used to suppress compiler warnings resulting from this change.
Diffstat (limited to 'kern/thread.h')
-rw-r--r--kern/thread.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/kern/thread.h b/kern/thread.h
index a3f2670..1a81168 100644
--- a/kern/thread.h
+++ b/kern/thread.h
@@ -43,6 +43,7 @@
#include <kern/init.h>
#include <kern/condition.h>
#include <kern/cpumap.h>
+#include <kern/macros.h>
#include <kern/spinlock_types.h>
#include <kern/turnstile_types.h>
#include <machine/cpu.h>
@@ -281,7 +282,7 @@ void thread_pi_setscheduler(struct thread *thread, unsigned char policy,
static inline void
thread_ref(struct thread *thread)
{
- unsigned long nr_refs;
+ __unused unsigned long nr_refs;
nr_refs = atomic_fetch_add(&thread->nr_refs, 1, ATOMIC_RELAXED);
assert(nr_refs != (unsigned long)-1);