[riot-notifications] [RIOT-OS/RIOT] core: introduce crossfile arrays (xfa) (#7523)

Kaspar Schleiser notifications at github.com
Sat Sep 2 00:10:24 CEST 2017


kaspar030 commented on this pull request.



> +/**
+ * @brief Define a cross-file array
+ *
+ * This macro defines the symbols necessary to use XFA_START() and XFA_END().
+ * It needs to be part of one single compilation unit.
+ *
+ * @param[in]   type    name of the cross-file array
+ * @param[in]   name    name of the cross-file array
+ */
+#define XFA_INIT(type, name) \
+    _Pragma("GCC diagnostic push") \
+    _Pragma("GCC diagnostic ignored \"-Wpedantic\"") \
+    const _XFA(name, 0_) type name [0] = {}; \
+    const _XFA(name, 9_) type name ## _end [0] = {}; \
+    _Pragma("GCC diagnostic pop") \
+    extern unsigned __xfa_dummy

Without the dummy, gcc complains about an extra ```;```:

```main.c:28:29: error: ISO C does not allow extra ‘;’ outside of a function [-Werror=pedantic]
 XFA_INIT(xfatest_t, xfatest);```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/7523#discussion_r136674052
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20170901/5034431f/attachment.html>


More information about the notifications mailing list