summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2020-11-19 15:30:17 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-11-26 11:10:21 +0100
commitbc175a1cabdccfc28deee3ae67ff5e9a0b5aef49 (patch)
treed581896d8efcab8b471502a9b79c541363509002 /cpukit
parentconfig: Clarify the use of pragmas (diff)
downloadrtems-bc175a1cabdccfc28deee3ae67ff5e9a0b5aef49.tar.bz2
Avoid INTERNAL_ERROR_RTEMS_INIT_TASK_ENTRY_IS_NULL
Replace a runtime check with a compile time assertion. This makes the INTERNAL_ERROR_RTEMS_INIT_TASK_ENTRY_IS_NULL obsolete. Update #4181.
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/include/rtems/confdefs/inittask.h21
-rw-r--r--cpukit/include/rtems/score/interr.h2
-rw-r--r--cpukit/rtems/src/taskinitusers.c8
3 files changed, 23 insertions, 8 deletions
diff --git a/cpukit/include/rtems/confdefs/inittask.h b/cpukit/include/rtems/confdefs/inittask.h
index a91b9a5917..08eddc0334 100644
--- a/cpukit/include/rtems/confdefs/inittask.h
+++ b/cpukit/include/rtems/confdefs/inittask.h
@@ -100,6 +100,27 @@ extern "C" {
#define CONFIGURE_INIT_TASK_ARGUMENTS 0
#endif
+/*
+ * Ignore the following warnings from g++ and clang in the static assertion
+ * below:
+ *
+ * warning: the address of 'void Init()' will never be NULL [-Waddress]
+ *
+ * warning: comparison of function 'Init' not equal to a null pointer is always
+ * true [-Wtautological-pointer-compare]
+ */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Waddress"
+#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
+
const rtems_initialization_tasks_table _RTEMS_tasks_User_task_table = {
CONFIGURE_INIT_TASK_NAME,
CONFIGURE_INIT_TASK_STACK_SIZE,
diff --git a/cpukit/include/rtems/score/interr.h b/cpukit/include/rtems/score/interr.h
index 4b06199ae9..b1f1061c82 100644
--- a/cpukit/include/rtems/score/interr.h
+++ b/cpukit/include/rtems/score/interr.h
@@ -189,7 +189,7 @@ typedef enum {
INTERNAL_ERROR_NO_MEMORY_FOR_HEAP = 23,
INTERNAL_ERROR_CPU_ISR_INSTALL_VECTOR = 24,
INTERNAL_ERROR_RESOURCE_IN_USE = 25,
- INTERNAL_ERROR_RTEMS_INIT_TASK_ENTRY_IS_NULL = 26,
+ /* INTERNAL_ERROR_RTEMS_INIT_TASK_ENTRY_IS_NULL = 26, */
/* INTERNAL_ERROR_POSIX_INIT_THREAD_ENTRY_IS_NULL = 27, */
INTERNAL_ERROR_THREAD_QUEUE_DEADLOCK = 28,
INTERNAL_ERROR_THREAD_QUEUE_ENQUEUE_STICKY_FROM_BAD_STATE = 29,
diff --git a/cpukit/rtems/src/taskinitusers.c b/cpukit/rtems/src/taskinitusers.c
index 0b23d8bc86..f21c061670 100644
--- a/cpukit/rtems/src/taskinitusers.c
+++ b/cpukit/rtems/src/taskinitusers.c
@@ -29,7 +29,6 @@ void _RTEMS_tasks_Initialize_user_task( void )
rtems_id id;
rtems_status_code return_value;
const rtems_initialization_tasks_table *user_task;
- rtems_task_entry entry_point;
user_task = &_RTEMS_tasks_User_task_table;
return_value = rtems_task_create(
@@ -44,14 +43,9 @@ void _RTEMS_tasks_Initialize_user_task( void )
_Internal_error( INTERNAL_ERROR_RTEMS_INIT_TASK_CREATE_FAILED );
}
- entry_point = user_task->entry_point;
- if ( entry_point == NULL ) {
- _Internal_error( INTERNAL_ERROR_RTEMS_INIT_TASK_ENTRY_IS_NULL );
- }
-
return_value = rtems_task_start(
id,
- entry_point,
+ user_task->entry_point,
user_task->argument
);
_Assert( rtems_is_status_successful( return_value ) );