Speeduino
Loading...
Searching...
No Matches
preprocessor.h
Go to the documentation of this file.
1#pragma once
2
8#if !defined(UNUSED)
10#define UNUSED(x) \
11 (void)(x)
12#endif
13
14// Native GCC provides _countof(), but it doesn't work on an array *within*
15// a packed struct
16#if defined(NATIVE_BOARD)
17#undef _countof
18#endif
19
21#if !defined(_countof)
22#define _countof(x) \
23 (sizeof((x)) / sizeof ((x)[0]))
24#endif
25
27#if !defined(_end_range_address)
28#define _end_range_address(array) \
29 ((array) + _countof((array)))
30#endif
31
33#if !defined(_end_range_byte_address)
34#define _end_range_byte_address(array) \
35 (((byte*)(array)) + sizeof((array)))
36#endif
37
39#if !defined(PP_INC)
40#define PP_INC(x) \
41 PP_INC_I(x)
42#endif
43
45// PP_INC() support macros
46#define PP_INC_I(x) PP_INC_ ## x
47#define PP_INC_0 1 // NOSONAR
48#define PP_INC_1 2 // NOSONAR
49#define PP_INC_2 3 // NOSONAR
50#define PP_INC_3 4 // NOSONAR
51#define PP_INC_4 5 // NOSONAR
52#define PP_INC_5 6 // NOSONAR
53#define PP_INC_6 7 // NOSONAR
54#define PP_INC_7 8 // NOSONAR
55#define PP_INC_8 9 // NOSONAR
56#define PP_INC_9 10 // NOSONAR
57#define PP_INC_10 11 // NOSONAR
58#define PP_INC_11 12 // NOSONAR
59#define PP_INC_12 13 // NOSONAR
61
63// CONCAT() support macros
64#define CAT_HELPER(a, b) a ## b
66
68#if !defined(CONCAT)
69#define CONCAT(A, B) \
70 CAT_HELPER(A, B)
71#endif
72
74#define BEGIN_LTO_ALWAYS_INLINE(returnType) \
75 _Pragma("GCC diagnostic push") \
76 _Pragma("GCC diagnostic ignored \"-Wattributes\"") \
77 returnType __attribute__((always_inline)) // cppcheck-suppress misra-c2012-20.7
78#define END_LTO_INLINE() \
79 _Pragma("GCC diagnostic pop")