mirror of https://github.com/ARMmbed/mbed-os.git
				
				
				
			Adopted MBED_STATIC_ASSERT where possible
							parent
							
								
									182c6a29f2
								
							
						
					
					
						commit
						98db3ab1cb
					
				| 
						 | 
				
			
			@ -38,8 +38,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;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -78,7 +80,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;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -294,7 +294,8 @@ protected:
 | 
			
		|||
// Conversion function for network stacks
 | 
			
		||||
NetworkStack *nsapi_create_stack(nsapi_stack_t *stack)
 | 
			
		||||
{
 | 
			
		||||
    MBED_ASSERT(sizeof stack->_stack_buffer >= sizeof(NetworkStackWrapper));
 | 
			
		||||
    MBED_STATIC_ASSERT(sizeof stack->_stack_buffer >= sizeof(NetworkStackWrapper),
 | 
			
		||||
            "The nsapi_stack_t stack buffer must fit a NetworkStackWrapper");
 | 
			
		||||
    return new (stack->_stack_buffer) NetworkStackWrapper;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -715,7 +715,8 @@ private:
 | 
			
		|||
            &Callback::function_dtor<F>,
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        MBED_ASSERT(sizeof(Callback) - sizeof(_ops) >= sizeof(F));
 | 
			
		||||
        MBED_STATIC_ASSERT(sizeof(Callback) - sizeof(_ops) >= sizeof(F),
 | 
			
		||||
                "Type F must not exceed the size of the Callback class");
 | 
			
		||||
        new (this) F(f);
 | 
			
		||||
        _ops = &ops;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -1421,7 +1422,8 @@ private:
 | 
			
		|||
            &Callback::function_dtor<F>,
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        MBED_ASSERT(sizeof(Callback) - sizeof(_ops) >= sizeof(F));
 | 
			
		||||
        MBED_STATIC_ASSERT(sizeof(Callback) - sizeof(_ops) >= sizeof(F),
 | 
			
		||||
                "Type F must not exceed the size of the Callback class");
 | 
			
		||||
        new (this) F(f);
 | 
			
		||||
        _ops = &ops;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -2127,7 +2129,8 @@ private:
 | 
			
		|||
            &Callback::function_dtor<F>,
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        MBED_ASSERT(sizeof(Callback) - sizeof(_ops) >= sizeof(F));
 | 
			
		||||
        MBED_STATIC_ASSERT(sizeof(Callback) - sizeof(_ops) >= sizeof(F),
 | 
			
		||||
                "Type F must not exceed the size of the Callback class");
 | 
			
		||||
        new (this) F(f);
 | 
			
		||||
        _ops = &ops;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -2833,7 +2836,8 @@ private:
 | 
			
		|||
            &Callback::function_dtor<F>,
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        MBED_ASSERT(sizeof(Callback) - sizeof(_ops) >= sizeof(F));
 | 
			
		||||
        MBED_STATIC_ASSERT(sizeof(Callback) - sizeof(_ops) >= sizeof(F),
 | 
			
		||||
                "Type F must not exceed the size of the Callback class");
 | 
			
		||||
        new (this) F(f);
 | 
			
		||||
        _ops = &ops;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -3539,7 +3543,8 @@ private:
 | 
			
		|||
            &Callback::function_dtor<F>,
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        MBED_ASSERT(sizeof(Callback) - sizeof(_ops) >= sizeof(F));
 | 
			
		||||
        MBED_STATIC_ASSERT(sizeof(Callback) - sizeof(_ops) >= sizeof(F),
 | 
			
		||||
                "Type F must not exceed the size of the Callback class");
 | 
			
		||||
        new (this) F(f);
 | 
			
		||||
        _ops = &ops;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -4245,7 +4250,8 @@ private:
 | 
			
		|||
            &Callback::function_dtor<F>,
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        MBED_ASSERT(sizeof(Callback) - sizeof(_ops) >= sizeof(F));
 | 
			
		||||
        MBED_STATIC_ASSERT(sizeof(Callback) - sizeof(_ops) >= sizeof(F),
 | 
			
		||||
                "Type F must not exceed the size of the Callback class");
 | 
			
		||||
        new (this) F(f);
 | 
			
		||||
        _ops = &ops;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue