<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Nov 24, 2020 at 1:34 AM Sebastian Huber <<a href="mailto:sebastian.huber@embedded-brains.de">sebastian.huber@embedded-brains.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Replace a runtime check with a compile time assertion.  This makes the<br>
INTERNAL_ERROR_RTEMS_INIT_TASK_ENTRY_IS_NULL obsolete.<br>
<br>
Update #4181.<br>
---<br>
 cpukit/include/rtems/confdefs/inittask.h    | 13 ++++++++++<br>
 cpukit/include/rtems/score/interr.h         |  2 +-<br>
 cpukit/rtems/src/taskinitusers.c            |  8 +-----<br>
 spec/build/testsuites/sptests/grp.yml       |  2 --<br>
 spec/build/testsuites/sptests/spfatal02.yml | 19 --------------<br>
 testsuites/sptests/Makefile.am              |  9 -------<br>
 testsuites/sptests/<a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a>             |  1 -<br>
 testsuites/sptests/spfatal02/init.c         | 28 ---------------------<br>
 testsuites/sptests/spfatal02/spfatal02.doc  | 20 ---------------<br>
 testsuites/sptests/spfatal02/spfatal02.scn  |  3 ---<br>
 10 files changed, 15 insertions(+), 90 deletions(-)<br>
 delete mode 100644 spec/build/testsuites/sptests/spfatal02.yml<br>
 delete mode 100644 testsuites/sptests/spfatal02/init.c<br>
 delete mode 100644 testsuites/sptests/spfatal02/spfatal02.doc<br>
 delete mode 100644 testsuites/sptests/spfatal02/spfatal02.scn<br>
<br>
diff --git a/cpukit/include/rtems/confdefs/inittask.h b/cpukit/include/rtems/confdefs/inittask.h<br>
index a91b9a5917..25453f031d 100644<br>
--- a/cpukit/include/rtems/confdefs/inittask.h<br>
+++ b/cpukit/include/rtems/confdefs/inittask.h<br>
@@ -100,6 +100,19 @@ extern "C" {<br>
   #define CONFIGURE_INIT_TASK_ARGUMENTS 0<br>
 #endif<br>
<br>
+/* Ignore potential warnings from the static assertion below */<br>
+#pragma GCC diagnostic push<br>
+#pragma GCC diagnostic ignored "-Waddress"<br>
+#pragma GCC diagnostic ignored "-Wpragmas"<br>
+#pragma GCC diagnostic ignored "-Wtautological-pointer-compare"<br></blockquote><div><br></div><div>This comment applies to every place pragmas are used like this.</div><div><br></div><div>If they are just potential, the pragmas are not needed. If this is really disabling  </div><div>a specific warning, tell the read what the warning is. </div><div><br></div><div>Is this correct code and gcc should not be generating a warning? That</div><div>should be associated with a gcc ticket for false warnings. </div><div><br></div><div>pragmas are to be used lightly and with documented justification.</div><div><br></div><div>I am not sure how this would be captured in coding guidelines but this is an </div><div>exceptional thing to use and thus must come with exceptional comments.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+<br>
+RTEMS_STATIC_ASSERT(<br>
+  CONFIGURE_INIT_TASK_ENTRY_POINT != NULL,<br>
+  CONFIGURE_INIT_TASK_ENTRY_POINT_MUST_NOT_BE_NULL<br>
+);<br>
+<br>
+#pragma GCC diagnostic pop<br>
+<br>
 const rtems_initialization_tasks_table _RTEMS_tasks_User_task_table = {<br>
   CONFIGURE_INIT_TASK_NAME,<br>
   CONFIGURE_INIT_TASK_STACK_SIZE,<br>
diff --git a/cpukit/include/rtems/score/interr.h b/cpukit/include/rtems/score/interr.h<br>
index 4b06199ae9..b1f1061c82 100644<br>
--- a/cpukit/include/rtems/score/interr.h<br>
+++ b/cpukit/include/rtems/score/interr.h<br>
@@ -189,7 +189,7 @@ typedef enum {<br>
   INTERNAL_ERROR_NO_MEMORY_FOR_HEAP = 23,<br>
   INTERNAL_ERROR_CPU_ISR_INSTALL_VECTOR = 24,<br>
   INTERNAL_ERROR_RESOURCE_IN_USE = 25,<br>
-  INTERNAL_ERROR_RTEMS_INIT_TASK_ENTRY_IS_NULL = 26,<br>
+  /* INTERNAL_ERROR_RTEMS_INIT_TASK_ENTRY_IS_NULL = 26, */<br>
   /* INTERNAL_ERROR_POSIX_INIT_THREAD_ENTRY_IS_NULL = 27, */<br>
   INTERNAL_ERROR_THREAD_QUEUE_DEADLOCK = 28,<br>
   INTERNAL_ERROR_THREAD_QUEUE_ENQUEUE_STICKY_FROM_BAD_STATE = 29,<br>
diff --git a/cpukit/rtems/src/taskinitusers.c b/cpukit/rtems/src/taskinitusers.c<br>
index 0b23d8bc86..f21c061670 100644<br>
--- a/cpukit/rtems/src/taskinitusers.c<br>
+++ b/cpukit/rtems/src/taskinitusers.c<br>
@@ -29,7 +29,6 @@ void _RTEMS_tasks_Initialize_user_task( void )<br>
   rtems_id                                id;<br>
   rtems_status_code                       return_value;<br>
   const rtems_initialization_tasks_table *user_task;<br>
-  rtems_task_entry                        entry_point;<br>
<br>
   user_task = &_RTEMS_tasks_User_task_table;<br>
   return_value = rtems_task_create(<br>
@@ -44,14 +43,9 @@ void _RTEMS_tasks_Initialize_user_task( void )<br>
     _Internal_error( INTERNAL_ERROR_RTEMS_INIT_TASK_CREATE_FAILED );<br>
   }<br>
<br>
-  entry_point = user_task->entry_point;<br>
-  if ( entry_point == NULL ) {<br>
-    _Internal_error( INTERNAL_ERROR_RTEMS_INIT_TASK_ENTRY_IS_NULL );<br>
-  }<br>
-<br>
   return_value = rtems_task_start(<br>
     id,<br>
-    entry_point,<br>
+    user_task->entry_point,<br>
     user_task->argument<br>
   );<br>
   _Assert( rtems_is_status_successful( return_value ) );<br>
diff --git a/spec/build/testsuites/sptests/grp.yml b/spec/build/testsuites/sptests/grp.yml<br>
index 1c865777a7..b1bf85942d 100644<br>
--- a/spec/build/testsuites/sptests/grp.yml<br>
+++ b/spec/build/testsuites/sptests/grp.yml<br>
@@ -218,8 +218,6 @@ links:<br>
   uid: spextensions01<br>
 - role: build-dependency<br>
   uid: spfatal01<br>
-- role: build-dependency<br>
-  uid: spfatal02<br>
 - role: build-dependency<br>
   uid: spfatal03<br>
 - role: build-dependency<br>
diff --git a/spec/build/testsuites/sptests/spfatal02.yml b/spec/build/testsuites/sptests/spfatal02.yml<br>
deleted file mode 100644<br>
index 19e329a027..0000000000<br>
--- a/spec/build/testsuites/sptests/spfatal02.yml<br>
+++ /dev/null<br>
@@ -1,19 +0,0 @@<br>
-SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause<br>
-build-type: test-program<br>
-cflags: []<br>
-copyrights:<br>
-- Copyright (C) 2020 embedded brains GmbH (<a href="http://www.embedded-brains.de" rel="noreferrer" target="_blank">http://www.embedded-brains.de</a>)<br>
-cppflags: []<br>
-cxxflags: []<br>
-enabled-by: true<br>
-features: c cprogram<br>
-includes: []<br>
-ldflags: []<br>
-links: []<br>
-source:<br>
-- testsuites/sptests/spfatal02/init.c<br>
-stlib: []<br>
-target: testsuites/sptests/spfatal02.exe<br>
-type: build<br>
-use-after: []<br>
-use-before: []<br>
diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.am<br>
index 14788f7fb1..8813d43513 100644<br>
--- a/testsuites/sptests/Makefile.am<br>
+++ b/testsuites/sptests/Makefile.am<br>
@@ -904,15 +904,6 @@ spfatal01_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_spfatal01) \<br>
        $(support_includes)<br>
 endif<br>
<br>
-if TEST_spfatal02<br>
-sp_tests += spfatal02<br>
-sp_screens += spfatal02/spfatal02.scn<br>
-sp_docs += spfatal02/spfatal02.doc<br>
-spfatal02_SOURCES = spfatal02/init.c<br>
-spfatal02_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_spfatal02) \<br>
-       $(support_includes)<br>
-endif<br>
-<br>
 if TEST_spfatal03<br>
 sp_tests += spfatal03<br>
 sp_screens += spfatal03/spfatal03.scn<br>
diff --git a/testsuites/sptests/<a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a> b/testsuites/sptests/<a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a><br>
index 099ff0412b..4ca55e6a36 100644<br>
--- a/testsuites/sptests/<a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a><br>
+++ b/testsuites/sptests/<a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a><br>
@@ -137,7 +137,6 @@ RTEMS_TEST_CHECK([speventsystem01])<br>
 RTEMS_TEST_CHECK([speventtransient01])<br>
 RTEMS_TEST_CHECK([spextensions01])<br>
 RTEMS_TEST_CHECK([spfatal01])<br>
-RTEMS_TEST_CHECK([spfatal02])<br>
 RTEMS_TEST_CHECK([spfatal03])<br>
 RTEMS_TEST_CHECK([spfatal04])<br>
 RTEMS_TEST_CHECK([spfatal05])<br>
diff --git a/testsuites/sptests/spfatal02/init.c b/testsuites/sptests/spfatal02/init.c<br>
deleted file mode 100644<br>
index 2700b4dd50..0000000000<br>
--- a/testsuites/sptests/spfatal02/init.c<br>
+++ /dev/null<br>
@@ -1,28 +0,0 @@<br>
-#ifdef HAVE_CONFIG_H<br>
-#include "config.h"<br>
-#endif<br>
-<br>
-#include "../spfatal_support/spfatal.h"<br>
-<br>
-/*<br>
- * Classic API Init task create failure<br>
- */<br>
-<br>
-#define CONFIGURE_INIT_TASK_ENTRY_POINT NULL<br>
-<br>
-#define FATAL_ERROR_TEST_NAME            "2"<br>
-#define FATAL_ERROR_DESCRIPTION          "Classic API Init task start failure"<br>
-#define FATAL_ERROR_EXPECTED_SOURCE      INTERNAL_ERROR_CORE<br>
-#define FATAL_ERROR_EXPECTED_ERROR \<br>
-  INTERNAL_ERROR_RTEMS_INIT_TASK_ENTRY_IS_NULL<br>
-<br>
-static void force_error(void)<br>
-{<br>
-/*<br>
- *  Case 2: Null entry<br>
- */<br>
-<br>
-  /* we will not run this far */<br>
-}<br>
-<br>
-#include "../spfatal_support/spfatalimpl.h"<br>
diff --git a/testsuites/sptests/spfatal02/spfatal02.doc b/testsuites/sptests/spfatal02/spfatal02.doc<br>
deleted file mode 100644<br>
index 1e62051b52..0000000000<br>
--- a/testsuites/sptests/spfatal02/spfatal02.doc<br>
+++ /dev/null<br>
@@ -1,20 +0,0 @@<br>
-#  COPYRIGHT (c) 1989-2009.<br>
-#  On-Line Applications Research Corporation (OAR).<br>
-#<br>
-#  The license and distribution terms for this file may be<br>
-#  found in the file LICENSE in this distribution or at<br>
-#  <a href="http://www.rtems.org/license/LICENSE" rel="noreferrer" target="_blank">http://www.rtems.org/license/LICENSE</a>.<br>
-#<br>
-<br>
-This file describes the directives and concepts tested by this test set.<br>
-<br>
-test set name:  spfatal02<br>
-<br>
-directives:<br>
-<br>
-  rtems_task_start for a user initialization task<br>
-<br>
-concepts:<br>
-<br>
-+ Ensure that when rtems_task_start returns an error when creating a Classic<br>
-  API user initialization task is properly treated as a fatal error.<br>
diff --git a/testsuites/sptests/spfatal02/spfatal02.scn b/testsuites/sptests/spfatal02/spfatal02.scn<br>
deleted file mode 100644<br>
index a6e6d93501..0000000000<br>
--- a/testsuites/sptests/spfatal02/spfatal02.scn<br>
+++ /dev/null<br>
@@ -1,3 +0,0 @@<br>
-*** TEST FATAL 2 ***<br>
-Fatal error (Classic API Init task start failure) hit<br>
-*** END OF TEST FATAL 2 ***<br>
-- <br>
2.26.2<br>
<br>
_______________________________________________<br>
devel mailing list<br>
<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a><br>
</blockquote></div></div>