[PATCH rtems-examples 18/23] misc/minimum/: Fix warnings

Joel Sherrill joel at rtems.org
Wed Feb 23 22:21:46 UTC 2022


---
 classic_api/triple_period/init.c  | 17 ++++++++---------
 classic_api/triple_period/tasks.c | 14 +++++---------
 misc/minimum/test.c               | 11 ++++++++---
 3 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/classic_api/triple_period/init.c b/classic_api/triple_period/init.c
index 0b05be6..52be9a9 100644
--- a/classic_api/triple_period/init.c
+++ b/classic_api/triple_period/init.c
@@ -23,7 +23,6 @@ rtems_task Init(
   rtems_task_argument argument
 )
 {
-  rtems_status_code status;
   rtems_time_of_day time;
   uint32_t ticks_per_second, ticks_since_boot;
 
@@ -44,32 +43,32 @@ rtems_task Init(
   time.second = 0;
   time.ticks  = 0;
 
-  status = rtems_clock_set( &time );
+  (void) rtems_clock_set( &time );
 
   Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
   Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
   Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
 
   // prototype: rtems_task_create( name, initial_priority, stack_size, initial_modes, attribute_set, *id );
-  status = rtems_task_create(
+  (void) rtems_task_create(
     Task_name[ 1 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES,
     RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 1 ]
   );
-  status = rtems_task_create(
+  (void) rtems_task_create(
     Task_name[ 2 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES,
     RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 2 ]
   );
-  status = rtems_task_create(
+  (void) rtems_task_create(
     Task_name[ 3 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES,
     RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 3 ]
   );
 
   // prototype: rtems_task_start( id, entry_point, argument );
-  status = rtems_task_start( Task_id[ 1 ], Task_Absolute_Period, 1 );
-  status = rtems_task_start( Task_id[ 2 ], Task_Rate_Monotonic_Period, 2 );
-  status = rtems_task_start( Task_id[ 3 ], Task_Relative_Period, 3 );
+  (void) rtems_task_start( Task_id[ 1 ], Task_Absolute_Period, 1 );
+  (void) rtems_task_start( Task_id[ 2 ], Task_Rate_Monotonic_Period, 2 );
+  (void) rtems_task_start( Task_id[ 3 ], Task_Relative_Period, 3 );
 
 
   // delete init task after starting the three working tasks
-  status = rtems_task_delete( RTEMS_SELF );
+  (void) rtems_task_delete( RTEMS_SELF );
 }
diff --git a/classic_api/triple_period/tasks.c b/classic_api/triple_period/tasks.c
index 0e29d0c..fb92e30 100644
--- a/classic_api/triple_period/tasks.c
+++ b/classic_api/triple_period/tasks.c
@@ -20,8 +20,6 @@
 #define PERIOD_TASK_RATE_MONOTONIC     2
 #define PERIOD_TASK_RELATIVE           3
 
-
-
 // TASK 1
 //
 // * Absolute timing for task 1
@@ -33,7 +31,6 @@ rtems_task Task_Absolute_Period(
 )
 {
   rtems_time_of_day time;
-  rtems_status_code status;
   uint32_t          ticks_since_boot;
   uint32_t          count;
 
@@ -41,7 +38,7 @@ rtems_task Task_Absolute_Period(
   rtems_cpu_usage_reset();
 
   while( 1 ) {
-    status = rtems_clock_get_tod( &time );
+    (void) rtems_clock_get_tod( &time );
     count++;
 
     // sets end criteria for demo application (60 seconds)
@@ -70,7 +67,7 @@ rtems_task Task_Absolute_Period(
     time.ticks  = 0;    // 'ticks' is don't care.  rtems_task_wake_when() has a
                         // granularity of 1 second and zeroes time.ticks
 
-    status = rtems_task_wake_when( &time );
+    (void) rtems_task_wake_when( &time );
 
     // dump CPU usage every 5th period
     if( 0 == (count % 5) ) {
@@ -100,7 +97,7 @@ rtems_task Task_Rate_Monotonic_Period(
   count = 0;
 
   while( 1 ) {
-    status = rtems_clock_get_tod( &time );
+    (void) rtems_clock_get_tod( &time );
     count++;
 
     printf( "\n\nTask 2 - activating every %d second using rate monotonic manager to schedule (rtems_rate_monotonic_period)\n", PERIOD_TASK_RATE_MONOTONIC);
@@ -158,11 +155,10 @@ rtems_task Task_Relative_Period(
 )
 {
   rtems_time_of_day time;
-  rtems_status_code status;
   uint32_t          ticks_since_boot;
 
   while( 1 ) {
-    status = rtems_clock_get_tod( &time );
+    (void) rtems_clock_get_tod( &time );
 
     printf(
       "\n\nTask 3 - activating after every %d second using relative "
@@ -175,7 +171,7 @@ rtems_task Task_Relative_Period(
     printf(" - Ticks since boot: %" PRIu32 "\n", ticks_since_boot);
 
     // Every N3 seconds
-    status = rtems_task_wake_after(
+    (void) rtems_task_wake_after(
       rtems_clock_get_ticks_per_second() * PERIOD_TASK_RELATIVE
     );
   }
diff --git a/misc/minimum/test.c b/misc/minimum/test.c
index 729ed3a..5ff91cb 100644
--- a/misc/minimum/test.c
+++ b/misc/minimum/test.c
@@ -16,9 +16,12 @@ void *Init(
 {
   /* initialize application */
 
-  /* Real application would call idle loop functionality */
+  /* Real application must do at least this */
+  while (1) {
+    ;
+  }
 
-  /* but in this case, just return and fall into a fatal error */ 
+  return NULL;
 }
 
 /* configuration information */
@@ -65,7 +68,9 @@ void *Init(
  *  per Task Control Block.  If you aren't using these and are tight
  *  on RAM, this is an option.
  */
+#if (__RTEMS_MAJOR__ < 5)
 #define CONFIGURE_DISABLE_CLASSIC_API_NOTEPADS
+#endif
 
 /*
  *  This configures RTEMS to use a single memory pool for the RTEMS Workspace
@@ -86,7 +91,7 @@ void *Init(
  *  In this application, the initialization task performs the system
  *  initialization and then transforms itself into the idle task.
  */
-#define CONFIGURE_IDLE_TASK_BODY Init
+#define CONFIGURE_IDLE_TASK_BODY (Thread_Idle_body) Init
 #define CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION
 
 /*
-- 
1.8.3.1



More information about the devel mailing list