[rtems commit] validation: Replace enum Event with defines

Sebastian Huber sebh at rtems.org
Fri Mar 17 14:38:21 UTC 2023


Module:    rtems
Branch:    master
Commit:    74a6b33f3b48f8f2bd1b8e9a5026803965123eea
Changeset: http://git.rtems.org/rtems/commit/?id=74a6b33f3b48f8f2bd1b8e9a5026803965123eea

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Mar 17 15:52:33 2023 +0100

validation: Replace enum Event with defines

There is a Doxygen limitation that all compound names (enum, struct,
class, union, group) within a project must be unique.

Update #3716.

---

 testsuites/validation/tc-event-performance.c       |  9 +++---
 testsuites/validation/tc-message-performance.c     | 18 ++++++------
 testsuites/validation/tc-ratemon-timeout.c         | 12 ++++----
 testsuites/validation/tc-sched-smp.c               | 27 +++++++++++-------
 .../validation/tc-scheduler-remove-processor.c     | 32 ++++++++++++++--------
 testsuites/validation/tc-score-smp-thread.c        | 24 +++++++++-------
 .../validation/tc-score-thread-smp-one-cpu.c       |  6 ++--
 testsuites/validation/tc-sem-performance.c         | 18 ++++++------
 testsuites/validation/tc-task-performance.c        | 12 ++++----
 9 files changed, 90 insertions(+), 68 deletions(-)

diff --git a/testsuites/validation/tc-event-performance.c b/testsuites/validation/tc-event-performance.c
index 7018adaee1..de29cdd1b5 100644
--- a/testsuites/validation/tc-event-performance.c
+++ b/testsuites/validation/tc-event-performance.c
@@ -107,12 +107,11 @@ typedef struct {
 static RtemsEventValPerf_Context
   RtemsEventValPerf_Instance;
 
-typedef RtemsEventValPerf_Context Context;
+#define EVENT_END RTEMS_EVENT_0
+
+#define EVENT_OTHER RTEMS_EVENT_1
 
-typedef enum {
-  EVENT_END = RTEMS_EVENT_0,
-  EVENT_OTHER = RTEMS_EVENT_1
-} Event;
+typedef RtemsEventValPerf_Context Context;
 
 static void Send( const Context *ctx, rtems_event_set events )
 {
diff --git a/testsuites/validation/tc-message-performance.c b/testsuites/validation/tc-message-performance.c
index 5a33d1a148..5d3e0527e0 100644
--- a/testsuites/validation/tc-message-performance.c
+++ b/testsuites/validation/tc-message-performance.c
@@ -121,15 +121,17 @@ static RtemsMessageValPerf_Context
 
 #define MAXIMUM_MESSAGE_SIZE 8
 
-typedef RtemsMessageValPerf_Context Context;
+#define EVENT_END RTEMS_EVENT_0
+
+#define EVENT_SEND RTEMS_EVENT_1
+
+#define EVENT_SEND_END RTEMS_EVENT_2
 
-typedef enum {
-  EVENT_END = RTEMS_EVENT_0,
-  EVENT_SEND = RTEMS_EVENT_1,
-  EVENT_SEND_END = RTEMS_EVENT_2,
-  EVENT_RECEIVE = RTEMS_EVENT_3,
-  EVENT_RECEIVE_END = RTEMS_EVENT_4
-} Event;
+#define EVENT_RECEIVE RTEMS_EVENT_3
+
+#define EVENT_RECEIVE_END RTEMS_EVENT_4
+
+typedef RtemsMessageValPerf_Context Context;
 
 static RTEMS_MESSAGE_QUEUE_BUFFER( MAXIMUM_MESSAGE_SIZE )
   storage_area[ MAXIMUM_PENDING_MESSAGES ];
diff --git a/testsuites/validation/tc-ratemon-timeout.c b/testsuites/validation/tc-ratemon-timeout.c
index e6f56b95cf..e26b996d3d 100644
--- a/testsuites/validation/tc-ratemon-timeout.c
+++ b/testsuites/validation/tc-ratemon-timeout.c
@@ -280,13 +280,13 @@ static const char * const * const RtemsRatemonReqTimeout_PreDesc[] = {
   NULL
 };
 
-typedef RtemsRatemonReqTimeout_Context Context;
+#define EVENT_RESET RTEMS_EVENT_0
 
-typedef enum {
-  EVENT_RESET = RTEMS_EVENT_0,
-  EVENT_PERIOD_WAIT = RTEMS_EVENT_1,
-  EVENT_PERIOD_OTHER = RTEMS_EVENT_2
-} Event;
+#define EVENT_PERIOD_WAIT RTEMS_EVENT_1
+
+#define EVENT_PERIOD_OTHER RTEMS_EVENT_2
+
+typedef RtemsRatemonReqTimeout_Context Context;
 
 static void Tick( void *arg )
 {
diff --git a/testsuites/validation/tc-sched-smp.c b/testsuites/validation/tc-sched-smp.c
index 4d68ce6818..3aac639f23 100644
--- a/testsuites/validation/tc-sched-smp.c
+++ b/testsuites/validation/tc-sched-smp.c
@@ -305,18 +305,25 @@ typedef struct {
 static ScoreSchedSmpValSmp_Context
   ScoreSchedSmpValSmp_Instance;
 
+#define EVENT_OBTAIN RTEMS_EVENT_0
+
+#define EVENT_RELEASE RTEMS_EVENT_1
+
+#define EVENT_STICKY_OBTAIN RTEMS_EVENT_2
+
+#define EVENT_STICKY_RELEASE RTEMS_EVENT_3
+
+#define EVENT_SYNC_RUNNER RTEMS_EVENT_4
+
+#define EVENT_BUSY RTEMS_EVENT_5
+
 typedef ScoreSchedSmpValSmp_Context Context;
 
-typedef enum {
-  EVENT_OBTAIN = RTEMS_EVENT_0,
-  EVENT_RELEASE = RTEMS_EVENT_1,
-  EVENT_STICKY_OBTAIN = RTEMS_EVENT_2,
-  EVENT_STICKY_RELEASE = RTEMS_EVENT_3,
-  EVENT_SYNC_RUNNER = RTEMS_EVENT_4,
-  EVENT_BUSY = RTEMS_EVENT_5
-} Event;
-
-static void SendAndSync( Context *ctx, WorkerIndex worker, Event event )
+static void SendAndSync(
+  Context        *ctx,
+  WorkerIndex     worker,
+  rtems_event_set event
+)
 {
   SendEvents( ctx->worker_id[ worker ], EVENT_SYNC_RUNNER | event );
   ReceiveAllEvents( EVENT_SYNC_RUNNER );
diff --git a/testsuites/validation/tc-scheduler-remove-processor.c b/testsuites/validation/tc-scheduler-remove-processor.c
index 8b213e0095..c22b134ba9 100644
--- a/testsuites/validation/tc-scheduler-remove-processor.c
+++ b/testsuites/validation/tc-scheduler-remove-processor.c
@@ -377,16 +377,22 @@ static void DoRemoveProcessor( Context *ctx )
 }
 
 #if defined(RTEMS_SMP)
-typedef enum {
-  EVENT_SYNC_RUNNER = RTEMS_EVENT_0,
-  EVENT_OBTAIN = RTEMS_EVENT_1,
-  EVENT_RELEASE = RTEMS_EVENT_2,
-  EVENT_STICKY_OBTAIN = RTEMS_EVENT_3,
-  EVENT_STICKY_RELEASE = RTEMS_EVENT_4,
-  EVENT_RESTART = RTEMS_EVENT_5,
-  EVENT_BUSY = RTEMS_EVENT_6,
-  EVENT_SYNC_RUNNER_LATE = RTEMS_EVENT_7
-} Event;
+
+#define EVENT_SYNC_RUNNER RTEMS_EVENT_0
+
+#define EVENT_OBTAIN RTEMS_EVENT_1
+
+#define EVENT_RELEASE RTEMS_EVENT_2
+
+#define EVENT_STICKY_OBTAIN RTEMS_EVENT_3
+
+#define EVENT_STICKY_RELEASE RTEMS_EVENT_4
+
+#define EVENT_RESTART RTEMS_EVENT_5
+
+#define EVENT_BUSY RTEMS_EVENT_6
+
+#define EVENT_SYNC_RUNNER_LATE RTEMS_EVENT_7
 
 static void Barriers( void *arg )
 {
@@ -413,7 +419,11 @@ static void RequestISR( void *arg )
   CallWithinISRSubmit( &ctx->request );
 }
 
-static void SendAndSync( Context *ctx, WorkerIndex worker, Event event )
+static void SendAndSync(
+  Context        *ctx,
+  WorkerIndex     worker,
+  rtems_event_set event
+)
 {
   SendEvents( ctx->worker_id[ worker ], EVENT_SYNC_RUNNER | event );
   ReceiveAllEvents( EVENT_SYNC_RUNNER );
diff --git a/testsuites/validation/tc-score-smp-thread.c b/testsuites/validation/tc-score-smp-thread.c
index 7208514b32..70ef9af766 100644
--- a/testsuites/validation/tc-score-smp-thread.c
+++ b/testsuites/validation/tc-score-smp-thread.c
@@ -159,17 +159,21 @@ typedef struct {
 static ScoreThreadValSmp_Context
   ScoreThreadValSmp_Instance;
 
-typedef ScoreThreadValSmp_Context Context;
+#define EVENT_OBTAIN RTEMS_EVENT_0
+
+#define EVENT_RELEASE RTEMS_EVENT_1
+
+#define EVENT_COUNT_EARLY RTEMS_EVENT_2
+
+#define EVENT_BUSY RTEMS_EVENT_3
 
-typedef enum {
-  EVENT_OBTAIN = RTEMS_EVENT_0,
-  EVENT_RELEASE = RTEMS_EVENT_1,
-  EVENT_COUNT_EARLY = RTEMS_EVENT_2,
-  EVENT_BUSY = RTEMS_EVENT_3,
-  EVENT_COUNT = RTEMS_EVENT_4,
-  EVENT_LET_WORKER_C_COUNT = RTEMS_EVENT_5,
-  EVENT_SET_TASK_SWITCH_EXTENSION = RTEMS_EVENT_6
-} Event;
+#define EVENT_COUNT RTEMS_EVENT_4
+
+#define EVENT_LET_WORKER_C_COUNT RTEMS_EVENT_5
+
+#define EVENT_SET_TASK_SWITCH_EXTENSION RTEMS_EVENT_6
+
+typedef ScoreThreadValSmp_Context Context;
 
 static void TaskSwitchExtension( rtems_tcb *executing, rtems_tcb *heir )
 {
diff --git a/testsuites/validation/tc-score-thread-smp-one-cpu.c b/testsuites/validation/tc-score-thread-smp-one-cpu.c
index f78afe6e06..c288ee923a 100644
--- a/testsuites/validation/tc-score-thread-smp-one-cpu.c
+++ b/testsuites/validation/tc-score-thread-smp-one-cpu.c
@@ -97,11 +97,9 @@ typedef struct {
 static ScoreThreadValSmpOneCpu_Context
   ScoreThreadValSmpOneCpu_Instance;
 
-typedef ScoreThreadValSmpOneCpu_Context Context;
+#define EVENT_COUNT RTEMS_EVENT_0
 
-typedef enum {
-  EVENT_COUNT = RTEMS_EVENT_0
-} Event;
+typedef ScoreThreadValSmpOneCpu_Context Context;
 
 static void WorkerTask( rtems_task_argument arg )
 {
diff --git a/testsuites/validation/tc-sem-performance.c b/testsuites/validation/tc-sem-performance.c
index df2e6c8546..3274103f1c 100644
--- a/testsuites/validation/tc-sem-performance.c
+++ b/testsuites/validation/tc-sem-performance.c
@@ -112,15 +112,17 @@ typedef struct {
 static RtemsSemValPerf_Context
   RtemsSemValPerf_Instance;
 
-typedef RtemsSemValPerf_Context Context;
+#define EVENT_END RTEMS_EVENT_0
+
+#define EVENT_OBTAIN RTEMS_EVENT_1
+
+#define EVENT_OBTAIN_END RTEMS_EVENT_2
 
-typedef enum {
-  EVENT_END = RTEMS_EVENT_0,
-  EVENT_OBTAIN = RTEMS_EVENT_1,
-  EVENT_OBTAIN_END = RTEMS_EVENT_2,
-  EVENT_RELEASE = RTEMS_EVENT_3,
-  EVENT_RELEASE_END = RTEMS_EVENT_4
-} Event;
+#define EVENT_RELEASE RTEMS_EVENT_3
+
+#define EVENT_RELEASE_END RTEMS_EVENT_4
+
+typedef RtemsSemValPerf_Context Context;
 
 static void Send( const Context *ctx, rtems_event_set events )
 {
diff --git a/testsuites/validation/tc-task-performance.c b/testsuites/validation/tc-task-performance.c
index d660c3ef2f..a13f745732 100644
--- a/testsuites/validation/tc-task-performance.c
+++ b/testsuites/validation/tc-task-performance.c
@@ -113,13 +113,13 @@ typedef struct {
 static RtemsTaskValPerf_Context
   RtemsTaskValPerf_Instance;
 
-typedef RtemsTaskValPerf_Context Context;
+#define EVENT_RESTART RTEMS_EVENT_0
+
+#define EVENT_SET_END RTEMS_EVENT_1
 
-enum {
-  EVENT_RESTART = RTEMS_EVENT_0,
-  EVENT_SET_END = RTEMS_EVENT_1,
-  EVENT_BUSY = RTEMS_EVENT_2
-} Event;
+#define EVENT_BUSY RTEMS_EVENT_2
+
+typedef RtemsTaskValPerf_Context Context;
 
 RTEMS_ALIGNED( RTEMS_TASK_STORAGE_ALIGNMENT ) static char task_storage[
   RTEMS_TASK_STORAGE_SIZE(



More information about the vc mailing list