We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d640472 commit fb27e71Copy full SHA for fb27e71
platform/mbed_toolchain.h
@@ -92,6 +92,26 @@
92
#endif
93
94
95
+/** MBED_USED
96
+ * Inform the compiler that a static variable is to be retained in the object file, even if it is unreferenced.
97
+ *
98
+ * @code
99
+ * #include "mbed_toolchain.h"
100
101
+ * MBED_USED int foo;
102
103
+ * @endcode
104
+ */
105
+#ifndef MBED_USED
106
+#if defined(__GNUC__) || defined(__clang__) || defined(__CC_ARM)
107
+#define MBED_USED __attribute__((used))
108
+#elif defined(__ICCARM__)
109
+#define MBED_USED __root
110
+#else
111
+#define MBED_USED
112
+#endif
113
114
+
115
/** MBED_WEAK
116
* Mark a function as being weak.
117
*
0 commit comments