diff options
-rw-r--r-- | cpukit/include/rtems/confdefs/inittask.h | 27 | ||||
-rw-r--r-- | cpukit/include/rtems/confdefs/wkspace.h | 34 |
2 files changed, 30 insertions, 31 deletions
diff --git a/cpukit/include/rtems/confdefs/inittask.h b/cpukit/include/rtems/confdefs/inittask.h index d5ba521bf9..9dbf0b967b 100644 --- a/cpukit/include/rtems/confdefs/inittask.h +++ b/cpukit/include/rtems/confdefs/inittask.h @@ -46,6 +46,10 @@ #ifdef CONFIGURE_INIT +#define _CONFIGURE_ASSERT_NOT_NULL( _type, _value ) \ + ( ( _value ) != NULL ? ( _value ) : \ + ( _type ) sizeof( int[ ( _value ) != NULL ? 1 : -1 ] ) ) + #ifdef CONFIGURE_RTEMS_INIT_TASKS_TABLE #include <rtems/confdefs/percpu.h> @@ -94,8 +98,8 @@ extern "C" { #endif /* - * Ignore the following warnings from g++ and clang in the static assertion - * below: + * Ignore the following warnings from g++ and clang in the uses of + * _CONFIGURE_ASSERT_NOT_NULL() below: * * warning: the address of 'void Init()' will never be NULL [-Waddress] * @@ -107,13 +111,6 @@ extern "C" { #pragma GCC diagnostic ignored "-Wpragmas" #pragma GCC diagnostic ignored "-Wtautological-pointer-compare" -RTEMS_STATIC_ASSERT( - CONFIGURE_INIT_TASK_ENTRY_POINT != NULL, - CONFIGURE_INIT_TASK_ENTRY_POINT_MUST_NOT_BE_NULL -); - -#pragma GCC diagnostic pop - #ifdef CONFIGURE_INIT_TASK_CONSTRUCT_STORAGE_SIZE #ifdef CONFIGURE_INIT_TASK_STACK_SIZE @@ -139,7 +136,10 @@ const RTEMS_tasks_User_task_config _RTEMS_tasks_User_task_config = { CONFIGURE_INIT_TASK_INITIAL_MODES, CONFIGURE_INIT_TASK_ATTRIBUTES, }, - CONFIGURE_INIT_TASK_ENTRY_POINT, + _CONFIGURE_ASSERT_NOT_NULL( + rtems_task_entry, + CONFIGURE_INIT_TASK_ENTRY_POINT + ), CONFIGURE_INIT_TASK_ARGUMENTS }; @@ -167,7 +167,10 @@ const rtems_initialization_tasks_table _RTEMS_tasks_User_task_table = { CONFIGURE_INIT_TASK_STACK_SIZE, CONFIGURE_INIT_TASK_PRIORITY, CONFIGURE_INIT_TASK_ATTRIBUTES, - CONFIGURE_INIT_TASK_ENTRY_POINT, + _CONFIGURE_ASSERT_NOT_NULL( + rtems_task_entry, + CONFIGURE_INIT_TASK_ENTRY_POINT + ), CONFIGURE_INIT_TASK_INITIAL_MODES, CONFIGURE_INIT_TASK_ARGUMENTS }; @@ -180,6 +183,8 @@ RTEMS_SYSINIT_ITEM( #endif /* CONFIGURE_INIT_TASK_CONSTRUCT_STORAGE_SIZE */ +#pragma GCC diagnostic pop + #ifdef __cplusplus } #endif diff --git a/cpukit/include/rtems/confdefs/wkspace.h b/cpukit/include/rtems/confdefs/wkspace.h index 39014d7f1d..b37af79411 100644 --- a/cpukit/include/rtems/confdefs/wkspace.h +++ b/cpukit/include/rtems/confdefs/wkspace.h @@ -139,8 +139,8 @@ const uintptr_t _Stack_Space_size = _CONFIGURE_STACK_SPACE_SIZE; #if defined(CONFIGURE_TASK_STACK_ALLOCATOR) \ && defined(CONFIGURE_TASK_STACK_DEALLOCATOR) /* - * Ignore the following warnings from g++ and clang in the static assertions - * below: + * Ignore the following warnings from g++ and clang in the uses of + * _CONFIGURE_ASSERT_NOT_NULL() below: * * warning: the address of 'f()' will never be NULL [-Waddress] * @@ -159,13 +159,11 @@ const uintptr_t _Stack_Space_size = _CONFIGURE_STACK_SPACE_SIZE; #endif #ifdef CONFIGURE_TASK_STACK_ALLOCATOR_INIT - RTEMS_STATIC_ASSERT( - CONFIGURE_TASK_STACK_ALLOCATOR_INIT != NULL, - CONFIGURE_TASK_STACK_ALLOCATOR_INIT_MUST_NOT_BE_NULL - ); - const Stack_Allocator_initialize _Stack_Allocator_initialize = - CONFIGURE_TASK_STACK_ALLOCATOR_INIT; + _CONFIGURE_ASSERT_NOT_NULL( + Stack_Allocator_initialize, + CONFIGURE_TASK_STACK_ALLOCATOR_INIT + ); RTEMS_SYSINIT_ITEM( _Stack_Allocator_do_initialize, @@ -174,21 +172,17 @@ const uintptr_t _Stack_Space_size = _CONFIGURE_STACK_SPACE_SIZE; ); #endif - RTEMS_STATIC_ASSERT( - CONFIGURE_TASK_STACK_ALLOCATOR != NULL, - CONFIGURE_TASK_STACK_ALLOCATOR_MUST_NOT_BE_NULL - ); - const Stack_Allocator_allocate _Stack_Allocator_allocate = - CONFIGURE_TASK_STACK_ALLOCATOR; - - RTEMS_STATIC_ASSERT( - CONFIGURE_TASK_STACK_DEALLOCATOR != NULL, - CONFIGURE_TASK_STACK_DEALLOCATOR_MUST_NOT_BE_NULL - ); + _CONFIGURE_ASSERT_NOT_NULL( + Stack_Allocator_allocate, + CONFIGURE_TASK_STACK_ALLOCATOR + ); const Stack_Allocator_free _Stack_Allocator_free = - CONFIGURE_TASK_STACK_DEALLOCATOR; + _CONFIGURE_ASSERT_NOT_NULL( + Stack_Allocator_free, + CONFIGURE_TASK_STACK_DEALLOCATOR + ); #pragma GCC diagnostic pop #elif defined(CONFIGURE_TASK_STACK_ALLOCATOR) \ |