4.115
Line | |
---|
1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Evaluate Assertion |
---|
5 | * @ingroup libcsupport |
---|
6 | */ |
---|
7 | |
---|
8 | /* |
---|
9 | * COPYRIGHT (c) 2007. |
---|
10 | * On-Line Applications Research Corporation (OAR). |
---|
11 | * |
---|
12 | * The license and distribution terms for this file may be |
---|
13 | * found in the file LICENSE in this distribution or at |
---|
14 | * http://www.rtems.com/license/LICENSE. |
---|
15 | */ |
---|
16 | |
---|
17 | #if HAVE_CONFIG_H |
---|
18 | #include "config.h" |
---|
19 | #endif |
---|
20 | |
---|
21 | #include <rtems/bspIo.h> |
---|
22 | #include <rtems.h> |
---|
23 | |
---|
24 | #if defined(RTEMS_NEWLIB) && !defined(HAVE___ASSERT_FUNC) |
---|
25 | |
---|
26 | /** |
---|
27 | * Newlib 1.16.0 added this method. Together these provide an |
---|
28 | * RTEMS safe, low memory implementation. |
---|
29 | */ |
---|
30 | void __assert_func( |
---|
31 | const char *file, |
---|
32 | int line, |
---|
33 | const char *func, |
---|
34 | const char *failedexpr |
---|
35 | ) |
---|
36 | { |
---|
37 | printk("assertion \"%s\" failed: file \"%s\", line %d%s%s\n", |
---|
38 | failedexpr, |
---|
39 | file, |
---|
40 | line, |
---|
41 | (func) ? ", function: " : "", |
---|
42 | (func) ? func : "" |
---|
43 | ); |
---|
44 | rtems_fatal( RTEMS_FATAL_SOURCE_ASSERT, (rtems_fatal_code) func ); |
---|
45 | } |
---|
46 | #endif |
---|
47 | |
---|
48 | #if defined(RTEMS_NEWLIB) && !defined(HAVE___ASSERT) |
---|
49 | |
---|
50 | /** |
---|
51 | * small RTEMS Specific Implementation |
---|
52 | */ |
---|
53 | void __assert( |
---|
54 | const char *file, |
---|
55 | int line, |
---|
56 | const char *failedexpr |
---|
57 | ) |
---|
58 | { |
---|
59 | __assert_func (file, line, NULL, failedexpr); |
---|
60 | } |
---|
61 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.