diff options
author | Richard Braun <rbraun@sceen.net> | 2017-05-30 22:16:59 +0200 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2017-05-30 22:16:59 +0200 |
commit | 436fe6cb9711401fcc1f1d8fc29025f1aec5b774 (patch) | |
tree | 521e9c563f161e8faa6370372af26b3a4f5623ae /kern | |
parent | 4eaa58c85eec654eb8bf8e002b3f3a419f5ce16b (diff) |
Move assert.h to the include directory
This turns assert.h into a standard header.
Diffstat (limited to 'kern')
-rw-r--r-- | kern/arg.c | 2 | ||||
-rw-r--r-- | kern/assert.h | 43 | ||||
-rw-r--r-- | kern/cbuf.c | 3 | ||||
-rw-r--r-- | kern/condition.c | 2 | ||||
-rw-r--r-- | kern/console.c | 2 | ||||
-rw-r--r-- | kern/hash.h | 3 | ||||
-rw-r--r-- | kern/kmem.c | 2 | ||||
-rw-r--r-- | kern/llsync.c | 2 | ||||
-rw-r--r-- | kern/llsync_i.h | 3 | ||||
-rw-r--r-- | kern/log2.h | 3 | ||||
-rw-r--r-- | kern/mutex.h | 3 | ||||
-rw-r--r-- | kern/mutex_i.h | 3 | ||||
-rw-r--r-- | kern/percpu.c | 2 | ||||
-rw-r--r-- | kern/percpu.h | 2 | ||||
-rw-r--r-- | kern/rbtree.c | 2 | ||||
-rw-r--r-- | kern/rbtree.h | 2 | ||||
-rw-r--r-- | kern/rbtree_i.h | 2 | ||||
-rw-r--r-- | kern/rdxtree.c | 2 | ||||
-rw-r--r-- | kern/rtmutex.c | 2 | ||||
-rw-r--r-- | kern/rtmutex.h | 2 | ||||
-rw-r--r-- | kern/rtmutex_i.h | 2 | ||||
-rw-r--r-- | kern/semaphore.h | 3 | ||||
-rw-r--r-- | kern/semaphore_i.h | 3 | ||||
-rw-r--r-- | kern/sleepq.c | 2 | ||||
-rw-r--r-- | kern/spinlock.c | 2 | ||||
-rw-r--r-- | kern/spinlock_i.h | 2 | ||||
-rw-r--r-- | kern/sref.c | 2 | ||||
-rw-r--r-- | kern/thread.c | 2 | ||||
-rw-r--r-- | kern/thread.h | 2 | ||||
-rw-r--r-- | kern/turnstile.c | 2 | ||||
-rw-r--r-- | kern/work.c | 2 | ||||
-rw-r--r-- | kern/xcall.c | 2 |
32 files changed, 38 insertions, 75 deletions
@@ -15,13 +15,13 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include <assert.h> #include <stdbool.h> #include <stddef.h> #include <stdio.h> #include <string.h> #include <kern/arg.h> -#include <kern/assert.h> #include <kern/init.h> #include <kern/macros.h> #include <kern/panic.h> diff --git a/kern/assert.h b/kern/assert.h deleted file mode 100644 index cc8b80ea..00000000 --- a/kern/assert.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2010 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _KERN_ASSERT_H -#define _KERN_ASSERT_H - -#define static_assert _Static_assert - -#ifdef NDEBUG -#define assert(expression) ((void)(expression)) -#else /* NDEBUG */ - -#include <kern/macros.h> -#include <kern/panic.h> - -/* - * Panic if the given expression is false. - */ -#define assert(expression) \ -MACRO_BEGIN \ - if (unlikely(!(expression))) { \ - panic("assertion (%s) failed in %s:%d, function %s()", \ - __QUOTE(expression), __FILE__, __LINE__, __func__); \ - } \ -MACRO_END - -#endif /* NDEBUG */ - -#endif /* _KERN_ASSERT_H */ diff --git a/kern/cbuf.c b/kern/cbuf.c index 17369afe..5c636e56 100644 --- a/kern/cbuf.c +++ b/kern/cbuf.c @@ -15,7 +15,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include <kern/assert.h> +#include <assert.h> + #include <kern/cbuf.h> #include <kern/error.h> #include <kern/macros.h> diff --git a/kern/condition.c b/kern/condition.c index 4a837f4e..c8ea5f39 100644 --- a/kern/condition.c +++ b/kern/condition.c @@ -18,10 +18,10 @@ * Locking order : mutex -> sleep queue */ +#include <assert.h> #include <stdbool.h> #include <stddef.h> -#include <kern/assert.h> #include <kern/condition.h> #include <kern/condition_types.h> #include <kern/mutex.h> diff --git a/kern/console.c b/kern/console.c index c82e7dc9..e8c0c28a 100644 --- a/kern/console.c +++ b/kern/console.c @@ -15,13 +15,13 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include <assert.h> #include <stdbool.h> #include <stddef.h> #include <stdio.h> #include <string.h> #include <kern/arg.h> -#include <kern/assert.h> #include <kern/error.h> #include <kern/init.h> #include <kern/console.h> diff --git a/kern/hash.h b/kern/hash.h index 108d4b46..db399960 100644 --- a/kern/hash.h +++ b/kern/hash.h @@ -39,11 +39,10 @@ #ifndef _KERN_HASH_H #define _KERN_HASH_H +#include <assert.h> #include <stdint.h> #include <string.h> -#include <kern/assert.h> - #ifdef __LP64__ #define HASH_ALLBITS 64 #define hash_long(n, bits) hash_int64(n, bits) diff --git a/kern/kmem.c b/kern/kmem.c index 5cce5589..1f822b8a 100644 --- a/kern/kmem.c +++ b/kern/kmem.c @@ -41,13 +41,13 @@ * TODO Rework the CPU pool layer to use the SLQB algorithm by Nick Piggin. */ +#include <assert.h> #include <stdbool.h> #include <stddef.h> #include <stdint.h> #include <stdio.h> #include <string.h> -#include <kern/assert.h> #include <kern/init.h> #include <kern/limits.h> #include <kern/list.h> diff --git a/kern/llsync.c b/kern/llsync.c index 1942576d..1c5086f3 100644 --- a/kern/llsync.c +++ b/kern/llsync.c @@ -32,11 +32,11 @@ * TODO Gracefully handle large amounts of deferred works. */ +#include <assert.h> #include <stdbool.h> #include <stddef.h> #include <stdio.h> -#include <kern/assert.h> #include <kern/condition.h> #include <kern/cpumap.h> #include <kern/init.h> diff --git a/kern/llsync_i.h b/kern/llsync_i.h index 6bc1bf1d..12e2861c 100644 --- a/kern/llsync_i.h +++ b/kern/llsync_i.h @@ -18,7 +18,8 @@ #ifndef _KERN_LLSYNC_I_H #define _KERN_LLSYNC_I_H -#include <kern/assert.h> +#include <assert.h> + #include <kern/cpumap.h> #include <kern/macros.h> #include <kern/param.h> diff --git a/kern/log2.h b/kern/log2.h index 0a3768a7..ebcf2f38 100644 --- a/kern/log2.h +++ b/kern/log2.h @@ -21,7 +21,8 @@ #ifndef _KERN_LOG2_H #define _KERN_LOG2_H -#include <kern/assert.h> +#include <assert.h> + #include <kern/limits.h> static inline unsigned int diff --git a/kern/mutex.h b/kern/mutex.h index 1100b77d..d09a7bbe 100644 --- a/kern/mutex.h +++ b/kern/mutex.h @@ -68,7 +68,8 @@ mutex_unlock(struct mutex *mutex) #else /* X15_MUTEX_PI */ -#include <kern/assert.h> +#include <assert.h> + #include <kern/error.h> #include <kern/macros.h> #include <kern/mutex_i.h> diff --git a/kern/mutex_i.h b/kern/mutex_i.h index a4a40eb5..3b36dcde 100644 --- a/kern/mutex_i.h +++ b/kern/mutex_i.h @@ -20,7 +20,8 @@ #ifndef X15_MUTEX_PI -#include <kern/assert.h> +#include <assert.h> + #include <kern/atomic.h> #include <kern/mutex_types.h> diff --git a/kern/percpu.c b/kern/percpu.c index 5e4ff827..a1f7df15 100644 --- a/kern/percpu.c +++ b/kern/percpu.c @@ -15,12 +15,12 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include <assert.h> #include <stddef.h> #include <stdint.h> #include <stdio.h> #include <string.h> -#include <kern/assert.h> #include <kern/error.h> #include <kern/init.h> #include <kern/macros.h> diff --git a/kern/percpu.h b/kern/percpu.h index 59959518..d6a8d1ab 100644 --- a/kern/percpu.h +++ b/kern/percpu.h @@ -53,9 +53,9 @@ #ifndef _KERN_PERCPU_H #define _KERN_PERCPU_H +#include <assert.h> #include <stdint.h> -#include <kern/assert.h> #include <kern/macros.h> #define PERCPU_SECTION .percpu diff --git a/kern/rbtree.c b/kern/rbtree.c index e2ea54ad..adce033a 100644 --- a/kern/rbtree.c +++ b/kern/rbtree.c @@ -15,10 +15,10 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include <assert.h> #include <stddef.h> #include <stdint.h> -#include <kern/assert.h> #include <kern/macros.h> #include <kern/rbtree.h> #include <kern/rbtree_i.h> diff --git a/kern/rbtree.h b/kern/rbtree.h index 38083427..4ae8353f 100644 --- a/kern/rbtree.h +++ b/kern/rbtree.h @@ -21,10 +21,10 @@ #ifndef _KERN_RBTREE_H #define _KERN_RBTREE_H +#include <assert.h> #include <stddef.h> #include <stdint.h> -#include <kern/assert.h> #include <kern/macros.h> /* diff --git a/kern/rbtree_i.h b/kern/rbtree_i.h index 99722977..944148e0 100644 --- a/kern/rbtree_i.h +++ b/kern/rbtree_i.h @@ -18,10 +18,10 @@ #ifndef _KERN_RBTREE_I_H #define _KERN_RBTREE_I_H +#include <assert.h> #include <stddef.h> #include <stdint.h> -#include <kern/assert.h> #include <kern/macros.h> /* diff --git a/kern/rdxtree.c b/kern/rdxtree.c index 788f3ba8..b518c7f6 100644 --- a/kern/rdxtree.c +++ b/kern/rdxtree.c @@ -15,12 +15,12 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include <assert.h> #include <stdbool.h> #include <stddef.h> #include <stdint.h> #include <string.h> -#include <kern/assert.h> #include <kern/error.h> #include <kern/kmem.h> #include <kern/limits.h> diff --git a/kern/rtmutex.c b/kern/rtmutex.c index 6f639ddf..09f011c4 100644 --- a/kern/rtmutex.c +++ b/kern/rtmutex.c @@ -15,10 +15,10 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include <assert.h> #include <stddef.h> #include <stdint.h> -#include <kern/assert.h> #include <kern/atomic.h> #include <kern/rtmutex.h> #include <kern/rtmutex_i.h> diff --git a/kern/rtmutex.h b/kern/rtmutex.h index f64274d7..ec79afa9 100644 --- a/kern/rtmutex.h +++ b/kern/rtmutex.h @@ -24,9 +24,9 @@ #ifndef _KERN_RTMUTEX_H #define _KERN_RTMUTEX_H +#include <assert.h> #include <stdint.h> -#include <kern/assert.h> #include <kern/error.h> #include <kern/macros.h> #include <kern/rtmutex_i.h> diff --git a/kern/rtmutex_i.h b/kern/rtmutex_i.h index 2f2cc17f..984cfd16 100644 --- a/kern/rtmutex_i.h +++ b/kern/rtmutex_i.h @@ -18,10 +18,10 @@ #ifndef _KERN_RTMUTEX_I_H #define _KERN_RTMUTEX_I_H +#include <assert.h> #include <stdbool.h> #include <stdint.h> -#include <kern/assert.h> #include <kern/atomic.h> #include <kern/rtmutex_types.h> #include <kern/thread.h> diff --git a/kern/semaphore.h b/kern/semaphore.h index d7219b4f..e08927ec 100644 --- a/kern/semaphore.h +++ b/kern/semaphore.h @@ -32,7 +32,8 @@ #ifndef _KERN_SEMAPHORE_H #define _KERN_SEMAPHORE_H -#include <kern/assert.h> +#include <assert.h> + #include <kern/atomic.h> #include <kern/error.h> #include <kern/macros.h> diff --git a/kern/semaphore_i.h b/kern/semaphore_i.h index 54985062..acd7cd48 100644 --- a/kern/semaphore_i.h +++ b/kern/semaphore_i.h @@ -18,7 +18,8 @@ #ifndef _KERN_SEMAPHORE_I_H #define _KERN_SEMAPHORE_I_H -#include <kern/assert.h> +#include <assert.h> + #include <kern/atomic.h> struct semaphore { diff --git a/kern/sleepq.c b/kern/sleepq.c index 09548db6..f5fa6729 100644 --- a/kern/sleepq.c +++ b/kern/sleepq.c @@ -18,11 +18,11 @@ * TODO Analyse hash parameters. */ +#include <assert.h> #include <stdbool.h> #include <stddef.h> #include <stdint.h> -#include <kern/assert.h> #include <kern/init.h> #include <kern/kmem.h> #include <kern/list.h> diff --git a/kern/spinlock.c b/kern/spinlock.c index 3ec36b36..6b9f2788 100644 --- a/kern/spinlock.c +++ b/kern/spinlock.c @@ -53,9 +53,9 @@ * more contention, an operation called downgrading. */ +#include <assert.h> #include <stddef.h> -#include <kern/assert.h> #include <kern/atomic.h> #include <kern/error.h> #include <kern/macros.h> diff --git a/kern/spinlock_i.h b/kern/spinlock_i.h index 45018033..c9dcdd10 100644 --- a/kern/spinlock_i.h +++ b/kern/spinlock_i.h @@ -18,10 +18,10 @@ #ifndef _KERN_SPINLOCK_I_H #define _KERN_SPINLOCK_I_H +#include <assert.h> #include <stddef.h> #include <stdint.h> -#include <kern/assert.h> #include <kern/atomic.h> #include <kern/error.h> #include <kern/macros.h> diff --git a/kern/sref.c b/kern/sref.c index 3f399a30..95e697a4 100644 --- a/kern/sref.c +++ b/kern/sref.c @@ -41,11 +41,11 @@ * TODO Reconsider whether it's possible to bring back local review queues. */ +#include <assert.h> #include <stdbool.h> #include <stddef.h> #include <stdio.h> -#include <kern/assert.h> #include <kern/condition.h> #include <kern/cpumap.h> #include <kern/error.h> diff --git a/kern/thread.c b/kern/thread.c index e6875586..68aa7285 100644 --- a/kern/thread.c +++ b/kern/thread.c @@ -81,13 +81,13 @@ * weights in a smoother way than a raw scaling). */ +#include <assert.h> #include <stdbool.h> #include <stddef.h> #include <stdint.h> #include <stdio.h> #include <string.h> -#include <kern/assert.h> #include <kern/atomic.h> #include <kern/condition.h> #include <kern/cpumap.h> diff --git a/kern/thread.h b/kern/thread.h index 62708268..e348fe39 100644 --- a/kern/thread.h +++ b/kern/thread.h @@ -33,10 +33,10 @@ #ifndef _KERN_THREAD_H #define _KERN_THREAD_H +#include <assert.h> #include <stdbool.h> #include <stddef.h> -#include <kern/assert.h> #include <kern/atomic.h> #include <kern/condition.h> #include <kern/cpumap.h> diff --git a/kern/turnstile.c b/kern/turnstile.c index 7b27d841..78532fb5 100644 --- a/kern/turnstile.c +++ b/kern/turnstile.c @@ -43,11 +43,11 @@ * TODO Analyse hash parameters. */ +#include <assert.h> #include <stdbool.h> #include <stddef.h> #include <stdint.h> -#include <kern/assert.h> #include <kern/init.h> #include <kern/kmem.h> #include <kern/list.h> diff --git a/kern/work.c b/kern/work.c index 714af35c..738ab8b6 100644 --- a/kern/work.c +++ b/kern/work.c @@ -15,10 +15,10 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include <assert.h> #include <stddef.h> #include <stdio.h> -#include <kern/assert.h> #include <kern/bitmap.h> #include <kern/error.h> #include <kern/init.h> diff --git a/kern/xcall.c b/kern/xcall.c index 364ad0be..ce22aa0f 100644 --- a/kern/xcall.c +++ b/kern/xcall.c @@ -15,9 +15,9 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include <assert.h> #include <stddef.h> -#include <kern/assert.h> #include <kern/atomic.h> #include <kern/macros.h> #include <kern/param.h> |