Skip to content

Commit 45eb5bb

Browse files
committed
Support clang compiler
1 parent ae364b1 commit 45eb5bb

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/common/tusb_compiler.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
//--------------------------------------------------------------------+
124124

125125
// TODO refactor since __attribute__ is supported across many compiler
126-
#if defined(__GNUC__)
126+
#if defined(__GNUC__) || defined (__clang__)
127127
#define TU_ATTR_ALIGNED(Bytes) __attribute__ ((aligned(Bytes)))
128128
#define TU_ATTR_SECTION(sec_name) __attribute__ ((section(#sec_name)))
129129
#define TU_ATTR_PACKED __attribute__ ((packed))
@@ -175,6 +175,11 @@
175175
#pragma GCC poison tud_vendor_control_request_cb
176176
#endif
177177

178+
#if defined (__clang__)
179+
#undef TU_ATTR_WEAK
180+
#define TU_ATTR_WEAK __attribute__ ((weak_import))
181+
#endif
182+
178183
#elif defined(__TI_COMPILER_VERSION__)
179184
#define TU_ATTR_ALIGNED(Bytes) __attribute__ ((aligned(Bytes)))
180185
#define TU_ATTR_SECTION(sec_name) __attribute__ ((section(#sec_name)))

0 commit comments

Comments
 (0)