Files
RTOS/Base/os_compiler.h
T
2026-05-19 11:49:22 +08:00

36 lines
1.8 KiB
C

#ifndef INCLUDED_OS_COMPILER_H
#define INCLUDED_OS_COMPILER_H
#if defined(__GNUC__)
#define OS_STATIC_FORCE_INLINE static inline __attribute__((always_inline))
#define OS_ALIGNED(x) __attribute__((aligned(x)))
#define OS_WEAK __attribute__((weak))
#define OS_PACKED_STRUCT(x) struct __attribute__((packed)) x
#define OS_SECTION(n) __attribute__((section(#n)))
#define OS_NORETURN __attribute__((noreturn))
#define OS_PACKED __attribute__((packed))
#endif /*defined(__GNUC__)*/
#if defined(__CC_ARM)
#define OS_STATIC_FORCE_INLINE static inline __attribute__((always_inline))
#define OS_ALIGNED(x) __attribute__((aligned(x)))
#define OS_WEAK __attribute__((weak))
#define OS_PACKED_STRUCT(x) struct __attribute__((packed)) x
#define OS_SECTION(n) __attribute__((section(#n)))
#define OS_NORETURN __attribute__((noreturn))
#define OS_PACKED __attribute__((packed))
#endif /*defined(__CC_ARM)*/
#if defined(__IAR_SYSTEMS_ICC__)
#define OS_STATIC_FORCE_INLINE static inline
#define OS_ALIGNED(x) #pragma data_alignment(x)
#define OS_WEAK __weak
#define OS_PACKED_STRUCT(x) __packed struct x
#define OS_SECTION(n) #pragma location=#n
#define OS_NORETURN __noreturn
#define OS_PACKED __packed
#endif /*defined(__CC_ARM)*/
#endif /*INCLUDED_OS_COMPILER_H*/