[PATCH] perf: arm-pmu: shut up -Woverride-init warning

From: Arnd Bergmann
Date: Wed Jun 08 2016 - 04:46:40 EST


gcc -Woverride-init provides useful warnings about bugs in some drivers,
but it warns about an intentional duplicate inialization in the ARM
pmu header:

arch/arm/kernel/perf_event_v7.c:159:31: error: initialized field overwritten [-Werror=override-init]
arch/arm/kernel/perf_event_v7.c:159:31: note: (near initialization for 'armv7_a8_perf_map[0]')
arch/arm/kernel/perf_event_v7.c:160:33: error: initialized field overwritten [-Werror=override-init]
arch/arm/kernel/perf_event_v7.c:160:33: note: (near initialization for 'armv7_a8_perf_map[1]')
arch/arm/kernel/perf_event_v7.c:161:37: error: initialized field overwritten [-Werror=override-init]
arch/arm/kernel/perf_event_v7.c:161:37: note: (near initialization for 'armv7_a8_perf_map[2]')
arch/arm/kernel/perf_event_v7.c:162:33: error: initialized field overwritten [-Werror=override-init]
arch/arm/kernel/perf_event_v7.c:162:33: note: (near initialization for 'armv7_a8_perf_map[3]')
arch/arm/kernel/perf_event_v7.c:163:40: error: initialized field overwritten [-Werror=override-init]
arch/arm/kernel/perf_event_v7.c:163:40: note: (near initialization for 'armv7_a8_perf_map[4]')
...

This uses a #pragma to shut up that warning, as a preparation for enabling
the warning by default in the future.

Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>

diff --git a/include/linux/perf/arm_pmu.h b/include/linux/perf/arm_pmu.h
index 8462da266089..f61462cd362a 100644
--- a/include/linux/perf/arm_pmu.h
+++ b/include/linux/perf/arm_pmu.h
@@ -41,6 +41,7 @@ struct arm_pmu_platdata {
#define C(_x) PERF_COUNT_HW_CACHE_##_x
#define CACHE_OP_UNSUPPORTED 0xFFFF

+#pragma GCC diagnostic ignored "-Woverride-init"
#define PERF_MAP_ALL_UNSUPPORTED \
[0 ... PERF_COUNT_HW_MAX - 1] = HW_OP_UNSUPPORTED