summaryrefslogtreecommitdiff
path: root/kern/task.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/task.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/task.h')
-rw-r--r--kern/task.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/kern/task.h b/kern/task.h
index 1711fbe..149ff49 100644
--- a/kern/task.h
+++ b/kern/task.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012 Richard Braun.
+ * Copyright (c) 2012-2017 Richard Braun.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -21,6 +21,7 @@
#include <kern/atomic.h>
#include <kern/init.h>
#include <kern/list.h>
+#include <kern/macros.h>
#include <kern/spinlock.h>
#include <kern/thread.h>
#include <vm/vm_map.h>
@@ -50,7 +51,7 @@ extern struct task *kernel_task;
static inline void
task_ref(struct task *task)
{
- unsigned long nr_refs;
+ __unused unsigned long nr_refs;
nr_refs = atomic_fetch_add(&task->nr_refs, 1, ATOMIC_RELAXED);
assert(nr_refs != (unsigned long)-1);