source: rtems/cpukit/libcsupport/include/rtems/error.h @ c38407e

4.104.115
Last change on this file since c38407e was c38407e, checked in by Ralf Corsepius <ralf.corsepius@…>, on 10/22/09 at 11:20:44

2009-10-22 Ralf Corsépius <ralf.corsepius@…>

  • libcsupport/include/rtems/error.h: Use ordinal constants for RTEMS_ERROR_ERRNO, RTEMS_ERROR_PANIC, RTEMS_ERROR_ABORT to avoid implicit constant conversion overflows on 16bit-int targets.
  • Property mode set to 100644
File size: 1.5 KB
Line 
1/**
2 * @file rtems/error.h
3 */
4
5/*
6 *  Defines and externs for rtems error reporting
7 *
8 *  $Id$
9 */
10
11#ifndef _RTEMS_RTEMS_ERROR_H
12#define _RTEMS_RTEMS_ERROR_H
13
14#include <rtems/score/interr.h>
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20typedef Internal_errors_t rtems_error_code_t;
21
22/*
23 * rtems_error() and rtems_panic() support
24 */
25
26#if 0
27/* not 16bit-int host clean */
28#define RTEMS_ERROR_ERRNO  (1<<((sizeof(rtems_error_code_t) * CHAR_BIT) - 2)) /* hi bit; use 'errno' */
29#define RTEMS_ERROR_PANIC  (RTEMS_ERROR_ERRNO / 2)       /* err fatal; no return */
30#define RTEMS_ERROR_ABORT  (RTEMS_ERROR_ERRNO / 4)       /* err is fatal; panic */
31#else
32#define RTEMS_ERROR_ERRNO  (0x40000000) /* hi bit; use 'errno' */
33#define RTEMS_ERROR_PANIC  (0x20000000) /* err fatal; no return */
34#define RTEMS_ERROR_ABORT  (0x10000000) /* err is fatal; panic */
35#endif
36
37#define RTEMS_ERROR_MASK  (RTEMS_ERROR_ERRNO | RTEMS_ERROR_ABORT | \
38                             RTEMS_ERROR_PANIC) /* all */
39
40const char *rtems_status_text(rtems_status_code);
41int   rtems_error(rtems_error_code_t error_code, const char *printf_format, ...);
42#ifdef __GNUC__
43void  rtems_panic(const char *printf_format, ...);
44/*
45 *  We should be able to use this attribute but gcc complains that
46 *  rtems_panic does in fact return. :(
47 *
48 *      __attribute__ ((__noreturn__));
49 */
50#else
51void  rtems_panic(const char *printf_format, ...);
52#endif
53
54extern int rtems_panic_in_progress;
55
56#ifdef __cplusplus
57}
58#endif
59
60
61#endif
62/* end of include file */
Note: See TracBrowser for help on using the repository browser.