ChibiOS 21.11.4
Compiler portability.

Detailed Description

Compiler abstraction macros

#define CC_SECTION(s)
 Allocates a variable or function to a specific section.
#define CC_WEAK   __attribute__((weak))
 Marks a function or variable as a weak symbol.
#define CC_USED   __attribute__((used))
 Marks a function or variable as used.
#define CC_ALIGN_DATA(n)
 Enforces alignment of the variable declared afterward.
#define CC_ALIGN_CODE(n)
 Enforces alignment of a function declared afterward.
#define CC_PACK   __attribute__((packed))
 Enforces packing of the structure declared afterward.
#define CC_NO_INLINE   __attribute__((noinline))
 Marks a function as not inlineable.
#define CC_FORCE_INLINE   __attribute__((always_inline))
 Enforces a function inline.
#define CC_NO_RETURN   __attribute__((noreturn))
 Marks a function as non-returning.
#define CC_ROMCONST   const
 Enforces a variable in a ROM area.
#define CC_LIKELY(x)
 Marks a boolean expression as likely true.
#define CC_UNLIKELY(x)
 Marks a boolean expression as likely false.

Macro Definition Documentation

◆ CC_SECTION

#define CC_SECTION ( s)
Value:
__attribute__((section(s)))

Allocates a variable or function to a specific section.

Note
If the compiler does not support such a feature then this macro must not be defined or it could originate errors.

Definition at line 57 of file ccportab.h.

◆ CC_WEAK

#define CC_WEAK   __attribute__((weak))

Marks a function or variable as a weak symbol.

Note
If the compiler does not support such a feature then this macro must not be defined or it could originate errors.

Definition at line 64 of file ccportab.h.

◆ CC_USED

#define CC_USED   __attribute__((used))

Marks a function or variable as used.

The compiler or linker shall not remove the marked function or variable regardless if it is referred or not in the code.

Note
If the compiler does not support such a feature then this macro must not be defined or it could originate errors.

Definition at line 73 of file ccportab.h.

◆ CC_ALIGN_DATA

#define CC_ALIGN_DATA ( n)
Value:
__attribute__((aligned(n)))

Enforces alignment of the variable declared afterward.

Note
If the compiler does not support such a feature then this macro must not be defined or it could originate errors.

Definition at line 80 of file ccportab.h.

◆ CC_ALIGN_CODE

#define CC_ALIGN_CODE ( n)
Value:
__attribute__((aligned(n)))

Enforces alignment of a function declared afterward.

Note
If the compiler does not support such a feature then this macro must not be defined or it could originate errors.

Definition at line 87 of file ccportab.h.

◆ CC_PACK

#define CC_PACK   __attribute__((packed))

Enforces packing of the structure declared afterward.

Note
If the compiler does not support such a feature then this macro must not be defined or it could originate errors.

Definition at line 94 of file ccportab.h.

◆ CC_NO_INLINE

#define CC_NO_INLINE   __attribute__((noinline))

Marks a function as not inlineable.

Note
Can be implemented as an empty macro if not supported by the compiler.

Definition at line 101 of file ccportab.h.

◆ CC_FORCE_INLINE

#define CC_FORCE_INLINE   __attribute__((always_inline))

Enforces a function inline.

Note
Can be implemented as an empty macro if not supported by the compiler.

Definition at line 108 of file ccportab.h.

◆ CC_NO_RETURN

#define CC_NO_RETURN   __attribute__((noreturn))

Marks a function as non-returning.

Note
Can be implemented as an empty macro if not supported by the compiler.

Definition at line 115 of file ccportab.h.

◆ CC_ROMCONST

#define CC_ROMCONST   const

Enforces a variable in a ROM area.

Note
Can be implemented as an empty macro if not supported by the compiler.

Definition at line 122 of file ccportab.h.

◆ CC_LIKELY

#define CC_LIKELY ( x)
Value:
__builtin_expect(!!(x), 1)

Marks a boolean expression as likely true.

Parameters
[in]xa valid expression

Definition at line 129 of file ccportab.h.

◆ CC_UNLIKELY

#define CC_UNLIKELY ( x)
Value:
__builtin_expect(!!(x), 0)

Marks a boolean expression as likely false.

Parameters
[in]xa valid expression

Definition at line 136 of file ccportab.h.