From d18d0e85596f90e0bd597b33d58209d0b3973c95 Mon Sep 17 00:00:00 2001 From: Richard Braun Date: Fri, 1 Sep 2017 23:58:41 +0200 Subject: 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. --- kern/task.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'kern/task.h') diff --git a/kern/task.h b/kern/task.h index 1711fbee..149ff49d 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 #include #include +#include #include #include #include @@ -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); -- cgit v1.2.3