diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-12-22 09:40:48 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-01-08 09:03:33 +0100 |
commit | 44e987192e47910b8551a8f9409e9cd6133695d1 (patch) | |
tree | 358f37aee1e92ae5a67ee17742b91cf334167f50 | |
parent | score: Add fatal errors for NULL entry init tasks (diff) | |
download | rtems-44e987192e47910b8551a8f9409e9cd6133695d1.tar.bz2 |
score: Avoid dead code in global construction
Update #2514.
-rw-r--r-- | cpukit/posix/src/pthreadinitthreads.c | 11 | ||||
-rw-r--r-- | cpukit/rtems/src/taskinitusers.c | 11 | ||||
-rw-r--r-- | cpukit/score/include/rtems/score/threadimpl.h | 2 | ||||
-rw-r--r-- | cpukit/score/src/threadglobalconstruction.c | 18 |
4 files changed, 22 insertions, 20 deletions
diff --git a/cpukit/posix/src/pthreadinitthreads.c b/cpukit/posix/src/pthreadinitthreads.c index 7804c1875f..5accf3907c 100644 --- a/cpukit/posix/src/pthreadinitthreads.c +++ b/cpukit/posix/src/pthreadinitthreads.c @@ -35,6 +35,15 @@ #include <rtems/posix/config.h> #include <rtems/rtems/config.h> +static void *_POSIX_Global_construction( void *arg ) +{ + Thread_Entry entry_point = (Thread_Entry) Configuration_POSIX_API + .User_initialization_threads_table[ 0 ].thread_entry; + + (void) arg; + _Thread_Global_construction( entry_point ); +} + void _POSIX_Threads_Initialize_user_threads_body(void) { int eno; @@ -84,7 +93,7 @@ void _POSIX_Threads_Initialize_user_threads_body(void) if ( register_global_construction ) { register_global_construction = false; - thread_entry = (void *(*)(void *)) _Thread_Global_construction; + thread_entry = _POSIX_Global_construction; } eno = pthread_create( diff --git a/cpukit/rtems/src/taskinitusers.c b/cpukit/rtems/src/taskinitusers.c index 46d0af3f70..f5c2f82995 100644 --- a/cpukit/rtems/src/taskinitusers.c +++ b/cpukit/rtems/src/taskinitusers.c @@ -31,6 +31,15 @@ #include <rtems/score/wkspace.h> #include <rtems/score/apiext.h> +static void _RTEMS_Global_construction( rtems_task_argument arg ) +{ + Thread_Entry entry_point = (Thread_Entry) + Configuration_RTEMS_API.User_initialization_tasks_table[ 0 ].entry_point; + + (void) arg; + _Thread_Global_construction( entry_point ); +} + /* * _RTEMS_tasks_Initialize_user_tasks_body * @@ -92,7 +101,7 @@ void _RTEMS_tasks_Initialize_user_tasks_body( void ) if ( register_global_construction ) { register_global_construction = false; - entry_point = (rtems_task_entry) _Thread_Global_construction; + entry_point = _RTEMS_Global_construction; } return_value = rtems_task_start( diff --git a/cpukit/score/include/rtems/score/threadimpl.h b/cpukit/score/include/rtems/score/threadimpl.h index c61dd89f12..abdd7e6f57 100644 --- a/cpukit/score/include/rtems/score/threadimpl.h +++ b/cpukit/score/include/rtems/score/threadimpl.h @@ -325,7 +325,7 @@ void _Thread_Handler( void ); * the first POSIX initialization thread in case no RTEMS initialization tasks * are present. */ -void *_Thread_Global_construction( void ); +void _Thread_Global_construction( Thread_Entry entry_point ) RTEMS_NO_RETURN; /** * @brief Ended the delay of a thread. diff --git a/cpukit/score/src/threadglobalconstruction.c b/cpukit/score/src/threadglobalconstruction.c index c7c10d9143..56a6df11a9 100644 --- a/cpukit/score/src/threadglobalconstruction.c +++ b/cpukit/score/src/threadglobalconstruction.c @@ -44,10 +44,9 @@ #define EXECUTE_GLOBAL_CONSTRUCTORS #endif -void *_Thread_Global_construction( void ) +void _Thread_Global_construction( Thread_Entry entry_point ) { Thread_Control *executing; - Thread_Entry entry_point; #if defined(EXECUTE_GLOBAL_CONSTRUCTORS) /* @@ -58,19 +57,6 @@ void *_Thread_Global_construction( void ) INIT_NAME(); #endif -#if defined(RTEMS_POSIX_API) - if ( Configuration_RTEMS_API.number_of_initialization_tasks > 0 ) { -#endif - entry_point = (Thread_Entry) - Configuration_RTEMS_API.User_initialization_tasks_table[ 0 ].entry_point; -#if defined(RTEMS_POSIX_API) - } else { - entry_point = (Thread_Entry) - Configuration_POSIX_API - .User_initialization_threads_table[ 0 ].thread_entry; - } -#endif - _Thread_Disable_dispatch(); executing = _Thread_Executing; @@ -86,6 +72,4 @@ void *_Thread_Global_construction( void ) _Thread_Enable_dispatch(); _Assert_Not_reached(); - - return NULL; } |