5
Last change
on this file since 658ec75 was
658ec75,
checked in by Sebastian Huber <sebastian.huber@…>, on 10/18/18 at 12:28:17
|
Remove assert()
This function is provided by Newlib since 2000.
Update #3409.
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Evaluate Assertion |
---|
5 | * @ingroup libcsupport |
---|
6 | */ |
---|
7 | |
---|
8 | /* |
---|
9 | * COPYRIGHT (c) 2007-2013. |
---|
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.org/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 | #include <assert.h> |
---|
26 | |
---|
27 | /** |
---|
28 | * Newlib 1.16.0 added this method. Together these provide an |
---|
29 | * RTEMS safe, low memory implementation. |
---|
30 | */ |
---|
31 | void __assert_func( |
---|
32 | const char *file, |
---|
33 | int line, |
---|
34 | const char *func, |
---|
35 | const char *failedexpr |
---|
36 | ) |
---|
37 | { |
---|
38 | rtems_assert_context assert_context = { |
---|
39 | .file = file, |
---|
40 | .line = line, |
---|
41 | .function = func, |
---|
42 | .failed_expression = failedexpr |
---|
43 | }; |
---|
44 | |
---|
45 | printk("assertion \"%s\" failed: file \"%s\", line %d%s%s\n", |
---|
46 | failedexpr, |
---|
47 | file, |
---|
48 | line, |
---|
49 | (func) ? ", function: " : "", |
---|
50 | (func) ? func : "" |
---|
51 | ); |
---|
52 | rtems_fatal( RTEMS_FATAL_SOURCE_ASSERT, (rtems_fatal_code) &assert_context ); |
---|
53 | } |
---|
54 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.