From c5af8aa0704d52e1d9757b863ed2831282642a56 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 19 Nov 2020 08:40:13 +0100 Subject: config: Simplify task stack allocator init Replace runtime checks with compile time assertions. This makes the INTERNAL_ERROR_BAD_STACK_HOOK obsolete. --- cpukit/include/rtems/confdefs/wkspace.h | 18 ++++++++++++++++++ cpukit/include/rtems/score/interr.h | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) (limited to 'cpukit/include') diff --git a/cpukit/include/rtems/confdefs/wkspace.h b/cpukit/include/rtems/confdefs/wkspace.h index d40194cbec..81d172815e 100644 --- a/cpukit/include/rtems/confdefs/wkspace.h +++ b/cpukit/include/rtems/confdefs/wkspace.h @@ -137,6 +137,12 @@ const uintptr_t _Stack_Space_size = _CONFIGURE_STACK_SPACE_SIZE; #if defined(CONFIGURE_TASK_STACK_ALLOCATOR) \ && defined(CONFIGURE_TASK_STACK_DEALLOCATOR) + /* Ignore potential warnings from the static assertions below */ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Waddress" + #pragma GCC diagnostic ignored "-Wpragmas" + #pragma GCC diagnostic ignored "-Wtautological-pointer-compare" + #ifdef CONFIGURE_TASK_STACK_ALLOCATOR_AVOIDS_WORK_SPACE const bool _Stack_Allocator_avoids_workspace = true; #else @@ -150,9 +156,19 @@ const uintptr_t _Stack_Space_size = _CONFIGURE_STACK_SPACE_SIZE; const Stack_Allocator_initialize _Stack_Allocator_initialize = NULL; #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 + ); + const Stack_Allocator_free _Stack_Allocator_free = CONFIGURE_TASK_STACK_DEALLOCATOR; @@ -161,6 +177,8 @@ const uintptr_t _Stack_Space_size = _CONFIGURE_STACK_SPACE_SIZE; RTEMS_SYSINIT_DIRTY_MEMORY, RTEMS_SYSINIT_ORDER_MIDDLE ); + + #pragma GCC diagnostic pop #elif defined(CONFIGURE_TASK_STACK_ALLOCATOR) \ || defined(CONFIGURE_TASK_STACK_DEALLOCATOR) #error "CONFIGURE_TASK_STACK_ALLOCATOR and CONFIGURE_TASK_STACK_DEALLOCATOR must be both defined or both undefined" diff --git a/cpukit/include/rtems/score/interr.h b/cpukit/include/rtems/score/interr.h index 85767d0bc5..4b06199ae9 100644 --- a/cpukit/include/rtems/score/interr.h +++ b/cpukit/include/rtems/score/interr.h @@ -177,7 +177,7 @@ typedef enum { INTERNAL_ERROR_OUT_OF_GLOBAL_OBJECTS = 11, INTERNAL_ERROR_OUT_OF_PROXIES = 12, INTERNAL_ERROR_INVALID_GLOBAL_ID = 13, - INTERNAL_ERROR_BAD_STACK_HOOK = 14, + /* INTERNAL_ERROR_BAD_STACK_HOOK = 14, */ /* INTERNAL_ERROR_BAD_ATTRIBUTES = 15, */ /* INTERNAL_ERROR_IMPLEMENTATION_KEY_CREATE_INCONSISTENCY = 16, */ /* INTERNAL_ERROR_IMPLEMENTATION_BLOCKING_OPERATION_CANCEL = 17, */ -- cgit v1.2.3