Skip to content

Commit

Permalink
Support clang compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryzee119 committed Jan 6, 2024
1 parent ae364b1 commit 45eb5bb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/common/tusb_compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
//--------------------------------------------------------------------+

// TODO refactor since __attribute__ is supported across many compiler
#if defined(__GNUC__)
#if defined(__GNUC__) || defined (__clang__)
#define TU_ATTR_ALIGNED(Bytes) __attribute__ ((aligned(Bytes)))
#define TU_ATTR_SECTION(sec_name) __attribute__ ((section(#sec_name)))
#define TU_ATTR_PACKED __attribute__ ((packed))
Expand Down Expand Up @@ -175,6 +175,11 @@
#pragma GCC poison tud_vendor_control_request_cb
#endif

#if defined (__clang__)
#undef TU_ATTR_WEAK
#define TU_ATTR_WEAK __attribute__ ((weak_import))
#endif

#elif defined(__TI_COMPILER_VERSION__)
#define TU_ATTR_ALIGNED(Bytes) __attribute__ ((aligned(Bytes)))
#define TU_ATTR_SECTION(sec_name) __attribute__ ((section(#sec_name)))
Expand Down

0 comments on commit 45eb5bb

Please sign in to comment.