From: Andrew Morton <akpm@linux-foundation.org>
To: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Ingo Molnar <mingo@elte.hu>,
Martin Schwidefsky <schwidefsky@de.ibm.com>,
linux-kernel@vger.kernel.org
Subject: Re: [patch] lockdep: forward declare struct trask_struct
Date: Wed, 7 Feb 2007 14:48:25 -0800 [thread overview]
Message-ID: <20070207144825.ebfcff46.akpm@linux-foundation.org> (raw)
In-Reply-To: <20070207112301.GA9212@osiris.boeblingen.de.ibm.com>
On Wed, 7 Feb 2007 12:23:01 +0100
Heiko Carstens <heiko.carstens@de.ibm.com> wrote:
> From: Heiko Carstens <heiko.carstens@de.ibm.com>
>
> 3117df0453828bd045c16244e6f50e5714667a8a causes this:
>
> In file included from arch/s390/kernel/early.c:13:
> include/linux/lockdep.h:300: warning:
> "struct task_struct" declared inside parameter list
> include/linux/lockdep.h:300:
> warning: its scope is only this definition or
> declaration, which is probably not what you want
>
> Cc: Ingo Molnar <mingo@elte.hu>
> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
> ---
> include/linux/lockdep.h | 2 ++
> 1 files changed, 2 insertions(+)
>
> Index: linux-2.6/include/linux/lockdep.h
> ===================================================================
> --- linux-2.6.orig/include/linux/lockdep.h
> +++ linux-2.6/include/linux/lockdep.h
> @@ -286,6 +286,8 @@ static inline void early_init_irq_lock_c
> }
> #endif
>
> +struct task_struct;
Minor nit: please put such forward declarations right at the top of the
header file.
Otherwise someone might come along later and require task_struct at line
100. They'll then add another forward-declaration at line 95 and so on.
This has happened in the past.
I updated the patch to do this.
diff -puN include/linux/lockdep.h~lockdep-forward-declare-struct-trask_struct include/linux/lockdep.h
--- a/include/linux/lockdep.h~lockdep-forward-declare-struct-trask_struct
+++ a/include/linux/lockdep.h
@@ -8,6 +8,8 @@
#ifndef __LINUX_LOCKDEP_H
#define __LINUX_LOCKDEP_H
+struct task_struct;
+
#ifdef CONFIG_LOCKDEP
#include <linux/linkage.h>
_
Note that it's outside CONFIG_LOCKDEP, to avoid possible
hey-my-build-broke-when-i-turned-off-lockdep problems.
prev parent reply other threads:[~2007-02-07 22:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-07 11:23 [patch] lockdep: forward declare struct trask_struct Heiko Carstens
2007-02-07 22:48 ` Andrew Morton [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070207144825.ebfcff46.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=heiko.carstens@de.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=schwidefsky@de.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox