summaryrefslogtreecommitdiff
path: root/src/common/compiler
diff options
context:
space:
mode:
authorhathach <[email protected]>2019-04-19 00:49:32 +0700
committerGitHub <[email protected]>2019-04-19 00:49:32 +0700
commitee3504fdb06ad83a0d4896b56a4181c114fda703 (patch)
treeb88a4144ee3fc2799268e6f51869756eea18ba23 /src/common/compiler
parent074898099da6bfd8784019d97c64712f73b779b0 (diff)
parent6796026476e14fc82402cdbd2dc4418f51240ae5 (diff)
Merge pull request #56 from hathach/develop
refactor hid device, remove auto descriptor, update example
Diffstat (limited to 'src/common/compiler')
-rw-r--r--src/common/compiler/tusb_compiler_gcc.h23
-rw-r--r--src/common/compiler/tusb_compiler_iar.h6
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