tinyusb
compiler_gcc.h
Go to the documentation of this file.
1 /**************************************************************************/
37 /**************************************************************************/
38 
48 #ifndef _TUSB_COMPILER_GCC_H_
49 #define _TUSB_COMPILER_GCC_H_
50 
51 #ifdef __cplusplus
52  extern "C" {
53 #endif
54 
55 #define ALIGN_OF(x) __alignof__(x)
56 
58 #define ATTR_SECTION(sec_name) __attribute__ (( section(#sec_name) ))
59 
61 #define ATTR_ERROR(Message) __attribute__ ((error(Message)))
62 
64 #define ATTR_WARNING(Message) __attribute__ ((warning(Message)))
65 
71 #define ATTR_ALIGNED(Bytes) __attribute__ ((aligned(Bytes)))
73 
75 #define ATTR_PACKED __attribute__ ((packed))
76 
77 #define ATTR_PREPACKED
78 
79 #define ATTR_PACKED_STRUCT(x) x __attribute__ ((packed))
80 
87 #ifndef ATTR_ALWAYS_INLINE
88 #define ATTR_ALWAYS_INLINE __attribute__ ((always_inline))
90 #endif
91 
93 #define ATTR_NON_NULL __attribute__ ((nonull))
94 
96 #define ATTR_PURE __attribute__ ((pure))
97 
100 #define ATTR_CONST __attribute__ ((const))
101 
103 #define ATTR_DEPRECATED __attribute__ ((deprecated))
104 
106 #define ATTR_DEPRECATED_MESS(mess) __attribute__ ((deprecated(mess)))
107 
109 #define ATTR_WEAK __attribute__ ((weak))
110 
112 #define ATTR_ALIAS(func) __attribute__ ((alias(#func)))
113 
115 #define ATTR_WEAKREF(func) __attribute__ ((weakref(#func)))
116 
118 #define ATTR_WARN_UNUSED_RESULT __attribute__ ((warn_unused_result))
119 
121 #define ATTR_USED __attribute__ ((used))
122 
124 #define ATTR_UNUSED __attribute__ ((unused))
125 
133 // TODO mcu specific
134 #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
135 #define __n2be(x) __REV(x)
136 #define __be2n(x) __n2be(x)
137 
138 #define __n2be_16(u16) ((uint16_t) __REV16(u16))
139 #define __be2n_16(u16) __n2be_16(u16)
140 #endif
141 
144 #ifdef __cplusplus
145  }
146 #endif
147 
148 #endif /* _TUSB_COMPILER_GCC_H_ */
149