summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Hughes <tomhughes@chromium.org>2021-09-20 17:59:26 +0000
committerCommit Bot <commit-bot@chromium.org>2021-09-23 17:15:22 +0000
commitc1cc2d919e9f21adc0f992dcac00f6e8b282616d (patch)
treef72c3c1529e6367e67437bf7e4e32ee914fd7900
parent541e3dee10752720c2bba7e4d81544eaa284bfc6 (diff)
downloadchrome-ec-c1cc2d919e9f21adc0f992dcac00f6e8b282616d.tar.gz
core/cortex-m: Disable warning in vecttable.c when building with clang
The vecttable logic explicitly routes unused IRQs to IRQ_UNUSED_OFFSET, and then assigns it to "null" at the very end. The result is something like: [8] = __attribute__((used, weak, alias("default_handler"))) irq_55_handler(void); [8] = __attribute__((used, weak, alias("default_handler"))) irq_56_handler(void); ... [8] = (void*)0 This is intentional so that it works with a varying values for CONFIG_IRQ_COUNT. BRANCH=none BUG=b:172020503 TEST=make buildall -j Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I3ba4eeaa46cd2c50c65c922f4c0c463ce1bb585e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3172038 Reviewed-by: Patrick Georgi <pgeorgi@chromium.org>
-rw-r--r--core/cortex-m/vecttable.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/core/cortex-m/vecttable.c b/core/cortex-m/vecttable.c
index d27962a7d8..10b4b22422 100644
--- a/core/cortex-m/vecttable.c
+++ b/core/cortex-m/vecttable.c
@@ -92,6 +92,14 @@ void svc_helper_handler()
*/
#define IRQ_UNUSED_OFFSET 8
+/* Disable warning that "initializer overrides prior initialization of this
+ * subobject", since we are explicitly doing this to handle the unused IRQs.
+ */
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Winitializer-overrides"
+#endif /* __clang__ */
+
#define table(x) \
const func vectors[] __attribute__((section(".text.vecttable"))) = { \
x \
@@ -379,6 +387,12 @@ table(
irq(254)
)
+#if PASS == 2
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif /* __clang__ */
+#endif
+
#if PASS == 1
#undef PASS
#define PASS 2