All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lockdep: avoid a clang warning
@ 2019-03-07  7:52 Arnd Bergmann
  2019-03-07 16:02 ` Bart Van Assche
  2019-03-09 14:40 ` [tip:locking/urgent] locking/lockdep: Avoid a Clang warning tip-bot for Arnd Bergmann
  0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2019-03-07  7:52 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Will Deacon
  Cc: Arnd Bergmann, Bart Van Assche, Waiman Long,
	Steven Rostedt (VMware),
	Tetsuo Handa, Frederic Weisbecker, Joel Fernandes (Google),
	linux-kernel

Clang warns about a tentative array definition without a length:

kernel/locking/lockdep.c:845:12: error: tentative array definition assumed to have one element [-Werror]

There is no real reason to do this here, so just set the same length as
in the real definition later in the same file.  It has to be hidden in
an #ifdef or annotated __maybe_unused though, to avoid the unused-variable
warning if CONFIG_PROVE_LOCKING is disabled.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 kernel/locking/lockdep.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 21cb81fe6359..35a144dfddf5 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -842,7 +842,9 @@ static bool class_lock_list_valid(struct lock_class *c, struct list_head *h)
 	return true;
 }
 
-static u16 chain_hlocks[];
+#ifdef CONFIG_PROVE_LOCKING
+static u16 chain_hlocks[MAX_LOCKDEP_CHAIN_HLOCKS];
+#endif
 
 static bool check_lock_chain_key(struct lock_chain *chain)
 {
-- 
2.20.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] lockdep: avoid a clang warning
  2019-03-07  7:52 [PATCH] lockdep: avoid a clang warning Arnd Bergmann
@ 2019-03-07 16:02 ` Bart Van Assche
  2019-03-09 14:40 ` [tip:locking/urgent] locking/lockdep: Avoid a Clang warning tip-bot for Arnd Bergmann
  1 sibling, 0 replies; 3+ messages in thread
From: Bart Van Assche @ 2019-03-07 16:02 UTC (permalink / raw)
  To: Arnd Bergmann, Peter Zijlstra, Ingo Molnar, Will Deacon
  Cc: Waiman Long, Steven Rostedt (VMware),
	Tetsuo Handa, Frederic Weisbecker, Joel Fernandes (Google),
	linux-kernel

On Thu, 2019-03-07 at 08:52 +0100, Arnd Bergmann wrote:
> Clang warns about a tentative array definition without a length:
> 
> kernel/locking/lockdep.c:845:12: error: tentative array definition assumed to have one element [-Werror]
> 
> There is no real reason to do this here, so just set the same length as
> in the real definition later in the same file.  It has to be hidden in
> an #ifdef or annotated __maybe_unused though, to avoid the unused-variable
> warning if CONFIG_PROVE_LOCKING is disabled.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  kernel/locking/lockdep.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
> index 21cb81fe6359..35a144dfddf5 100644
> --- a/kernel/locking/lockdep.c
> +++ b/kernel/locking/lockdep.c
> @@ -842,7 +842,9 @@ static bool class_lock_list_valid(struct lock_class *c, struct list_head *h)
>  	return true;
>  }
>  
> -static u16 chain_hlocks[];
> +#ifdef CONFIG_PROVE_LOCKING
> +static u16 chain_hlocks[MAX_LOCKDEP_CHAIN_HLOCKS];
> +#endif
>  
>  static bool check_lock_chain_key(struct lock_chain *chain)
>  {

Reviewed-by: Bart Van Assche <bvanassche@acm.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [tip:locking/urgent] locking/lockdep: Avoid a Clang warning
  2019-03-07  7:52 [PATCH] lockdep: avoid a clang warning Arnd Bergmann
  2019-03-07 16:02 ` Bart Van Assche
@ 2019-03-09 14:40 ` tip-bot for Arnd Bergmann
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Arnd Bergmann @ 2019-03-09 14:40 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: torvalds, riel, tglx, dave.hansen, longman, arnd, eranian,
	penguin-kernel, acme, peterz, hpa, vincent.weaver, akpm, luto,
	frederic, jolsa, bvanassche, joel, will.deacon,
	alexander.shishkin, paulmck, linux-kernel, rostedt, bp, mingo

Commit-ID:  3fe7522fb766f6ee76bf7bc2837f1e3cc52c4e27
Gitweb:     https://git.kernel.org/tip/3fe7522fb766f6ee76bf7bc2837f1e3cc52c4e27
Author:     Arnd Bergmann <arnd@arndb.de>
AuthorDate: Thu, 7 Mar 2019 08:52:12 +0100
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Sat, 9 Mar 2019 14:15:51 +0100

locking/lockdep: Avoid a Clang warning

Clang warns about a tentative array definition without a length:

  kernel/locking/lockdep.c:845:12: error: tentative array definition assumed to have one element [-Werror]

There is no real reason to do this here, so just set the same length as
in the real definition later in the same file.  It has to be hidden in
an #ifdef or annotated __maybe_unused though, to avoid the unused-variable
warning if CONFIG_PROVE_LOCKING is disabled.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Bart Van Assche <bvanassche@acm.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Frederic Weisbecker <frederic@kernel.org>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Joel Fernandes (Google) <joel@joelfernandes.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rik van Riel <riel@surriel.com>
Cc: Stephane Eranian <eranian@google.com>
Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Cc: Waiman Long <longman@redhat.com>
Cc: Will Deacon <will.deacon@arm.com>
Link: https://lkml.kernel.org/r/20190307075222.3424524-1-arnd@arndb.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/locking/lockdep.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 21cb81fe6359..35a144dfddf5 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -842,7 +842,9 @@ static bool class_lock_list_valid(struct lock_class *c, struct list_head *h)
 	return true;
 }
 
-static u16 chain_hlocks[];
+#ifdef CONFIG_PROVE_LOCKING
+static u16 chain_hlocks[MAX_LOCKDEP_CHAIN_HLOCKS];
+#endif
 
 static bool check_lock_chain_key(struct lock_chain *chain)
 {

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-03-09 14:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-07  7:52 [PATCH] lockdep: avoid a clang warning Arnd Bergmann
2019-03-07 16:02 ` Bart Van Assche
2019-03-09 14:40 ` [tip:locking/urgent] locking/lockdep: Avoid a Clang warning tip-bot for Arnd Bergmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.