diff options
author | Ingo Molnar <mingo@kernel.org> | 2017-02-03 06:22:54 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2017-03-02 02:42:23 -0500 |
commit | c930b2c0de32f45ce8f67affe936ce7a05b07b00 (patch) | |
tree | 5a9d05bfeab3359d87ae9094572e64bfff97e743 /include/linux/sched.h | |
parent | 9ccd27cc2e8bfbec502d7c64a353dc4489536b81 (diff) |
sched/core: Convert ___assert_task_state() link time assert to BUILD_BUG_ON()
The length of TASK_STATE_TO_CHAR_STR was still checked using the old
link-time manual error method - convert it to BUILD_BUG_ON(). This
has a couple of advantages:
- it's more obvious what's going on
- it reduces the size and complexity of <linux/sched.h>
- BUILD_BUG_ON() will fail during compilation, with a clearer
error message than the link time assert.
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r-- | include/linux/sched.h | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 4a28deb5f210..c204613396cd 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -223,9 +223,6 @@ extern void proc_sched_set_task(struct task_struct *p); | |||
223 | 223 | ||
224 | #define TASK_STATE_TO_CHAR_STR "RSDTtXZxKWPNn" | 224 | #define TASK_STATE_TO_CHAR_STR "RSDTtXZxKWPNn" |
225 | 225 | ||
226 | extern char ___assert_task_state[1 - 2*!!( | ||
227 | sizeof(TASK_STATE_TO_CHAR_STR)-1 != ilog2(TASK_STATE_MAX)+1)]; | ||
228 | |||
229 | /* Convenience macros for the sake of set_current_state */ | 226 | /* Convenience macros for the sake of set_current_state */ |
230 | #define TASK_KILLABLE (TASK_WAKEKILL | TASK_UNINTERRUPTIBLE) | 227 | #define TASK_KILLABLE (TASK_WAKEKILL | TASK_UNINTERRUPTIBLE) |
231 | #define TASK_STOPPED (TASK_WAKEKILL | __TASK_STOPPED) | 228 | #define TASK_STOPPED (TASK_WAKEKILL | __TASK_STOPPED) |