|
131 | 131 | #define TU_ATTR_BIT_FIELD_ORDER_BEGIN |
132 | 132 | #define TU_ATTR_BIT_FIELD_ORDER_END |
133 | 133 |
|
| 134 | + #if __has_attribute(__fallthrough__) |
| 135 | + #define TU_ATTR_FALLTHROUGH __attribute__((fallthrough)) |
| 136 | + #else |
| 137 | + #define TU_ATTR_FALLTHROUGH do {} while (0) /* fallthrough */ |
| 138 | + #endif |
| 139 | + |
134 | 140 | // Endian conversion use well-known host to network (big endian) naming |
135 | 141 | #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ |
136 | 142 | #define TU_BYTE_ORDER TU_LITTLE_ENDIAN |
|
156 | 162 | #define TU_ATTR_DEPRECATED(mess) __attribute__ ((deprecated(mess))) // warn if function with this attribute is used |
157 | 163 | #define TU_ATTR_UNUSED __attribute__ ((unused)) // Function/Variable is meant to be possibly unused |
158 | 164 | #define TU_ATTR_USED __attribute__ ((used)) |
| 165 | + #define TU_ATTR_FALLTHROUGH __attribute__((fallthrough)) |
159 | 166 |
|
160 | 167 | #define TU_ATTR_PACKED_BEGIN |
161 | 168 | #define TU_ATTR_PACKED_END |
|
182 | 189 | #define TU_ATTR_DEPRECATED(mess) __attribute__ ((deprecated(mess))) // warn if function with this attribute is used |
183 | 190 | #define TU_ATTR_UNUSED __attribute__ ((unused)) // Function/Variable is meant to be possibly unused |
184 | 191 | #define TU_ATTR_USED __attribute__ ((used)) // Function/Variable is meant to be used |
| 192 | + #define TU_ATTR_FALLTHROUGH __attribute__((fallthrough)) |
185 | 193 |
|
186 | 194 | #define TU_ATTR_PACKED_BEGIN |
187 | 195 | #define TU_ATTR_PACKED_END |
|
207 | 215 | #define TU_ATTR_DEPRECATED(mess) |
208 | 216 | #define TU_ATTR_UNUSED |
209 | 217 | #define TU_ATTR_USED |
| 218 | + #define TU_ATTR_FALLTHROUGH do {} while (0) /* fallthrough */ |
210 | 219 |
|
211 | 220 | #define TU_ATTR_PACKED_BEGIN _Pragma("pack") |
212 | 221 | #define TU_ATTR_PACKED_END _Pragma("packoption") |
|
227 | 236 | #error "Compiler attribute porting is required" |
228 | 237 | #endif |
229 | 238 |
|
| 239 | + |
230 | 240 | #if (TU_BYTE_ORDER == TU_LITTLE_ENDIAN) |
231 | 241 |
|
232 | 242 | #define tu_htons(u16) (TU_BSWAP16(u16)) |
|
0 commit comments