diff options
author | Tom Hughes <tomhughes@chromium.org> | 2021-09-24 21:51:57 +0000 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-10-08 21:15:45 +0000 |
commit | babe37099f26aab8332485d537922e98c6c5e33a (patch) | |
tree | 54f224e92d58cc47cc22a8bfb58ec5cc3238fec3 | |
parent | 381de755b3e0724c55e4d1b2def75689bb03253c (diff) | |
download | chrome-ec-babe37099f26aab8332485d537922e98c6c5e33a.tar.gz |
core/cortex-m: Disable warning in vecttable.c when building with clang
See the description in commit c1cc2d919e9f21adc0f992dcac00f6e8b282616d.
These files copied the same logic.
BRANCH=none
BUG=b:172020503
TEST=make buildall
TEST=CC=arm-none-eabi-clang make BOARD=servo_micro
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
Change-Id: I1d59b3a7eb6e71451313d70fe421880a08dad4b0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3183392
Reviewed-by: Ting Shen <phoenixshen@chromium.org>
-rw-r--r-- | chip/stm32/usb_endpoints.c | 15 | ||||
-rw-r--r-- | core/cortex-m0/vecttable.c | 14 |
2 files changed, 29 insertions, 0 deletions
diff --git a/chip/stm32/usb_endpoints.c b/chip/stm32/usb_endpoints.c index 85952a1387..7cdff25a6a 100644 --- a/chip/stm32/usb_endpoints.c +++ b/chip/stm32/usb_endpoints.c @@ -69,6 +69,15 @@ int iface_undefined(iface_arguments) #undef interface #undef null +/* Disable warning that "initializer overrides prior initialization of this + * subobject", since we are explicitly doing this to handle the unused + * endpoints. + */ +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Winitializer-overrides" +#endif /* __clang__ */ + /* align function pointers on a 32-bit boundary */ #define table(type, name, x) type name[] __attribute__((aligned(4), section(".rodata.usb_ep." #name ",\"a\" @"))) = { x }; #define null (void*)0 @@ -162,6 +171,12 @@ table(iface_func, usb_iface_request, ) #endif +#if PASS == 2 +#ifdef __clang__ +#pragma clang diagnostic pop +#endif /* __clang__ */ +#endif + #if PASS == 1 #undef PASS #define PASS 2 diff --git a/core/cortex-m0/vecttable.c b/core/cortex-m0/vecttable.c index b1eaa957e0..de667749ad 100644 --- a/core/cortex-m0/vecttable.c +++ b/core/cortex-m0/vecttable.c @@ -69,6 +69,14 @@ extern void reset(void); */ #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) func vectors[] __attribute__((section(".text.vecttable,\"a\" @"))) = { x[IRQ_UNUSED_OFFSET] = null }; #define vec(name) name ## _handler, @@ -129,6 +137,12 @@ table( irq(31) ) +#if PASS == 2 +#ifdef __clang__ +#pragma clang diagnostic pop +#endif /* __clang__ */ +#endif + #if PASS == 1 #undef PASS #define PASS 2 |