source: rtems/cpukit/libcsupport/src/__assert.c @ a0c7aa55

4.11
Last change on this file since a0c7aa55 was a0c7aa55, checked in by Sebastian Huber <sebastian.huber@…>, on Nov 14, 2012 at 1:54:09 PM

score: Add RTEMS_FATAL_SOURCE_ASSERT

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