[PATCH 13/13] score: Avoid SCORE_EXTERN

Sebastian Huber sebastian.huber at embedded-brains.de
Thu Feb 4 06:37:43 UTC 2016


Delete SCORE_INIT.  This finally removes the

some.h:
  #ifndef SOME_XYZ_EXTERN
  #define SOME_XYZ_EXTERN extern
  #endif
  SOME_XYZ_EXTERN type xyz;

some_xyz.c:
  #define SOME_XYZ_EXTERN
  #include <some.h>

pattern in favour of

some.h:
  extern type xyz;

some_xyz.c
  #include <some.h>
  type xyz;

Update #2559.
---
 cpukit/sapi/src/exinit.c                        | 15 ++++++++-------
 cpukit/score/include/rtems/score/apimutex.h     |  4 ++--
 cpukit/score/include/rtems/score/basedefs.h     | 14 --------------
 cpukit/score/include/rtems/score/copyrt.h       |  6 ------
 cpukit/score/include/rtems/score/mpciimpl.h     | 10 +++++-----
 cpukit/score/include/rtems/score/objectimpl.h   |  4 ++--
 cpukit/score/include/rtems/score/objectmp.h     |  4 ++--
 cpukit/score/include/rtems/score/smp.h          |  2 +-
 cpukit/score/include/rtems/score/sysstate.h     |  2 +-
 cpukit/score/include/rtems/score/threadimpl.h   |  6 +++---
 cpukit/score/include/rtems/score/threadmp.h     |  4 ++--
 cpukit/score/include/rtems/score/watchdogimpl.h |  4 ++--
 cpukit/score/include/rtems/score/wkspace.h      |  2 +-
 cpukit/score/src/mpci.c                         | 10 ++++++++++
 cpukit/score/src/objectmp.c                     |  8 ++++++++
 cpukit/score/src/smp.c                          |  2 ++
 cpukit/score/src/thread.c                       |  2 ++
 cpukit/score/src/threaddispatch.c               |  8 ++++++++
 cpukit/score/src/threadmp.c                     |  4 ++++
 cpukit/score/src/watchdog.c                     |  4 ++++
 cpukit/score/src/wkspace.c                      |  2 ++
 21 files changed, 69 insertions(+), 48 deletions(-)

diff --git a/cpukit/sapi/src/exinit.c b/cpukit/sapi/src/exinit.c
index 77633a2..7df2316 100644
--- a/cpukit/sapi/src/exinit.c
+++ b/cpukit/sapi/src/exinit.c
@@ -19,13 +19,6 @@
 #include "config.h"
 #endif
 
-/*
- *  SCORE_INIT is defined so all of the super core
- *  data will be included in this object file.
- */
-
-#define SCORE_INIT
-
 #include <rtems/system.h>
 #include <rtems/config.h>
 #include <rtems/extensionimpl.h>
@@ -48,6 +41,10 @@
 #include <rtems/score/watchdogimpl.h>
 #include <rtems/score/wkspace.h>
 
+const char _Copyright_Notice[] =
+"COPYRIGHT (c) 1989-2008.\n\
+On-Line Applications Research Corporation (OAR).\n";
+
 static Objects_Information *
 _Internal_Objects[ OBJECTS_INTERNAL_CLASSES_LAST + 1 ];
 
@@ -62,6 +59,10 @@ Objects_Information **_Objects_Information_table[ OBJECTS_APIS_LAST + 1 ] = {
   &_POSIX_Objects[ 0 ]
 };
 
+API_Mutex_Control *_RTEMS_Allocator_Mutex;
+
+API_Mutex_Control *_Once_Mutex;
+
 static void rtems_initialize_data_structures(void)
 {
   /*
diff --git a/cpukit/score/include/rtems/score/apimutex.h b/cpukit/score/include/rtems/score/apimutex.h
index 615f60b..86561aa 100644
--- a/cpukit/score/include/rtems/score/apimutex.h
+++ b/cpukit/score/include/rtems/score/apimutex.h
@@ -113,7 +113,7 @@ bool _API_Mutex_Is_owner( const API_Mutex_Control *mutex );
  *  This points to the API Mutex instance used to ensure that only
  *  one thread at a time is allocating or freeing memory.
  */
-SCORE_EXTERN API_Mutex_Control *_RTEMS_Allocator_Mutex;
+extern API_Mutex_Control *_RTEMS_Allocator_Mutex;
 
 static inline void _RTEMS_Lock_allocator( void )
 {
@@ -130,7 +130,7 @@ static inline bool _RTEMS_Allocator_is_owner( void )
   return _API_Mutex_Is_owner( _RTEMS_Allocator_Mutex );
 }
 
-SCORE_EXTERN API_Mutex_Control *_Once_Mutex;
+extern API_Mutex_Control *_Once_Mutex;
 
 static inline void _Once_Lock( void )
 {
diff --git a/cpukit/score/include/rtems/score/basedefs.h b/cpukit/score/include/rtems/score/basedefs.h
index ef36e29..facaed9 100644
--- a/cpukit/score/include/rtems/score/basedefs.h
+++ b/cpukit/score/include/rtems/score/basedefs.h
@@ -68,20 +68,6 @@
 #endif
 
 /**
- *  The following ensures that all data is declared in the space
- *  of the initialization routine for either the Initialization Manager
- *  or the initialization file for the appropriate API.  It is
- *  referenced as "external" in every other file.
- */
-#ifdef SCORE_INIT
-  #undef  SCORE_EXTERN
-  #define SCORE_EXTERN
-#else
-  #undef  SCORE_EXTERN
-  #define SCORE_EXTERN  extern
-#endif
-
-/**
  *  The following (in conjunction with compiler arguments) are used
  *  to choose between the use of static inline functions and macro
  *  functions.   The static inline implementation allows better
diff --git a/cpukit/score/include/rtems/score/copyrt.h b/cpukit/score/include/rtems/score/copyrt.h
index c3757bf..17c925a 100644
--- a/cpukit/score/include/rtems/score/copyrt.h
+++ b/cpukit/score/include/rtems/score/copyrt.h
@@ -33,13 +33,7 @@ extern "C" {
 /**
  *  This is the copyright string for RTEMS.
  */
-#ifdef SCORE_INIT
-const char _Copyright_Notice[] =
-"COPYRIGHT (c) 1989-2008.\n\
-On-Line Applications Research Corporation (OAR).\n";
-#else
 extern const char _Copyright_Notice[];
-#endif
 
 #ifdef __cplusplus
 }
diff --git a/cpukit/score/include/rtems/score/mpciimpl.h b/cpukit/score/include/rtems/score/mpciimpl.h
index 33cb656..8d19956 100644
--- a/cpukit/score/include/rtems/score/mpciimpl.h
+++ b/cpukit/score/include/rtems/score/mpciimpl.h
@@ -75,13 +75,13 @@ typedef struct {
  *  The following thread queue is used to maintain a list of tasks
  *  which currently have outstanding remote requests.
  */
-SCORE_EXTERN Thread_queue_Control _MPCI_Remote_blocked_threads;
+extern Thread_queue_Control _MPCI_Remote_blocked_threads;
 
 /**
  *  The following define the internal pointers to the user's
  *  configuration information.
  */
-SCORE_EXTERN MPCI_Control *_MPCI_table;
+extern MPCI_Control *_MPCI_table;
 
 /**
  *  @brief Pointer to MP thread control block.
@@ -90,14 +90,14 @@ SCORE_EXTERN MPCI_Control *_MPCI_table;
  *  thread is executing so that a proxy can be allocated instead of
  *  blocking the multiprocessing receive thread.
  */
-SCORE_EXTERN Thread_Control *_MPCI_Receive_server_tcb;
+extern Thread_Control *_MPCI_Receive_server_tcb;
 
 /**
  *  The following table contains the process packet routines provided
  *  by each object that supports MP operations.
  */
-SCORE_EXTERN MPCI_Packet_processor
-               _MPCI_Packet_processors[MP_PACKET_CLASSES_LAST+1];
+extern MPCI_Packet_processor
+_MPCI_Packet_processors[ MP_PACKET_CLASSES_LAST + 1 ];
 
 /**
  *  This routine registers the MPCI packet processor for the
diff --git a/cpukit/score/include/rtems/score/objectimpl.h b/cpukit/score/include/rtems/score/objectimpl.h
index 4f49ef5..f7bd69a 100644
--- a/cpukit/score/include/rtems/score/objectimpl.h
+++ b/cpukit/score/include/rtems/score/objectimpl.h
@@ -178,7 +178,7 @@ typedef struct {
  *  The following is referenced to the node number of the local node.
  */
 #if defined(RTEMS_MULTIPROCESSING)
-SCORE_EXTERN uint16_t       _Objects_Local_node;
+extern uint16_t _Objects_Local_node;
 #else
 #define _Objects_Local_node ((uint16_t)1)
 #endif
@@ -187,7 +187,7 @@ SCORE_EXTERN uint16_t       _Objects_Local_node;
  *  The following is referenced to the number of nodes in the system.
  */
 #if defined(RTEMS_MULTIPROCESSING)
-SCORE_EXTERN uint16_t    _Objects_Maximum_nodes;
+extern uint16_t _Objects_Maximum_nodes;
 #else
 #define _Objects_Maximum_nodes 1
 #endif
diff --git a/cpukit/score/include/rtems/score/objectmp.h b/cpukit/score/include/rtems/score/objectmp.h
index 934b398..a78ca82 100644
--- a/cpukit/score/include/rtems/score/objectmp.h
+++ b/cpukit/score/include/rtems/score/objectmp.h
@@ -173,13 +173,13 @@ void _Objects_MP_Is_remote (
 /**
  *  This is the maximum number of global objects configured.
  */
-SCORE_EXTERN uint32_t       _Objects_MP_Maximum_global_objects;
+extern uint32_t _Objects_MP_Maximum_global_objects;
 
 /**
  *  The following chain header is used to manage the set of
  *  inactive global object control blocks.
  */
-SCORE_EXTERN Chain_Control  _Objects_MP_Inactive_global_objects;
+extern Chain_Control _Objects_MP_Inactive_global_objects;
 
 /**
  * This function allocates a Global Object control block.
diff --git a/cpukit/score/include/rtems/score/smp.h b/cpukit/score/include/rtems/score/smp.h
index 8886a57..469025e 100644
--- a/cpukit/score/include/rtems/score/smp.h
+++ b/cpukit/score/include/rtems/score/smp.h
@@ -35,7 +35,7 @@ extern "C" {
  */
 
 #if defined( RTEMS_SMP )
-  SCORE_EXTERN uint32_t _SMP_Processor_count;
+  extern uint32_t _SMP_Processor_count;
 
   static inline uint32_t _SMP_Get_processor_count( void )
   {
diff --git a/cpukit/score/include/rtems/score/sysstate.h b/cpukit/score/include/rtems/score/sysstate.h
index 02ac995..0e01927 100644
--- a/cpukit/score/include/rtems/score/sysstate.h
+++ b/cpukit/score/include/rtems/score/sysstate.h
@@ -64,7 +64,7 @@ typedef enum {
 #define SYSTEM_STATE_CODES_LAST SYSTEM_STATE_TERMINATED
 
 #if defined(RTEMS_MULTIPROCESSING)
-SCORE_EXTERN bool _System_state_Is_multiprocessing;
+extern bool _System_state_Is_multiprocessing;
 #endif
 
 extern System_state_Codes _System_state_Current;
diff --git a/cpukit/score/include/rtems/score/threadimpl.h b/cpukit/score/include/rtems/score/threadimpl.h
index 4177a97..1377543 100644
--- a/cpukit/score/include/rtems/score/threadimpl.h
+++ b/cpukit/score/include/rtems/score/threadimpl.h
@@ -53,7 +53,7 @@ extern "C" {
 /**
  *  Self for the GNU Ada Run-Time
  */
-SCORE_EXTERN void *rtems_ada_self;
+extern void *rtems_ada_self;
 
 typedef struct {
   Objects_Information Objects;
@@ -65,14 +65,14 @@ typedef struct {
  *  The following defines the information control block used to
  *  manage this class of objects.
  */
-SCORE_EXTERN Thread_Information _Thread_Internal_information;
+extern Thread_Information _Thread_Internal_information;
 
 /**
  *  The following points to the thread whose floating point
  *  context is currently loaded.
  */
 #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
-SCORE_EXTERN Thread_Control *_Thread_Allocated_fp;
+extern Thread_Control *_Thread_Allocated_fp;
 #endif
 
 #define THREAD_CHAIN_NODE_TO_THREAD( node ) \
diff --git a/cpukit/score/include/rtems/score/threadmp.h b/cpukit/score/include/rtems/score/threadmp.h
index 27b6989..d287780 100644
--- a/cpukit/score/include/rtems/score/threadmp.h
+++ b/cpukit/score/include/rtems/score/threadmp.h
@@ -80,14 +80,14 @@ Thread_Control *_Thread_MP_Find_proxy (
  *
  * The following chain is used to manage the active set proxies.
  */
-SCORE_EXTERN Chain_Control _Thread_MP_Active_proxies;
+extern Chain_Control _Thread_MP_Active_proxies;
 
 /**
  *  @brief Manage the inactive set of MP proxies.
  *
  * The following chain is used to manage the inactive set of proxies.
  */
-SCORE_EXTERN Chain_Control _Thread_MP_Inactive_proxies;
+extern Chain_Control _Thread_MP_Inactive_proxies;
 
 /**
  * This function returns true if the thread in question is the
diff --git a/cpukit/score/include/rtems/score/watchdogimpl.h b/cpukit/score/include/rtems/score/watchdogimpl.h
index 0e04f64..8064c77 100644
--- a/cpukit/score/include/rtems/score/watchdogimpl.h
+++ b/cpukit/score/include/rtems/score/watchdogimpl.h
@@ -96,14 +96,14 @@ typedef struct {
  *
  *  This is the watchdog chain which is managed at ticks.
  */
-SCORE_EXTERN Watchdog_Header _Watchdog_Ticks_header;
+extern Watchdog_Header _Watchdog_Ticks_header;
 
 /**
  *  @brief Watchdog chain which is managed at second boundaries.
  *
  *  This is the watchdog chain which is managed at second boundaries.
  */
-SCORE_EXTERN Watchdog_Header _Watchdog_Seconds_header;
+extern Watchdog_Header _Watchdog_Seconds_header;
 
 RTEMS_INLINE_ROUTINE void _Watchdog_Acquire(
   Watchdog_Header  *header,
diff --git a/cpukit/score/include/rtems/score/wkspace.h b/cpukit/score/include/rtems/score/wkspace.h
index 18b01d3..3676ff2 100644
--- a/cpukit/score/include/rtems/score/wkspace.h
+++ b/cpukit/score/include/rtems/score/wkspace.h
@@ -43,7 +43,7 @@ extern "C" {
  *  This is the heap control structure used to manage the RTEMS Executive
  *  Workspace.
  */
-SCORE_EXTERN Heap_Control _Workspace_Area;
+extern Heap_Control _Workspace_Area;
 
 /**
  * @brief Initilize workspace handler.
diff --git a/cpukit/score/src/mpci.c b/cpukit/score/src/mpci.c
index 051366d..c191bbe 100644
--- a/cpukit/score/src/mpci.c
+++ b/cpukit/score/src/mpci.c
@@ -35,6 +35,8 @@ RTEMS_STATIC_ASSERT(
   MPCI_Internal_packet
 );
 
+bool _System_state_Is_multiprocessing;
+
 rtems_multiprocessing_table *_Configuration_MP_table;
 
 const rtems_multiprocessing_table
@@ -52,6 +54,14 @@ const rtems_multiprocessing_table
  */
 CORE_semaphore_Control _MPCI_Semaphore;
 
+Thread_queue_Control _MPCI_Remote_blocked_threads;
+
+MPCI_Control *_MPCI_table;
+
+Thread_Control *_MPCI_Receive_server_tcb;
+
+MPCI_Packet_processor _MPCI_Packet_processors[ MP_PACKET_CLASSES_LAST + 1 ];
+
 static void _MPCI_Handler_early_initialization( void )
 {
   /*
diff --git a/cpukit/score/src/objectmp.c b/cpukit/score/src/objectmp.c
index fca238b..d23e6ad 100644
--- a/cpukit/score/src/objectmp.c
+++ b/cpukit/score/src/objectmp.c
@@ -24,6 +24,14 @@
 #include <rtems/score/wkspace.h>
 #include <rtems/config.h>
 
+uint16_t _Objects_Local_node;
+
+uint16_t _Objects_Maximum_nodes;
+
+uint32_t _Objects_MP_Maximum_global_objects;
+
+Chain_Control _Objects_MP_Inactive_global_objects;
+
 void _Objects_MP_Handler_early_initialization(void)
 {
   uint32_t   node;
diff --git a/cpukit/score/src/smp.c b/cpukit/score/src/smp.c
index a64287e..a5562eb 100644
--- a/cpukit/score/src/smp.c
+++ b/cpukit/score/src/smp.c
@@ -29,6 +29,8 @@
   #error "deferred FP switch not implemented for SMP"
 #endif
 
+uint32_t _SMP_Processor_count;
+
 static void _SMP_Start_processors( uint32_t cpu_count )
 {
   uint32_t cpu_index_self = _SMP_Get_current_processor();
diff --git a/cpukit/score/src/thread.c b/cpukit/score/src/thread.c
index 1ad7a59..68a728c 100644
--- a/cpukit/score/src/thread.c
+++ b/cpukit/score/src/thread.c
@@ -42,6 +42,8 @@ THREAD_OFFSET_ASSERT( Timer );
 THREAD_OFFSET_ASSERT( receive_packet );
 #endif
 
+Thread_Information _Thread_Internal_information;
+
 void _Thread_Initialize_information(
   Thread_Information  *information,
   Objects_APIs         the_api,
diff --git a/cpukit/score/src/threaddispatch.c b/cpukit/score/src/threaddispatch.c
index dc3c796..1b36c93 100644
--- a/cpukit/score/src/threaddispatch.c
+++ b/cpukit/score/src/threaddispatch.c
@@ -29,6 +29,14 @@
 #include <rtems/score/wkspace.h>
 #include <rtems/config.h>
 
+#if __RTEMS_ADA__
+void *rtems_ada_self;
+#endif
+
+#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
+Thread_Control *_Thread_Allocated_fp;
+#endif
+
 CHAIN_DEFINE_EMPTY( _User_extensions_Switches_list );
 
 static Thread_Action *_Thread_Get_post_switch_action(
diff --git a/cpukit/score/src/threadmp.c b/cpukit/score/src/threadmp.c
index 02f4f40..a084624 100644
--- a/cpukit/score/src/threadmp.c
+++ b/cpukit/score/src/threadmp.c
@@ -22,6 +22,10 @@
 #include <rtems/score/isrlevel.h>
 #include <rtems/score/wkspace.h>
 
+Chain_Control _Thread_MP_Active_proxies;
+
+Chain_Control _Thread_MP_Inactive_proxies;
+
 void _Thread_MP_Handler_initialization (
   uint32_t    maximum_proxies
 )
diff --git a/cpukit/score/src/watchdog.c b/cpukit/score/src/watchdog.c
index 11d3cf2..8d172fb 100644
--- a/cpukit/score/src/watchdog.c
+++ b/cpukit/score/src/watchdog.c
@@ -23,6 +23,10 @@
 
 #include <rtems/score/watchdogimpl.h>
 
+Watchdog_Header _Watchdog_Ticks_header;
+
+Watchdog_Header _Watchdog_Seconds_header;
+
 void _Watchdog_Handler_initialization( void )
 {
   _Watchdog_Ticks_since_boot = 0;
diff --git a/cpukit/score/src/wkspace.c b/cpukit/score/src/wkspace.c
index 94ce5cb..b53138d 100644
--- a/cpukit/score/src/wkspace.c
+++ b/cpukit/score/src/wkspace.c
@@ -32,6 +32,8 @@
   #include <rtems/bspIo.h>
 #endif
 
+Heap_Control _Workspace_Area;
+
 static uint32_t _Get_maximum_thread_count(void)
 {
   uint32_t thread_count = 0;
-- 
1.8.4.5




More information about the devel mailing list