From: Randy Dunlap <rdunlap@xenotime.net>
To: Matthew Wilcox <matthew@wil.cx>
Cc: Andi Kleen <ak@suse.de>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Stefan Richter <stefanr@s5r6.in-berlin.de>,
Al Viro <viro@ftp.linux.org.uk>,
Linus Torvalds <torvalds@osdl.org>,
Alexey Dobriyan <adobriyan@gmail.com>,
Linux Kernel Development <linux-kernel@vger.kernel.org>,
linux-arch@vger.kernel.org
Subject: Re: dealing with excessive includes
Date: Sun, 22 Oct 2006 18:48:53 -0700 [thread overview]
Message-ID: <20061022184853.7f8ae81a.rdunlap@xenotime.net> (raw)
In-Reply-To: <20061023013604.GF25210@parisc-linux.org>
On Sun, 22 Oct 2006 19:36:04 -0600 Matthew Wilcox wrote:
> On Mon, Oct 23, 2006 at 03:31:16AM +0200, Andi Kleen wrote:
> > On Monday 23 October 2006 03:08, Matthew Wilcox wrote:
> > > On Mon, Oct 23, 2006 at 02:42:58AM +0200, Andi Kleen wrote:
> > > >
> > > > > /*+
> > > > > * Provides: struct sched
> > > > > * Provides: total_forks, nr_threads, process_counts, nr_processes()
> > > > > * Provides: nr_running(), nr_uninterruptible(), nr_active(), nr_iowait(), weighted_cpuload()
> > > > > */
> > > >
> > > > That's ugly. If it needs that i don't think it's a good idea.
> > > > We really want standard C, not some Linux dialect.
> > >
> > > Um, that's a comment. It's standard C.
> >
> > If you require it to do something it isn't a comment anymore -- it would become
> > a language extension.
>
> How is this any different from __iomem annotations?
>
> > > Here's the problem. If a file needs canonicalize_irq(), it should
> > > include <linux/interrupt.h> (which eventually ends up including
> > > asm/irq,h), and not <asm/irq.h> (where it's defined).
> > > If a file needs add_wait_queue(), it should include <linux/wait.h>
> > > (where it's defined) and not <linux/fs.h> (which directly includes
> > > linux/wait.h>.
> > >
> > > Please define an algorithm which distinguishes the two cases.
> >
> > Needs are inside {} or in a macro definition
> > So if the identifier happens after #define or inside {} assume the symbol
> > is needed from somewhere else, otherwise it is declared here.
> >
> > That is likely not 100% foolproof, but should be good enough and
> > the mismatches can be resolved by hand.
>
> Let me try to explain the problem again, because what you wrote has
> nothing to do with the problem.
>
> canonicalize_irq() is defined in <asm/irq.h>. No .c file should be
> including <asm/irq.h> in order to get it. It should be including
> <linux/interrupt.h>, which will indirectly pull in <asm/irq.h>
We can add #error or #warning to asm/irq.h when that is done &
detected hence caught and will be fixed.
Don't we already have a few like that? ("don't include this file
directly") I looked quickly but didn't see them...
> add_wait_queue() is defined in <linux/wait.h>. .c files wishing to use
> add_wait_queue() should be including <linux/wait.h> rather than relying
> on it being pulled in through some other path.
>
> This needs annotations to fix, or a big bag of unreliable heuristics.
---
~Randy
next prev parent reply other threads:[~2006-10-23 1:47 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-17 0:50 [RFC] typechecking for get_unaligned/put_unaligned Al Viro
2006-10-17 1:50 ` Linus Torvalds
2006-10-17 4:37 ` Al Viro
2006-10-17 15:12 ` Bogus deps checking (was Re: [RFC] typechecking for get_unaligned/put_unaligned) Ray Lehtiniemi
2006-10-17 15:24 ` [RFC] typechecking for get_unaligned/put_unaligned Linus Torvalds
2006-10-18 4:40 ` dealing with excessive includes Al Viro
2006-10-18 9:19 ` Alexey Dobriyan
2006-10-18 9:31 ` Al Viro
2006-10-18 10:00 ` Alexey Dobriyan
2006-10-18 17:42 ` Al Viro
2006-10-18 21:48 ` Alexey Dobriyan
2006-10-18 15:04 ` Linus Torvalds
2006-10-18 15:13 ` Matthew Wilcox
2006-10-18 16:06 ` Al Viro
2006-10-18 16:32 ` Linus Torvalds
2006-10-18 17:44 ` Al Viro
2006-10-19 16:23 ` Al Viro
2006-10-19 18:24 ` Andreas Gruenbacher
2006-10-20 0:53 ` Al Viro
2006-10-20 0:57 ` Al Viro
2006-10-20 12:43 ` Matthew Wilcox
2006-10-20 0:58 ` Al Viro
2006-10-20 0:59 ` Al Viro
2006-10-20 1:02 ` Al Viro
2006-10-20 4:35 ` Randy Dunlap
2006-10-20 9:26 ` Stefan Richter
2006-10-20 16:13 ` Randy Dunlap
2006-10-20 17:51 ` Stefan Richter
2006-10-22 17:58 ` Geert Uytterhoeven
2006-10-22 22:59 ` Andi Kleen
2006-10-23 8:29 ` Geert Uytterhoeven
2006-10-23 16:09 ` Linus Torvalds
2006-10-23 16:13 ` Geert Uytterhoeven
2006-10-23 16:31 ` Linus Torvalds
2006-10-23 16:52 ` Geert Uytterhoeven
2006-10-23 17:05 ` Linus Torvalds
2006-10-23 0:31 ` Matthew Wilcox
2006-10-23 0:42 ` Andi Kleen
2006-10-23 1:08 ` Matthew Wilcox
2006-10-23 1:31 ` Andi Kleen
2006-10-23 1:36 ` Matthew Wilcox
2006-10-23 1:41 ` Andi Kleen
2006-10-23 8:34 ` Geert Uytterhoeven
2006-10-23 1:48 ` Randy Dunlap [this message]
2006-10-23 1:49 ` Nick Piggin
2006-10-23 6:34 ` Stefan Richter
2006-10-18 16:15 ` Jan Engelhardt
2006-10-18 16:21 ` Matthew Wilcox
2006-10-18 5:42 ` [RFC] typechecking for get_unaligned/put_unaligned Dave Jones
2006-10-18 6:05 ` Al Viro
2006-10-19 16:52 ` Denis Vlasenko
2006-10-19 16:58 ` Al Viro
2006-10-17 9:04 ` David Howells
2006-10-17 15:28 ` Linus Torvalds
2006-10-28 15:24 dealing with excessive includes Tim Schmielau
2006-10-30 10:45 Al Viro
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=20061022184853.7f8ae81a.rdunlap@xenotime.net \
--to=rdunlap@xenotime.net \
--cc=adobriyan@gmail.com \
--cc=ak@suse.de \
--cc=geert@linux-m68k.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matthew@wil.cx \
--cc=stefanr@s5r6.in-berlin.de \
--cc=torvalds@osdl.org \
--cc=viro@ftp.linux.org.uk \
/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
all inboxes | Powered by JetHome®