Skip to content

File syn_compiler.h

FileList > common > syn_compiler.h

Go to the source code of this file

Compiler-portable macros for SyntropicOS. More...

Macros

Type Name
define SYN_ALIGN (n)
define SYN_COMPILER_BARRIER () ((void)0)
define SYN_COMPILER_UNKNOWN 1
Compiler could not be identified.
define SYN_FALLTHROUGH
define SYN_INLINE static inline
define SYN_NORETURN
define SYN_PACKED
define SYN_SECTION (name)
define SYN_STATIC_ASSERT (expr, msg) typedef char [**SYN\_STATIC\_ASSERT\_JOIN**](syn__compiler_8h.md#define-syn_static_assert_join)(syn\_static\_assert\_, \_\_LINE\_\_)[(expr) ? 1 : -1]
Compile-time assertion (C99 fallback).
define SYN_STATIC_ASSERT_JOIN (a, b) [**SYN\_STATIC\_ASSERT\_JOIN2**](syn__compiler_8h.md#define-syn_static_assert_join2)(a, b)
Token-pasting helper for SYN_STATIC_ASSERT.
define SYN_STATIC_ASSERT_JOIN2 (a, b) a##b
define SYN_UNUSED
define SYN_WEAK

Detailed Description

Abstracts compiler-specific attributes and intrinsics so the rest of the library (and user code) can use a single set of macros across GCC, Clang, ARMCC (Keil), and IAR.

Macro Definition Documentation

define SYN_ALIGN

#define SYN_ALIGN (
    n
) 

Align a variable to N bytes.


define SYN_COMPILER_BARRIER

#define SYN_COMPILER_BARRIER (

) `((void)0)`

Prevent the compiler from reordering loads/stores across this point. Zero runtime cost — does NOT emit a hardware fence instruction. Pair with syn_port_memory_barrier() when cross-core visibility is needed.


define SYN_COMPILER_UNKNOWN

Compiler could not be identified.

#define SYN_COMPILER_UNKNOWN `1`


define SYN_FALLTHROUGH

#define SYN_FALLTHROUGH 

Suppress -Wimplicit-fallthrough warnings for intentional fallthrough.


define SYN_INLINE

#define SYN_INLINE `static inline`

Portable always-inline hint.


define SYN_NORETURN

#define SYN_NORETURN 

Mark a function that never returns (e.g. fault handlers).


define SYN_PACKED

#define SYN_PACKED 

Pack a struct (place after the closing brace, before the semicolon).


define SYN_SECTION

#define SYN_SECTION (
    name
) 

Place a symbol in a named linker section.


define SYN_STATIC_ASSERT

Compile-time assertion (C99 fallback).

#define SYN_STATIC_ASSERT (
    expr,
    msg
) `typedef char SYN_STATIC_ASSERT_JOIN (syn_static_assert_, __LINE__)[(expr) ? 1 : -1]`


define SYN_STATIC_ASSERT_JOIN

Token-pasting helper for SYN_STATIC_ASSERT.

#define SYN_STATIC_ASSERT_JOIN (
    a,
    b
) `SYN_STATIC_ASSERT_JOIN2 (a, b)`


define SYN_STATIC_ASSERT_JOIN2

#define SYN_STATIC_ASSERT_JOIN2 (
    a,
    b
) `a##b`

Compile-time assertion. Uses C11 _Static_assert when available.


define SYN_UNUSED

#define SYN_UNUSED 

Suppress "unused variable/parameter" warnings.


define SYN_WEAK

#define SYN_WEAK 

Mark a function as a weak symbol so the user can override it.



The documentation for this class was generated from the following file src/syntropic/common/syn_compiler.h