[PATCH 14/19] tests misc: Disable deprecated method usage warning when intentional

Joel Sherrill joel.sherrill at oarcorp.com
Mon Mar 16 20:29:31 UTC 2015


These tests intentionally use the deprecated method. Eventually
this code in the sections can be deleted.
---
 testsuites/psxtests/psxconfig01/init.c  |  14 +-
 testsuites/sptests/spclockget/init.c    |   2 +
 testsuites/sptests/spnotepad01/init.c   |   5 +
 testsuites/sptests/sptask_err04/task1.c | 344 +++++++++++++++++---------------
 testsuites/tmtests/tm08/task1.c         |  62 +++---
 5 files changed, 232 insertions(+), 195 deletions(-)

diff --git a/testsuites/psxtests/psxconfig01/init.c b/testsuites/psxtests/psxconfig01/init.c
index 61beec3..ea8cd5d 100644
--- a/testsuites/psxtests/psxconfig01/init.c
+++ b/testsuites/psxtests/psxconfig01/init.c
@@ -438,10 +438,16 @@ static rtems_task Init(rtems_task_argument argument)
 
 #if !defined(RTEMS_SMP)
 #ifdef CONFIGURE_MAXIMUM_TASK_VARIABLES
-  for (i = 0; i < CONFIGURE_MAXIMUM_TASK_VARIABLES; ++i) {
-    sc = rtems_task_variable_add(RTEMS_SELF, &task_var, task_var_dtor);
-    directive_failed(sc, "rtems_task_variable_add");
-  }
+  /*
+   * We know this is deprecated and don't want a warning on every BSP built.
+   */
+  #pragma GCC diagnostic push
+  #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+    for (i = 0; i < CONFIGURE_MAXIMUM_TASK_VARIABLES; ++i) {
+      sc = rtems_task_variable_add(RTEMS_SELF, &task_var, task_var_dtor);
+      directive_failed(sc, "rtems_task_variable_add");
+    }
+  #pragma GCC diagnostic pop
 #endif
 #endif
 
diff --git a/testsuites/sptests/spclockget/init.c b/testsuites/sptests/spclockget/init.c
index 145beed..8cdae21 100644
--- a/testsuites/sptests/spclockget/init.c
+++ b/testsuites/sptests/spclockget/init.c
@@ -14,6 +14,8 @@
 #include <tmacros.h>
 #include "pritime.h"
 
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
 const char rtems_test_name[] = "SPCLOCKGET";
 
 /* forward declarations to avoid warnings */
diff --git a/testsuites/sptests/spnotepad01/init.c b/testsuites/sptests/spnotepad01/init.c
index 9604c32..965d69d 100644
--- a/testsuites/sptests/spnotepad01/init.c
+++ b/testsuites/sptests/spnotepad01/init.c
@@ -15,6 +15,11 @@
 
 const char rtems_test_name[] = "SPNOTEPAD 1";
 
+/*
+ * We know this is deprecated and don't want a warning on every BSP built.
+ */
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
 /* forward declarations to avoid warnings */
 rtems_task Init(rtems_task_argument argument);
 
diff --git a/testsuites/sptests/sptask_err04/task1.c b/testsuites/sptests/sptask_err04/task1.c
index 0d182e0..92ddb6d 100644
--- a/testsuites/sptests/sptask_err04/task1.c
+++ b/testsuites/sptests/sptask_err04/task1.c
@@ -50,191 +50,203 @@ rtems_task Task_1(
   );
   puts( "TA1 - rtems_task_delete - RTEMS_INVALID_ID" );
 
-  /* NULL return */
-  status = rtems_task_get_note( RTEMS_SELF, RTEMS_NOTEPAD_FIRST, NULL );
-  fatal_directive_status(
-    status,
-    RTEMS_INVALID_ADDRESS,
-    "rtems_task_get_note with NULL param"
-  );
-  puts( "TA1 - rtems_task_get_note - RTEMS_INVALID_ADDRESS" );
+  /** START OF NOTEPAD TESTS **/
 
-  /* note too high */
-  status = rtems_task_get_note( RTEMS_SELF, 100, &notepad_value );
-  fatal_directive_status(
-    status,
-    RTEMS_INVALID_NUMBER,
-    "rtems_task_get_note with illegal notepad"
-  );
-  puts( "TA1 - rtems_task_get_note - RTEMS_INVALID_NUMBER" );
+  /*
+   * We know this is deprecated and don't want a warning on every BSP built.
+   */
+  #pragma GCC diagnostic push
+  #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
 
-  /* bad Id */
-  status = rtems_task_get_note( 100, RTEMS_NOTEPAD_LAST, &notepad_value );
-  fatal_directive_status(
-    status,
-    RTEMS_INVALID_ID,
-    "rtems_task_get_note with illegal id"
-  );
-  puts( "TA1 - rtems_task_get_note - RTEMS_INVALID_ID" );
+    /* NULL return */
+    status = rtems_task_get_note( RTEMS_SELF, RTEMS_NOTEPAD_FIRST, NULL );
+    fatal_directive_status(
+      status,
+      RTEMS_INVALID_ADDRESS,
+      "rtems_task_get_note with NULL param"
+    );
+    puts( "TA1 - rtems_task_get_note - RTEMS_INVALID_ADDRESS" );
 
-  /* unused Id so invalid now */
-  status = rtems_task_get_note(
-    Task_id[ 0 ],
-    RTEMS_NOTEPAD_LAST,
-    &notepad_value
-  );
-  fatal_directive_status(
-    status,
-    RTEMS_INVALID_ID,
-    "rtems_task_get_note with illegal id"
-  );
-  puts( "TA1 - rtems_task_get_note - RTEMS_INVALID_ID" );
+    /* note too high */
+    status = rtems_task_get_note( RTEMS_SELF, 100, &notepad_value );
+    fatal_directive_status(
+      status,
+      RTEMS_INVALID_NUMBER,
+      "rtems_task_get_note with illegal notepad"
+    );
+    puts( "TA1 - rtems_task_get_note - RTEMS_INVALID_NUMBER" );
 
-  status = rtems_task_get_note(
-    _RTEMS_tasks_Information.minimum_id + (3L<<OBJECTS_API_START_BIT),
-    RTEMS_NOTEPAD_LAST,
-    &notepad_value
-  );
-  fatal_directive_status(
-    status,
-    RTEMS_INVALID_ID,
-    "rtems_task_get_note with illegal id"
-  );
+    /* bad Id */
+    status = rtems_task_get_note( 100, RTEMS_NOTEPAD_LAST, &notepad_value );
+    fatal_directive_status(
+      status,
+      RTEMS_INVALID_ID,
+      "rtems_task_get_note with illegal id"
+    );
+    puts( "TA1 - rtems_task_get_note - RTEMS_INVALID_ID" );
 
-  status = rtems_task_get_note(
-    rtems_build_id( OBJECTS_CLASSIC_API, 2, 1, 1 ),
-    RTEMS_NOTEPAD_LAST,
-    &notepad_value
-  );
-  fatal_directive_status(
-    status,
-    RTEMS_INVALID_ID,
-    "rtems_task_get_note with non-task ID"
-  );
+    /* unused Id so invalid now */
+    status = rtems_task_get_note(
+      Task_id[ 0 ],
+      RTEMS_NOTEPAD_LAST,
+      &notepad_value
+    );
+    fatal_directive_status(
+      status,
+      RTEMS_INVALID_ID,
+      "rtems_task_get_note with illegal id"
+    );
+    puts( "TA1 - rtems_task_get_note - RTEMS_INVALID_ID" );
 
-  /* NULL param */
-  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, NULL );
-  fatal_directive_status(
-    status,
-    RTEMS_INVALID_ADDRESS,
-    "rtems_task_ident NULL param"
-  );
-  puts( "TA1 - rtems_task_ident - RTEMS_INVALID_ADDRESS" );
+    status = rtems_task_get_note(
+      _RTEMS_tasks_Information.minimum_id + (3L<<OBJECTS_API_START_BIT),
+      RTEMS_NOTEPAD_LAST,
+      &notepad_value
+    );
+    fatal_directive_status(
+      status,
+      RTEMS_INVALID_ID,
+      "rtems_task_get_note with illegal id"
+    );
 
-  /* OK */
-  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &self_id );
-  directive_failed( status, "rtems_task_ident of self" );
-  if ( self_id != Task_id[ 1 ] ) {
-    puts( "ERROR - rtems_task_ident - incorrect ID returned!" );
-  }
-  puts( "TA1 - rtems_task_ident - current task RTEMS_SUCCESSFUL" );
+    status = rtems_task_get_note(
+      rtems_build_id( OBJECTS_CLASSIC_API, 2, 1, 1 ),
+      RTEMS_NOTEPAD_LAST,
+      &notepad_value
+    );
+    fatal_directive_status(
+      status,
+      RTEMS_INVALID_ID,
+      "rtems_task_get_note with non-task ID"
+    );
 
-  status = rtems_task_ident( 100, RTEMS_SEARCH_ALL_NODES, &Junk_id );
-  fatal_directive_status(
-    status,
-    RTEMS_INVALID_NAME,
-    "rtems_task_ident with illegal name (local)"
-  );
-  puts( "TA1 - rtems_task_ident - global RTEMS_INVALID_NAME" );
+    /* NULL param */
+    status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, NULL );
+    fatal_directive_status(
+      status,
+      RTEMS_INVALID_ADDRESS,
+      "rtems_task_ident NULL param"
+    );
+    puts( "TA1 - rtems_task_ident - RTEMS_INVALID_ADDRESS" );
 
-  status = rtems_task_ident( 100, 1, &Junk_id );
-  fatal_directive_status(
-    status,
-    RTEMS_INVALID_NAME,
-    "rtems_task_ident with illegal name (global)"
-  );
-  puts( "TA1 - rtems_task_ident - local RTEMS_INVALID_NAME" );
+    /* OK */
+    status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &self_id );
+    directive_failed( status, "rtems_task_ident of self" );
+    if ( self_id != Task_id[ 1 ] ) {
+      puts( "ERROR - rtems_task_ident - incorrect ID returned!" );
+    }
+    puts( "TA1 - rtems_task_ident - current task RTEMS_SUCCESSFUL" );
 
-  /*
-   *  This one case is different if MP is enabled/disabled.
-   */
+    status = rtems_task_ident( 100, RTEMS_SEARCH_ALL_NODES, &Junk_id );
+    fatal_directive_status(
+      status,
+      RTEMS_INVALID_NAME,
+      "rtems_task_ident with illegal name (local)"
+    );
+    puts( "TA1 - rtems_task_ident - global RTEMS_INVALID_NAME" );
 
-  status = rtems_task_ident( 100, 2, &Junk_id );
-#if defined(RTEMS_MULTIPROCESSING)
-  fatal_directive_status(
-    status,
-    RTEMS_INVALID_NODE,
-    "rtems_task_ident with illegal node"
-  );
-#else
-  fatal_directive_status(
-    status,
-    RTEMS_INVALID_NAME,
-    "rtems_task_ident with illegal node"
-  );
-#endif
-  puts( "TA1 - rtems_task_ident - RTEMS_INVALID_NODE" );
+    status = rtems_task_ident( 100, 1, &Junk_id );
+    fatal_directive_status(
+      status,
+      RTEMS_INVALID_NAME,
+      "rtems_task_ident with illegal name (global)"
+    );
+    puts( "TA1 - rtems_task_ident - local RTEMS_INVALID_NAME" );
 
-  status = rtems_task_restart( 100, 0 );
-  fatal_directive_status(
-    status,
-    RTEMS_INVALID_ID,
-    "rtems_task_restart with illegal id"
-  );
-  puts( "TA1 - rtems_task_restart - RTEMS_INVALID_ID" );
+    /*
+     *  This one case is different if MP is enabled/disabled.
+     */
 
-  status = rtems_task_resume( 100 );
-  fatal_directive_status(
-    status,
-    RTEMS_INVALID_ID,
-    "rtems_task_resume with illegal id"
-  );
-  puts( "TA1 - rtems_task_resume - RTEMS_INVALID_ID" );
+    status = rtems_task_ident( 100, 2, &Junk_id );
+  #if defined(RTEMS_MULTIPROCESSING)
+    fatal_directive_status(
+      status,
+      RTEMS_INVALID_NODE,
+      "rtems_task_ident with illegal node"
+    );
+  #else
+    fatal_directive_status(
+      status,
+      RTEMS_INVALID_NAME,
+      "rtems_task_ident with illegal node"
+    );
+  #endif
+    puts( "TA1 - rtems_task_ident - RTEMS_INVALID_NODE" );
 
-  status = rtems_task_resume( RTEMS_SELF );
-  fatal_directive_status(
-    status,
-    RTEMS_INCORRECT_STATE,
-    "rtems_task_resume of ready task"
-  );
-  puts( "TA1 - rtems_task_resume - RTEMS_INCORRECT_STATE" );
+    status = rtems_task_restart( 100, 0 );
+    fatal_directive_status(
+      status,
+      RTEMS_INVALID_ID,
+      "rtems_task_restart with illegal id"
+    );
+    puts( "TA1 - rtems_task_restart - RTEMS_INVALID_ID" );
 
-  /* NULL param */
-  status = rtems_task_set_priority( RTEMS_SELF, RTEMS_CURRENT_PRIORITY, NULL );
-  fatal_directive_status(
-    status,
-    RTEMS_INVALID_ADDRESS,
-    "rtems_task_set_priority with NULL param"
-  );
-  puts( "TA1 - rtems_task_set_priority - RTEMS_INVALID_ADDRESS" );
+    status = rtems_task_resume( 100 );
+    fatal_directive_status(
+      status,
+      RTEMS_INVALID_ID,
+      "rtems_task_resume with illegal id"
+    );
+    puts( "TA1 - rtems_task_resume - RTEMS_INVALID_ID" );
 
-  /* bad priority */
-  status = rtems_task_set_priority( RTEMS_SELF, 512, &previous_priority );
-  fatal_directive_status(
-    status,
-    RTEMS_INVALID_PRIORITY,
-    "rtems_task_set_priority with illegal priority"
-  );
-  puts( "TA1 - rtems_task_set_priority - RTEMS_INVALID_PRIORITY" );
+    status = rtems_task_resume( RTEMS_SELF );
+    fatal_directive_status(
+      status,
+      RTEMS_INCORRECT_STATE,
+      "rtems_task_resume of ready task"
+    );
+    puts( "TA1 - rtems_task_resume - RTEMS_INCORRECT_STATE" );
 
-  /* bad Id */
-  status = rtems_task_set_priority( 100, 8, &previous_priority );
-  fatal_directive_status(
-    status,
-    RTEMS_INVALID_ID,
-    "rtems_task_set_priority with illegal id"
-  );
-  puts( "TA1 - rtems_task_set_priority - RTEMS_INVALID_ID" );
+    /* NULL param */
+    status = rtems_task_set_priority( RTEMS_SELF, RTEMS_CURRENT_PRIORITY, NULL );
+    fatal_directive_status(
+      status,
+      RTEMS_INVALID_ADDRESS,
+      "rtems_task_set_priority with NULL param"
+    );
+    puts( "TA1 - rtems_task_set_priority - RTEMS_INVALID_ADDRESS" );
 
-  status = rtems_task_set_note(
-    RTEMS_SELF,
-    RTEMS_NOTEPAD_LAST+10,
-    notepad_value
-  );
-  fatal_directive_status(
-    status,
-    RTEMS_INVALID_NUMBER,
-    "rtems_task_set_note with illegal notepad"
-  );
-  puts( "TA1 - rtems_task_set_note - RTEMS_INVALID_NUMBER" );
+    /* bad priority */
+    status = rtems_task_set_priority( RTEMS_SELF, 512, &previous_priority );
+    fatal_directive_status(
+      status,
+      RTEMS_INVALID_PRIORITY,
+      "rtems_task_set_priority with illegal priority"
+    );
+    puts( "TA1 - rtems_task_set_priority - RTEMS_INVALID_PRIORITY" );
 
-  status = rtems_task_set_note( 100, RTEMS_NOTEPAD_LAST, notepad_value );
-  fatal_directive_status(
-    status,
-    RTEMS_INVALID_ID,
-    "rtems_task_set_note with illegal id"
-  );
-  puts( "TA1 - rtems_task_set_note - RTEMS_INVALID_ID" );
+    /* bad Id */
+    status = rtems_task_set_priority( 100, 8, &previous_priority );
+    fatal_directive_status(
+      status,
+      RTEMS_INVALID_ID,
+      "rtems_task_set_priority with illegal id"
+    );
+    puts( "TA1 - rtems_task_set_priority - RTEMS_INVALID_ID" );
+
+    status = rtems_task_set_note(
+      RTEMS_SELF,
+      RTEMS_NOTEPAD_LAST+10,
+      notepad_value
+    );
+    fatal_directive_status(
+      status,
+      RTEMS_INVALID_NUMBER,
+      "rtems_task_set_note with illegal notepad"
+    );
+    puts( "TA1 - rtems_task_set_note - RTEMS_INVALID_NUMBER" );
+
+    status = rtems_task_set_note( 100, RTEMS_NOTEPAD_LAST, notepad_value );
+    fatal_directive_status(
+      status,
+      RTEMS_INVALID_ID,
+      "rtems_task_set_note with illegal id"
+    );
+    puts( "TA1 - rtems_task_set_note - RTEMS_INVALID_ID" );
+
+  #pragma GCC diagnostic pop
+
+  /** END OF NOTEPAD TESTS **/
 
   status = rtems_task_start( 100, Task_1, 0 );
   fatal_directive_status(
diff --git a/testsuites/tmtests/tm08/task1.c b/testsuites/tmtests/tm08/task1.c
index f26931f..6d42de9 100644
--- a/testsuites/tmtests/tm08/task1.c
+++ b/testsuites/tmtests/tm08/task1.c
@@ -186,31 +186,43 @@ rtems_task test_task(
   benchmark_timer_initialize();
     (void)  rtems_task_mode( RTEMS_PREEMPT, RTEMS_PREEMPT_MASK, &old_mode );
 
-  benchmark_timer_initialize();
-    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
-      (void) rtems_task_set_note( Test_task_id, 8, 10 );
-  end_time = benchmark_timer_read();
-
-  put_time(
-    "rtems_task_set_note: only case",
-    end_time,
-    OPERATION_COUNT,
-    overhead,
-    CALLING_OVERHEAD_TASK_SET_NOTE
-  );
-
-  benchmark_timer_initialize();
-    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
-      (void) rtems_task_get_note( Test_task_id, 8, &old_note );
-  end_time = benchmark_timer_read();
-
-  put_time(
-    "rtems_task_get_note: only case",
-    end_time,
-    OPERATION_COUNT,
-    overhead,
-    CALLING_OVERHEAD_TASK_GET_NOTE
-  );
+  /** START OF NOTEPAD TESTS **/
+
+  /*
+   * We know this is deprecated and don't want a warning on every BSP built.
+   */
+  #pragma GCC diagnostic push
+  #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
+    benchmark_timer_initialize();
+      for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+        (void) rtems_task_set_note( Test_task_id, 8, 10 );
+    end_time = benchmark_timer_read();
+
+    put_time(
+      "rtems_task_set_note: only case",
+      end_time,
+      OPERATION_COUNT,
+      overhead,
+      CALLING_OVERHEAD_TASK_SET_NOTE
+    );
+
+    benchmark_timer_initialize();
+      for ( index=1 ; index <= OPERATION_COUNT ; index++ )
+        (void) rtems_task_get_note( Test_task_id, 8, &old_note );
+    end_time = benchmark_timer_read();
+
+    put_time(
+      "rtems_task_get_note: only case",
+      end_time,
+      OPERATION_COUNT,
+      overhead,
+      CALLING_OVERHEAD_TASK_GET_NOTE
+    );
+
+  #pragma GCC diagnostic pop
+
+  /** END OF NOTEPAD TESTS **/
 
   build_time( &time, 1, 1, 1988, 0, 0, 0, 0 );
 
-- 
1.9.3




More information about the devel mailing list