Skip to content

Commit

Permalink
Adopted MBED_STATIC_ASSERT where possible
Browse files Browse the repository at this point in the history
  • Loading branch information
geky committed Aug 4, 2019
1 parent 8f7c69e commit b6168bf
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions equeue_mbed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ static void equeue_tick_update() {
}

static void equeue_tick_init() {
MBED_ASSERT(sizeof(equeue_timer) >= sizeof(Timer));
MBED_ASSERT(sizeof(equeue_ticker) >= sizeof(Ticker));
MBED_STATIC_ASSERT(sizeof(equeue_timer) >= sizeof(Timer),
"The equeue_timer buffer must fit the class Timer");
MBED_STATIC_ASSERT(sizeof(equeue_ticker) >= sizeof(Ticker),
"The equeue_ticker buffer must fit the class Ticker");
new (equeue_timer) Timer;
new (equeue_ticker) Ticker;

Expand Down Expand Up @@ -67,7 +69,8 @@ void equeue_mutex_unlock(equeue_mutex_t *m) {
#ifdef MBED_CONF_RTOS_PRESENT

int equeue_sema_create(equeue_sema_t *s) {
MBED_ASSERT(sizeof(equeue_sema_t) >= sizeof(Semaphore));
MBED_STATIC_ASSERT(sizeof(equeue_sema_t) >= sizeof(Semaphore),
"The equeue_sema_t must fit the class Semaphore");
new (s) Semaphore(0);
return 0;
}
Expand Down

0 comments on commit b6168bf

Please sign in to comment.