aboutsummaryrefslogtreecommitdiff
path: root/lib/chibios/os/common/portability/GHS
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chibios/os/common/portability/GHS')
-rw-r--r--lib/chibios/os/common/portability/GHS/ccportab.h129
1 files changed, 129 insertions, 0 deletions
diff --git a/lib/chibios/os/common/portability/GHS/ccportab.h b/lib/chibios/os/common/portability/GHS/ccportab.h
new file mode 100644
index 000000000..511e1f921
--- /dev/null
+++ b/lib/chibios/os/common/portability/GHS/ccportab.h
@@ -0,0 +1,129 @@
1/*
2 ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15*/
16
17/**
18 * @file GHS/ccportab.h
19 * @brief Compiler portability layer.
20 *
21 * @defgroup CC_PORTAB Compiler portability.
22 * @{
23 */
24
25#ifndef CCPORTAB_H
26#define CCPORTAB_H
27
28/*===========================================================================*/
29/* Module constants. */
30/*===========================================================================*/
31
32/*===========================================================================*/
33/* Module pre-compile time settings. */
34/*===========================================================================*/
35
36/*===========================================================================*/
37/* Derived constants and error checks. */
38/*===========================================================================*/
39
40/*===========================================================================*/
41/* Module data structures and types. */
42/*===========================================================================*/
43
44/*===========================================================================*/
45/* Module macros. */
46/*===========================================================================*/
47
48/**
49 * @name Compiler abstraction macros
50 * @{
51 */
52/**
53 * @brief Allocates a variable or function to a specific section.
54 * @note If the compiler does not support such a feature then this macro
55 * must not be defined or it could originate errors.
56 */
57#define CC_SECTION(s) __attribute__((section(s)))
58
59/**
60 * @brief Marks a function or variable as a weak symbol.
61 * @note If the compiler does not support such a feature then this macro
62 * must not be defined or it could originate errors.
63 */
64#define CC_WEAK __attribute__((weak))
65
66/**
67 * @brief Marks a function or variable as used.
68 * @details The compiler or linker shall not remove the marked function or
69 * variable regardless if it is referred or not in the code.
70 * @note If the compiler does not support such a feature then this macro
71 * must not be defined or it could originate errors.
72 */
73#define CC_USED __attribute__((used))
74
75/**
76 * @brief Enforces alignment of the variable or function declared afterward.
77 * @note If the compiler does not support such a feature then this macro
78 * must not be defined or it could originate errors.
79 */
80#define CC_ALIGN(n) __attribute__((aligned(n)))
81
82/**
83 * @brief Enforces packing of the structure declared afterward.
84 * @note If the compiler does not support such a feature then this macro
85 * must not be defined or it could originate errors.
86 */
87#define CC_PACK __attribute__((packed))
88
89/**
90 * @brief Marks a function as not inlineable.
91 * @note Can be implemented as an empty macro if not supported by the
92 * compiler.
93 */
94#define CC_NO_INLINE __noinline
95
96/**
97 * @brief Enforces a function inline.
98 * @note Can be implemented as an empty macro if not supported by the
99 * compiler.
100 */
101#define CC_FORCE_INLINE
102
103/**
104 * @brief Marks a function as non-returning.
105 * @note Can be implemented as an empty macro if not supported by the
106 * compiler.
107 */
108#define CC_NO_RETURN __attribute__((noreturn))
109/** @} */
110
111/*===========================================================================*/
112/* External declarations. */
113/*===========================================================================*/
114
115#ifdef __cplusplus
116extern "C" {
117#endif
118
119#ifdef __cplusplus
120}
121#endif
122
123/*===========================================================================*/
124/* Module inline functions. */
125/*===========================================================================*/
126
127#endif /* CCPORTAB_H */
128
129/** @} */