diff options
author | Bill Richardson <wfrichar@chromium.org> | 2013-04-26 20:02:07 -0700 |
---|---|---|
committer | ChromeBot <chrome-bot@google.com> | 2013-04-29 11:05:08 -0700 |
commit | d9bddaa0722d2b95c9b72c9c3a24c33053381311 (patch) | |
tree | 9db87c5dbf220fed30d9caca8a10a0aa2a61039c /core | |
parent | 7cebaa0a017d734ae9dda19a39fd867463f785c6 (diff) | |
download | chrome-ec-d9bddaa0722d2b95c9b72c9c3a24c33053381311.tar.gz |
Improved the BUILD_ASSERT macro to work outside of functions.
This will let us check the size of static array initializers.
Also moved this macro definition and ARRAY_SIZE into a new "tricks.h"
header, so that userspace utils can use it too.
BUG=none
BRANCH=none
TEST=manual
Built everything, tested on Link. Tried various assertions.
Change-Id: I612891108ea37dbca3572e0f25ab54a7bc0ed860
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49417
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'core')
-rw-r--r-- | core/cortex-m/task.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/core/cortex-m/task.c b/core/cortex-m/task.c index 47bbbee1e9..bd5736a3ae 100644 --- a/core/cortex-m/task.c +++ b/core/cortex-m/task.c @@ -109,6 +109,10 @@ static const struct { /* Contexts for all tasks */ static task_ tasks[TASK_ID_COUNT]; +/* Sanity checks about static task invariants */ +BUILD_ASSERT(TASK_ID_COUNT <= sizeof(unsigned) * 8); +BUILD_ASSERT(TASK_ID_COUNT < (1 << (sizeof(task_id_t) * 8))); + /* Stacks for all tasks */ #define TASK(n, r, d, s) + s @@ -613,10 +617,6 @@ void task_pre_init(void) ((task_ *)scratchpad)->stack = (uint32_t *)scratchpad; *(uint32_t *)scratchpad = STACK_UNUSED_VALUE; - /* Sanity checks about static task invariants */ - BUILD_ASSERT(TASK_ID_COUNT <= sizeof(unsigned) * 8); - BUILD_ASSERT(TASK_ID_COUNT < (1 << (sizeof(task_id_t) * 8))); - /* Initialize IRQs */ __nvic_init_irqs(); } |