From a0c7aa555562ec4248882e808abe91996f248cc2 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 14 Nov 2012 14:54:09 +0100 Subject: score: Add RTEMS_FATAL_SOURCE_ASSERT --- 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 5adefdf632..07af01bc40 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 b316fbfd9f..20efcb3e0b 100644 --- a/cpukit/score/include/rtems/score/interr.h +++ b/cpukit/score/include/rtems/score/interr.h @@ -83,6 +83,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. * diff --git a/testsuites/sptests/spfatal10/testcase.h b/testsuites/sptests/spfatal10/testcase.h index 6d011ce2dd..9af96d9637 100644 --- a/testsuites/sptests/spfatal10/testcase.h +++ b/testsuites/sptests/spfatal10/testcase.h @@ -10,15 +10,17 @@ #include +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 43a4ab267d..055b95cc73 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 -- cgit v1.2.3