source: rtems/cpukit/include/rtems/error.h @ 878487b0

5
Last change on this file since 878487b0 was 2afb22b, checked in by Chris Johns <chrisj@…>, on 12/23/17 at 07:18:56

Remove make preinstall

A speciality of the RTEMS build system was the make preinstall step. It
copied header files from arbitrary locations into the build tree. The
header files were included via the -Bsome/build/tree/path GCC command
line option.

This has at least seven problems:

  • The make preinstall step itself needs time and disk space.
  • Errors in header files show up in the build tree copy. This makes it hard for editors to open the right file to fix the error.
  • There is no clear relationship between source and build tree header files. This makes an audit of the build process difficult.
  • The visibility of all header files in the build tree makes it difficult to enforce API barriers. For example it is discouraged to use BSP-specifics in the cpukit.
  • An introduction of a new build system is difficult.
  • Include paths specified by the -B option are system headers. This may suppress warnings.
  • The parallel build had sporadic failures on some hosts.

This patch removes the make preinstall step. All installed header
files are moved to dedicated include directories in the source tree.
Let @RTEMS_CPU@ be the target architecture, e.g. arm, powerpc, sparc,
etc. Let @RTEMS_BSP_FAMILIY@ be a BSP family base directory, e.g.
erc32, imx, qoriq, etc.

The new cpukit include directories are:

  • cpukit/include
  • cpukit/score/cpu/@RTEMS_CPU@/include
  • cpukit/libnetworking

The new BSP include directories are:

  • bsps/include
  • bsps/@RTEMS_CPU@/include
  • bsps/@RTEMS_CPU@/@RTEMS_BSP_FAMILIY@/include

There are build tree include directories for generated files.

The include directory order favours the most general header file, e.g.
it is not possible to override general header files via the include path
order.

The "bootstrap -p" option was removed. The new "bootstrap -H" option
should be used to regenerate the "headers.am" files.

Update #3254.

  • Property mode set to 100644
File size: 3.5 KB
Line 
1/**
2 * @file rtems/error.h
3 *
4 * @brief RTEMS Error Reporting
5 *
6 * Defines and externs for rtems error reporting
7 *
8 * These routines provide general purpose error reporting.
9 * rtems_error reports an error to stderr and allows use of
10 * printf style formatting.  A newline is appended to all messages.
11 *
12 * error_flag can be specified as any of the following:
13 *
14 *  RTEMS_ERROR_ERRNO       -- include errno text in output
15 *  RTEMS_ERROR_PANIC       -- halts local system after output
16 *  RTEMS_ERROR_ABORT       -- abort after output
17 *
18 * It can also include a rtems_status value which can be OR'd
19 * with the above flags. *
20 *
21 * Example 1:
22 * @code
23 *  #include <rtems.h>
24 *  #include <rtems/error.h>
25 *  rtems_error(0, "stray interrupt %d", intr);
26 * @endcode
27 *
28 * Example 2:
29 * @code
30 *        if ((status = rtems_task_create(...)) != RTEMS_SUCCCESSFUL)
31 *        {
32 *            rtems_error(status | RTEMS_ERROR_ABORT,
33 *                        "could not create task");
34 *        }
35 * @endcode
36 *
37 * Example 3:
38 * @code
39 *        if ((fd = open(pathname, O_RDNLY)) < 0)
40 *        {
41 *            rtems_error(RTEMS_ERROR_ERRNO, "open of '%s' failed", pathname);
42 *            goto failed;
43 *        }
44 * @endcode
45 */
46
47#ifndef _RTEMS_RTEMS_ERROR_H
48#define _RTEMS_RTEMS_ERROR_H
49
50#include <rtems/rtems/status.h>
51#include <rtems/fatal.h>
52
53#include <stdarg.h>
54
55#ifdef __cplusplus
56extern "C" {
57#endif
58
59/**
60 *  @defgroup ErrorPanicSupport Error And Panic Support
61 *
62 *  @ingroup libcsupport
63 *
64 *  @brief Defines and externs for rtems error reporting
65 *
66 */
67typedef Internal_errors_t rtems_error_code_t;
68
69/*
70 * rtems_error(), rtems_verror() and rtems_panic() support
71 */
72
73#if 0
74/* not 16bit-int host clean */
75#define RTEMS_ERROR_ERRNO  (1<<((sizeof(rtems_error_code_t) * CHAR_BIT) - 2)) /* hi bit; use 'errno' */
76#define RTEMS_ERROR_PANIC  (RTEMS_ERROR_ERRNO / 2)       /* err fatal; no return */
77#define RTEMS_ERROR_ABORT  (RTEMS_ERROR_ERRNO / 4)       /* err is fatal; panic */
78#else
79#define RTEMS_ERROR_ERRNO  (0x40000000) /* hi bit; use 'errno' */
80#define RTEMS_ERROR_PANIC  (0x20000000) /* err fatal; no return */
81#define RTEMS_ERROR_ABORT  (0x10000000) /* err is fatal; panic */
82#endif
83
84#define RTEMS_ERROR_MASK \
85  (RTEMS_ERROR_ERRNO | RTEMS_ERROR_ABORT | RTEMS_ERROR_PANIC) /* all */
86
87/**
88 *  @brief Report an Error
89 *
90 *  @param[in] error_code can be specified as any of the following:
91 *  RTEMS_ERROR_ERRNO       -- include errno text in output
92 *  RTEMS_ERROR_PANIC       -- halts local system after output
93 *  RTEMS_ERROR_ABORT       -- abort after output
94 *
95 *  @param[in] printf_format is a normal printf(3) format string,
96 *  with its concommitant arguments
97 *
98 *  @return the number of characters written.
99 */
100int   rtems_error(
101  rtems_error_code_t error_code,
102  const char *printf_format,
103  ...
104);
105
106/**
107 *  @brief Report an Error
108 *
109 *  @param[in] error_code can be specified as any of the following:
110 *  RTEMS_ERROR_ERRNO       -- include errno text in output
111 *  RTEMS_ERROR_PANIC       -- halts local system after output
112 *  RTEMS_ERROR_ABORT       -- abort after output
113 *
114 *  @param[in] printf_format is a normal printf(3) format string,
115 *  with its concommitant arguments
116 *  @param[in] arglist is a varargs list corresponding to
117 *  printf_format
118 *
119 *  @return the number of characters written.
120 */
121int rtems_verror(
122  rtems_error_code_t  error_code,
123  const char         *printf_format,
124  va_list             arglist
125);
126
127extern int rtems_panic_in_progress;
128
129#ifdef __cplusplus
130}
131#endif
132
133
134#endif
135/* end of include file */
Note: See TracBrowser for help on using the repository browser.