[PATCH 15/16] score: Add RTEMS_FATAL_SOURCE_ASSERT

Sebastian Huber sebastian.huber at embedded-brains.de
Wed Nov 14 15:47:09 UTC 2012


---
 cpukit/libcsupport/src/__assert.c         |    2 +-
 cpukit/score/include/rtems/score/interr.h |    7 +++++++
 testsuites/sptests/spfatal10/testcase.h   |    8 +++++---
 testsuites/sptests/spfatal11/testcase.h   |    2 +-
 4 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/cpukit/libcsupport/src/__assert.c b/cpukit/libcsupport/src/__assert.c
index 5adefdf..07af01b 100644
--- a/cpukit/libcsupport/src/__assert.c
+++ b/cpukit/libcsupport/src/__assert.c
@@ -34,7 +34,7 @@ void __assert_func(
     (func) ? ", function: " : "",
     (func) ? func : ""
   );
-  rtems_fatal_error_occurred(0);
+  rtems_fatal( RTEMS_FATAL_SOURCE_ASSERT, (rtems_fatal_code) func );
 }
 #endif
 
diff --git a/cpukit/score/include/rtems/score/interr.h b/cpukit/score/include/rtems/score/interr.h
index b316fbf..20efcb3 100644
--- a/cpukit/score/include/rtems/score/interr.h
+++ b/cpukit/score/include/rtems/score/interr.h
@@ -84,6 +84,13 @@ typedef enum {
   RTEMS_FATAL_SOURCE_BSP_SPECIFIC,
 
   /**
+   * @brief Fatal source of assert().
+   *
+   * The fatal code is the pointer value of the function string.
+   */
+  RTEMS_FATAL_SOURCE_ASSERT,
+
+  /**
    * @brief The last available fatal source.
    *
    * This enum value ensures that the enum type needs at least 32-bits for
diff --git a/testsuites/sptests/spfatal10/testcase.h b/testsuites/sptests/spfatal10/testcase.h
index 6d011ce..9af96d9 100644
--- a/testsuites/sptests/spfatal10/testcase.h
+++ b/testsuites/sptests/spfatal10/testcase.h
@@ -10,15 +10,17 @@
 
 #include <assert.h>
 
+static const char func [] = "Init";
+
 #define FATAL_ERROR_TEST_NAME            "10"
 #define FATAL_ERROR_DESCRIPTION          "asserting with non-NULL strings..."
-#define FATAL_ERROR_EXPECTED_SOURCE      INTERNAL_ERROR_RTEMS_API
+#define FATAL_ERROR_EXPECTED_SOURCE      RTEMS_FATAL_SOURCE_ASSERT
 #define FATAL_ERROR_EXPECTED_IS_INTERNAL FALSE
-#define FATAL_ERROR_EXPECTED_ERROR       0
+#define FATAL_ERROR_EXPECTED_ERROR       ((rtems_fatal_code) func)
 
 void force_error()
 {
-  __assert_func( __FILE__, __LINE__, "Init", "forced" );
+  __assert_func( __FILE__, __LINE__, func, "forced" );
 
   /* we will not run this far */
 }
diff --git a/testsuites/sptests/spfatal11/testcase.h b/testsuites/sptests/spfatal11/testcase.h
index 43a4ab2..055b95c 100644
--- a/testsuites/sptests/spfatal11/testcase.h
+++ b/testsuites/sptests/spfatal11/testcase.h
@@ -12,7 +12,7 @@
 
 #define FATAL_ERROR_TEST_NAME            "11"
 #define FATAL_ERROR_DESCRIPTION          "asserting with non-NULL strings..."
-#define FATAL_ERROR_EXPECTED_SOURCE      INTERNAL_ERROR_RTEMS_API
+#define FATAL_ERROR_EXPECTED_SOURCE      RTEMS_FATAL_SOURCE_ASSERT
 #define FATAL_ERROR_EXPECTED_IS_INTERNAL FALSE
 #define FATAL_ERROR_EXPECTED_ERROR       0
 
-- 
1.7.7




More information about the devel mailing list