diff options
| author | hathach <[email protected]> | 2019-04-11 00:20:54 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2019-04-11 00:22:18 +0700 |
| commit | 61021831935cb6e93979cecfdd414a8d6a2219fe (patch) | |
| tree | 7ecf7c32172f8e593412bb0a8084e7f02fa62f39 /src/common/compiler | |
| parent | 64bed848d07b8de37cc94c9b64be3e92fa12739d (diff) | |
clean up
Diffstat (limited to 'src/common/compiler')
| -rw-r--r-- | src/common/compiler/tusb_compiler_gcc.h | 23 | ||||
| -rw-r--r-- | src/common/compiler/tusb_compiler_iar.h | 6 |
2 files changed, 9 insertions, 20 deletions
diff --git a/src/common/compiler/tusb_compiler_gcc.h b/src/common/compiler/tusb_compiler_gcc.h index a3b84116f..bb2d0b56b 100644 --- a/src/common/compiler/tusb_compiler_gcc.h +++ b/src/common/compiler/tusb_compiler_gcc.h @@ -35,34 +35,25 @@ extern "C" { #endif -#define ALIGN_OF(x) __alignof__(x) +#define ALIGN_OF(x) __alignof__(x) -/// This attribute specifies a minimum alignment for the variable or structure field, measured in bytes +// Specifies a minimum alignment for the variable or structure field, measured in bytes #define ATTR_ALIGNED(Bytes) __attribute__ ((aligned(Bytes))) -/// Place variable in a specific section +// Place variable in a specific section #define ATTR_SECTION(sec_name) __attribute__ (( section(#sec_name) )) -/// The packed attribute specifies that a variable or structure field should have -/// the smallest possible alignment—one byte for a variable, and one bit for a field. +// Packed struct/variable into smallest possible size #define ATTR_PACKED __attribute__ ((packed)) #define ATTR_PREPACKED -/// This attribute inlines the function even if no optimization level is specified -#define ATTR_ALWAYS_INLINE __attribute__ ((always_inline)) - -/// The deprecated attribute results in a warning if the function is used anywhere in the source file. -/// This is useful when identifying functions that are expected to be removed in a future version of a program. +// The deprecated attribute results in a warning if the function is used. #define ATTR_DEPRECATED(mess) __attribute__ ((deprecated(mess))) -/// The weak attribute causes the declaration to be emitted as a weak symbol rather than a global. -/// This is primarily useful in defining library functions that can be overridden in user code +// The weak attribute causes the declaration to be emitted as a weak symbol rather than a global. #define ATTR_WEAK __attribute__ ((weak)) -/// Warn if a caller of the function with this attribute does not use its return value. -#define ATTR_WARN_UNUSED_RESULT __attribute__ ((warn_unused_result)) - -/// Function is meant to be possibly unused. GCC does not produce a warning for this function. +// Function/Variable is meant to be possibly unused (thus no warning) #define ATTR_UNUSED __attribute__ ((unused)) // TODO mcu specific diff --git a/src/common/compiler/tusb_compiler_iar.h b/src/common/compiler/tusb_compiler_iar.h index 29bec875f..326a40031 100644 --- a/src/common/compiler/tusb_compiler_iar.h +++ b/src/common/compiler/tusb_compiler_iar.h @@ -36,12 +36,8 @@ //#define ATTR_SECTION(section) _Pragma((#section))
#define ATTR_PREPACKED __packed
#define ATTR_PACKED
-
-#define ATTR_ALWAYS_INLINE
#define ATTR_DEPRECATED(mess)
#define ATTR_WEAK __weak
-
-#define ATTR_WARN_UNUSED_RESULT
#define ATTR_UNUSED
// built-in function to convert 32-bit Big-Endian to Little-Endian
@@ -52,6 +48,8 @@ #define __n2be_16(u16) ((uint16_t) __REV16(u16))
#define __be2n_16(u16) __n2be_16(u16)
+#error "IAR won't work due to '__packed' placement before struct"
+
#ifdef __cplusplus
}
#endif
|
