score: Fix C/C++ compatibility issue

Only use CPU_Per_CPU_control if it contains at least one filed.  In GNU
C empty structures have a size of zero.  In C++ structures have a
non-zero size.  In case CPU_PER_CPU_CONTROL_SIZE is defined to zero,
then this structure is not used anymore.
This commit is contained in:
Sebastian Huber
2016-09-23 06:57:03 +02:00
parent 425f6cfa11
commit 9149c87ec7
18 changed files with 17 additions and 67 deletions
-4
View File
@@ -245,10 +245,6 @@ extern "C" {
*/
/**@{**/
typedef struct {
/* There is no CPU specific per-CPU state */
} CPU_Per_CPU_control;
typedef struct {
#if defined(ARM_MULTILIB_ARCH_V4)
uint32_t register_cpsr;
-4
View File
@@ -368,10 +368,6 @@ extern "C" {
#ifndef ASM
typedef struct {
/* There is no CPU specific per-CPU state */
} CPU_Per_CPU_control;
/**
* @defgroup CPUContext Processor Dependent Context Management
*
@@ -680,9 +680,6 @@ void _CPU_Context_Initialize(
#define CPU_USE_GENERIC_BITFIELD_CODE TRUE
typedef struct {
/* There is no CPU specific per-CPU state */
} CPU_Per_CPU_control;
#endif /* ASM */
/**
-4
View File
@@ -141,10 +141,6 @@ extern "C" {
#ifndef ASM
typedef struct {
/* There is no CPU specific per-CPU state */
} CPU_Per_CPU_control;
/*
* Basic integer context for the i386 family.
*/
-4
View File
@@ -360,10 +360,6 @@ extern "C" {
/* may need to put some structures here. */
typedef struct {
/* There is no CPU specific per-CPU state */
} CPU_Per_CPU_control;
/**
* @defgroup CPUContext Processor Dependent Context Management
*
-4
View File
@@ -383,10 +383,6 @@ extern "C" {
/* may need to put some structures here. */
typedef struct {
/* There is no CPU specific per-CPU state */
} CPU_Per_CPU_control;
/**
* @defgroup CPUContext Processor Dependent Context Management
*
-4
View File
@@ -129,10 +129,6 @@ extern "C" {
/* structures */
typedef struct {
/* There is no CPU specific per-CPU state */
} CPU_Per_CPU_control;
/*
* Basic integer context for the m68k family.
*/
-4
View File
@@ -361,10 +361,6 @@ extern "C" {
#ifndef ASM
typedef struct {
/* There is no CPU specific per-CPU state */
} CPU_Per_CPU_control;
/* WARNING: If this structure is modified, the constants in cpu.h must be updated. */
#if (__mips == 1) || (__mips == 32)
#define __MIPS_REGISTER_TYPE uint32_t
-4
View File
@@ -297,10 +297,6 @@ extern "C" {
/* may need to put some structures here. */
typedef struct {
/* There is no CPU specific per-CPU state */
} CPU_Per_CPU_control;
/*
* Contexts
*
-4
View File
@@ -113,10 +113,6 @@ extern "C" {
#ifndef ASM
typedef struct {
/* There is no CPU specific per-CPU state */
} CPU_Per_CPU_control;
/**
* @brief Thread register context.
*
+5 -1
View File
@@ -411,7 +411,11 @@ extern "C" {
* @brief The CPU specific per-CPU control.
*
* The CPU port can place here all state information that must be available and
* maintained for each CPU in the system.
* maintained for each processor in the system. This structure must contain at
* least one field for C/C++ compatibility. In GNU C empty structures have a
* size of zero. In C++ structures have a non-zero size. In case
* CPU_PER_CPU_CONTROL_SIZE is defined to zero, then this structure is not
* used.
*/
typedef struct {
/* CPU specific per-CPU state */
-3
View File
@@ -675,9 +675,6 @@ void _CPU_Context_Initialize(
#define CPU_USE_GENERIC_BITFIELD_CODE TRUE
typedef struct {
/* There is no CPU specific per-CPU state */
} CPU_Per_CPU_control;
#endif /* ASM */
#define CPU_SIZEOF_POINTER 4
@@ -228,10 +228,6 @@ extern "C" {
#ifndef ASM
typedef struct {
/* There is no CPU specific per-CPU state */
} CPU_Per_CPU_control;
/*
* Non-volatile context according to E500ABIUG, EABI and 32-bit TLS (according
* to "Power Architecture 32-bit Application Binary Interface Supplement 1.0 -
-4
View File
@@ -268,10 +268,6 @@ extern "C" {
/* may need to put some structures here. */
typedef struct {
/* There is no CPU specific per-CPU state */
} CPU_Per_CPU_control;
/*
* Contexts
*
@@ -220,10 +220,6 @@ extern "C" {
#ifndef ASM
typedef struct {
/* There is no CPU specific per-CPU state */
} CPU_Per_CPU_control;
typedef struct {
uint64_t l0;
uint64_t l1;
-4
View File
@@ -350,10 +350,6 @@ extern "C" {
#define CPU_MAXIMUM_PROCESSORS 32
typedef struct {
/* There is no CPU specific per-CPU state */
} CPU_Per_CPU_control;
/**
* @defgroup CPUContext Processor Dependent Context Management
*
+6 -4
View File
@@ -260,10 +260,12 @@ typedef enum {
* This structure is used to hold per core state information.
*/
typedef struct Per_CPU_Control {
/**
* @brief CPU port specific control.
*/
CPU_Per_CPU_control cpu_per_cpu;
#if CPU_PER_CPU_CONTROL_SIZE > 0
/**
* @brief CPU port specific control.
*/
CPU_Per_CPU_control cpu_per_cpu;
#endif
#if (CPU_ALLOCATE_INTERRUPT_STACK == TRUE) || \
(CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE)
+6 -4
View File
@@ -64,10 +64,12 @@ RTEMS_STATIC_ASSERT(
);
#endif
RTEMS_STATIC_ASSERT(
sizeof( CPU_Per_CPU_control ) == CPU_PER_CPU_CONTROL_SIZE,
CPU_PER_CPU_CONTROL_SIZE
);
#if CPU_PER_CPU_CONTROL_SIZE > 0
RTEMS_STATIC_ASSERT(
sizeof( CPU_Per_CPU_control ) == CPU_PER_CPU_CONTROL_SIZE,
CPU_PER_CPU_CONTROL_SIZE
);
#endif
#if defined( RTEMS_SMP )
RTEMS_STATIC_ASSERT(