From 5b97821bc8583a71e30d6a27bf29961e2c9dc522 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 8 Apr 2021 07:51:38 +0200 Subject: libtest: Fix use of flexible array member Flexible array members must not appear in the middle of a structure. --- cpukit/include/rtems/test.h | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'cpukit/include/rtems/test.h') diff --git a/cpukit/include/rtems/test.h b/cpukit/include/rtems/test.h index 10ff665107..f95433bc7c 100644 --- a/cpukit/include/rtems/test.h +++ b/cpukit/include/rtems/test.h @@ -89,10 +89,8 @@ typedef struct T_fixture_node { #if defined(__GNUC__) || __STDC_VERSION__ >= 199409L #define T_ZERO_LENGTH_ARRAY -#define T_ZERO_LENGTH_ARRAY_EXTENSION(n) (n) #else #define T_ZERO_LENGTH_ARRAY 1 -#define T_ZERO_LENGTH_ARRAY_EXTENSION(n) ((n) - 1) #endif /** @} */ @@ -2434,22 +2432,26 @@ typedef struct { size_t recorded; size_t capacity; uint64_t switches; +} T_thread_switch_header; + +typedef struct { + T_thread_switch_header header; T_thread_switch_event events[T_ZERO_LENGTH_ARRAY]; } T_thread_switch_log; typedef struct { - T_thread_switch_log log; - T_thread_switch_event events[T_ZERO_LENGTH_ARRAY_EXTENSION(2)]; + T_thread_switch_header header; + T_thread_switch_event events[2]; } T_thread_switch_log_2; typedef struct { - T_thread_switch_log log; - T_thread_switch_event events[T_ZERO_LENGTH_ARRAY_EXTENSION(4)]; + T_thread_switch_header header; + T_thread_switch_event events[4]; } T_thread_switch_log_4; typedef struct { - T_thread_switch_log log; - T_thread_switch_event events[T_ZERO_LENGTH_ARRAY_EXTENSION(10)]; + T_thread_switch_header header; + T_thread_switch_event events[10]; } T_thread_switch_log_10; T_thread_switch_log *T_thread_switch_record(T_thread_switch_log *); -- cgit v1.2.3