From afe0e25e7c35177aee3e73ccb29ff6cca615b3c9 Mon Sep 17 00:00:00 2001 From: Andreas Fenkart Date: Mon, 5 Dec 2016 11:25:49 +0100 Subject: gcc6: avoid declaration of unused static struct in cpufeature.h The lookup table is generated but not used if the driver including this header is not compiled as a module. Signed-off-by: Andreas Fenkart --- include/linux/cpufeature.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'include/linux') diff --git a/include/linux/cpufeature.h b/include/linux/cpufeature.h index c4d4eb8ac..1ac8dac1e 100644 --- a/include/linux/cpufeature.h +++ b/include/linux/cpufeature.h @@ -43,10 +43,21 @@ * For a list of legal values for 'feature', please consult the file * 'asm/cpufeature.h' of your favorite architecture. */ -#define module_cpu_feature_match(x, __init) \ + +#ifdef MODULE + +/* gcc6 does not like unused declarations */ +#define declare_cpu_feature(x) \ static struct cpu_feature const cpu_feature_match_ ## x[] = \ { { .feature = cpu_feature(x) }, { } }; \ -MODULE_DEVICE_TABLE(cpu, cpu_feature_match_ ## x); \ +MODULE_DEVICE_TABLE(cpu, cpu_feature_match_ ## x); + +#else +#define declare_cpu_feature(x) +#endif + +#define module_cpu_feature_match(x, __init) \ +declare_cpu_feature(x) \ \ static int cpu_feature_match_ ## x ## _init(void) \ { \ -- cgit v1.2.3