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 12, 2024
1 parent ae364b1 commit fd4c1e7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/common/tusb_compiler.h
Expand Up @@ -123,11 +123,15 @@
//--------------------------------------------------------------------+

// 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))
#define TU_ATTR_WEAK __attribute__ ((weak))
#if defined(__clang__)
#define TU_ATTR_WEAK __attribute__ ((weak_import))
#else
#define TU_ATTR_WEAK __attribute__ ((weak))
#endif
#ifndef TU_ATTR_ALWAYS_INLINE // allow to override for debug
#define TU_ATTR_ALWAYS_INLINE __attribute__ ((always_inline))
#endif
Expand Down

0 comments on commit fd4c1e7

Please sign in to comment.