Re: [PATCH] lockdep: avoid a clang warning

From: Bart Van Assche
Date: Thu Mar 07 2019 - 11:02:27 EST


On Thu, 2019-03-07 at 08:52 +-0100, Arnd Bergmann wrote:
+AD4 Clang warns about a tentative array definition without a length:
+AD4
+AD4 kernel/locking/lockdep.c:845:12: error: tentative array definition assumed to have one element +AFs--Werror+AF0
+AD4
+AD4 There is no real reason to do this here, so just set the same length as
+AD4 in the real definition later in the same file. It has to be hidden in
+AD4 an +ACM-ifdef or annotated +AF8AXw-maybe+AF8-unused though, to avoid the unused-variable
+AD4 warning if CONFIG+AF8-PROVE+AF8-LOCKING is disabled.
+AD4
+AD4 Signed-off-by: Arnd Bergmann +ADw-arnd+AEA-arndb.de+AD4
+AD4 ---
+AD4 kernel/locking/lockdep.c +AHw 4 +-+-+--
+AD4 1 file changed, 3 insertions(+-), 1 deletion(-)
+AD4
+AD4 diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
+AD4 index 21cb81fe6359..35a144dfddf5 100644
+AD4 --- a/kernel/locking/lockdep.c
+AD4 +-+-+- b/kernel/locking/lockdep.c
+AD4 +AEAAQA -842,7 +-842,9 +AEAAQA static bool class+AF8-lock+AF8-list+AF8-valid(struct lock+AF8-class +ACo-c, struct list+AF8-head +ACo-h)
+AD4 return true+ADs
+AD4 +AH0
+AD4
+AD4 -static u16 chain+AF8-hlocks+AFsAXQA7
+AD4 +-+ACM-ifdef CONFIG+AF8-PROVE+AF8-LOCKING
+AD4 +-static u16 chain+AF8-hlocks+AFs-MAX+AF8-LOCKDEP+AF8-CHAIN+AF8-HLOCKS+AF0AOw
+AD4 +-+ACM-endif
+AD4
+AD4 static bool check+AF8-lock+AF8-chain+AF8-key(struct lock+AF8-chain +ACo-chain)
+AD4 +AHs

Reviewed-by: Bart Van Assche +ADw-bvanassche+AEA-acm.org+AD4-