diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-11-14 14:54:09 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-11-15 15:33:13 +0100 |
commit | a0c7aa555562ec4248882e808abe91996f248cc2 (patch) | |
tree | 781a78158035d4c10f8e3c0a21c7c0774ea5392c | |
parent | bsps/powerpc: Exception initialization error is fatal (diff) | |
download | rtems-a0c7aa555562ec4248882e808abe91996f248cc2.tar.bz2 |
score: Add RTEMS_FATAL_SOURCE_ASSERT
-rw-r--r-- | cpukit/libcsupport/src/__assert.c | 2 | ||||
-rw-r--r-- | cpukit/score/include/rtems/score/interr.h | 7 | ||||
-rw-r--r-- | testsuites/sptests/spfatal10/testcase.h | 8 | ||||
-rw-r--r-- | 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 @@ -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 6d011ce2dd..9af96d9637 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 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 |