[rtems commit] score: Avoid dead code in global construction
Sebastian Huber
sebh at rtems.org
Fri Jan 8 08:34:48 UTC 2016
Module: rtems
Branch: master
Commit: 44e987192e47910b8551a8f9409e9cd6133695d1
Changeset: http://git.rtems.org/rtems/commit/?id=44e987192e47910b8551a8f9409e9cd6133695d1
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Tue Dec 22 09:40:48 2015 +0100
score: Avoid dead code in global construction
Update #2514.
---
cpukit/posix/src/pthreadinitthreads.c | 11 ++++++++++-
cpukit/rtems/src/taskinitusers.c | 11 ++++++++++-
cpukit/score/include/rtems/score/threadimpl.h | 2 +-
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 7804c18..5accf39 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 46d0af3..f5c2f82 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 c61dd89..abdd7e6 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 c7c10d9..56a6df1 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;
}
More information about the vc
mailing list