source: rtems/cpukit/include/rtems/score/assert.h @ 21275b58

5
Last change on this file since 21275b58 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: 2.7 KB
Line 
1/*
2 * Copyright (c) 2013-2014 embedded brains GmbH.  All rights reserved.
3 *
4 *  embedded brains GmbH
5 *  Dornierstr. 4
6 *  82178 Puchheim
7 *  Germany
8 *  <rtems@embedded-brains.de>
9 *
10 * The license and distribution terms for this file may be
11 * found in the file LICENSE in this distribution or at
12 * http://www.rtems.org/license/LICENSE.
13 */
14
15#ifndef _RTEMS_SCORE_ASSERT_H
16#define _RTEMS_SCORE_ASSERT_H
17
18#include <rtems/score/basedefs.h>
19
20#if defined( RTEMS_DEBUG )
21  #include <assert.h>
22#endif
23
24#ifdef __cplusplus
25extern "C" {
26#endif /* __cplusplus */
27
28/**
29 * @brief Assertion similar to assert() controlled via RTEMS_DEBUG instead of
30 * NDEBUG.
31 */
32#if defined( RTEMS_DEBUG )
33
34  /**
35   * @brief Macro with method name used in assert output
36   *
37   * Given the variations in compilers and standards, we have to poke a bit.
38   *
39   * @note This is based on the code in newlib's assert.h.
40   */
41  #ifndef __RTEMS_ASSERT_FUNCTION
42    /* Use g++'s demangled names in C++.  */
43    #if defined __cplusplus && defined __GNUC__
44      #define __RTEMS_ASSERT_FUNCTION __PRETTY_FUNCTION__
45
46    /* C99 requires the use of __func__.  */
47    #elif __STDC_VERSION__ >= 199901L
48      #define __RTEMS_ASSERT_FUNCTION __func__
49
50    /* Older versions of gcc don't have __func__ but can use __FUNCTION__.  */
51    #elif __GNUC__ >= 2
52      #define __RTEMS_ASSERT_FUNCTION __FUNCTION__
53
54    /* failed to detect __func__ support.  */
55    #else
56      #define __RTEMS_ASSERT_FUNCTION ((char *) 0)
57    #endif
58  #endif /* !__RTEMS_ASSERT_FUNCTION */
59
60  #if !defined( RTEMS_SCHEDSIM )
61    /* normal build is newlib. */
62
63    void __assert_func(const char *, int, const char *, const char *)
64      RTEMS_NO_RETURN;
65
66    #define _Assert( _e ) \
67       ( ( _e ) ? \
68         ( void ) 0 : \
69           __assert_func( __FILE__, __LINE__, __RTEMS_ASSERT_FUNCTION, #_e ) )
70
71  #elif defined(__linux__)
72    /* Scheduler simulator has only beed tested on glibc. */
73    #define _Assert( _e ) \
74     ( ( _e ) ? \
75       ( void ) 0 : \
76         __assert_fail( #_e, __FILE__, __LINE__, __RTEMS_ASSERT_FUNCTION ) )
77  #else
78    #error "Implement RTEMS assert support for this C Library"
79  #endif
80
81#else
82  #define _Assert( _e ) ( ( void ) 0 )
83#endif
84
85/**
86 * @brief Like _Assert(), but only armed if RTEMS_SMP is defined.
87 */
88#if defined( RTEMS_SMP )
89  #define _SMP_Assert( _e ) _Assert( _e )
90#else
91  #define _SMP_Assert( _e ) ( ( void ) 0 )
92#endif
93
94/**
95 * @brief Returns true if thread dispatching is allowed.
96 *
97 * Thread dispatching can be repressed via _Thread_Disable_dispatch() or
98 * _ISR_Local_disable().
99 */
100#if defined( RTEMS_DEBUG )
101  bool _Debug_Is_thread_dispatching_allowed( void );
102#endif
103
104#ifdef __cplusplus
105}
106#endif /* __cplusplus */
107
108#endif /* _RTEMS_SCORE_ASSERT_H */
Note: See TracBrowser for help on using the repository browser.