mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Randy.Dunlap" <rdunlap@xenotime.net>
To: Jan Engelhardt <jengelh@linux01.gwdg.de>
Cc: sam@ravnborg.org, barkalow@iabervon.org, herbert@13thfloor.at,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC] duplicate #include check for build system
Date: Fri, 24 Feb 2006 18:59:02 -0800	[thread overview]
Message-ID: <20060224185902.fd2a43f5.rdunlap@xenotime.net> (raw)
In-Reply-To: <Pine.LNX.4.61.0602240820000.16363@yvahk01.tjqt.qr>

On Fri, 24 Feb 2006 08:23:23 +0100 (MET) Jan Engelhardt wrote:

> >> I think the kernel style is to encourage duplicate includes, rather than 
> >> removing them. Removing duplicate includes won't remove any dependancies 
> >> (since the includes that they duplicate will remain).
> >The style as I have understood it is that each .h file in include/linux/
> >are supposed to be self-contained. So it includes what is needs, and the
> >'what it needs' are kept small.
> >
> >Keeping the 'what it needs' part small is a challenge resulting in
> >smaller .h files. But also a good way to keep related things together.
> >
> How far does this go? Consider the following hypothetical case:
> 
> ---dcache.h---
> struct dentry {
>    ...
> };
> ---fs.h---
> #include "dcache.h"
> struct inode {
>     struct dentry *de;
> };
> 
> Since only a pointer to struct dentry is involved, I would compress it to:
> 
> ---fs.h---
> struct dentry;
> struct inode {
>     struct dentry *de;
> };
> 
> The fs.h file still "compiles" (gcc -xc fs.h), and there is one file less 
> to be read. And since dcache.h in this case here should anyway be included 
> in the .c file if *DE is dereferenced, I do not see a problem with this.
> Objections?

Nope, your method is good & correct AFAIAC.

---
~Randy

      reply	other threads:[~2006-02-25  2:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-21  1:48 Herbert Poetzl
2006-02-21  6:10 ` Sam Ravnborg
2006-02-21  7:29 ` Daniel Barkalow
2006-02-21 17:52   ` Sam Ravnborg
2006-02-22  0:11     ` Herbert Poetzl
2006-02-22  0:18       ` Randy.Dunlap
2006-02-22  0:26         ` Herbert Poetzl
2006-02-22  0:28           ` Randy.Dunlap
2006-02-22  5:57       ` Sam Ravnborg
2006-02-24  7:23     ` Jan Engelhardt
2006-02-25  2:59       ` Randy.Dunlap [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=20060224185902.fd2a43f5.rdunlap@xenotime.net \
    --to=rdunlap@xenotime.net \
    --cc=barkalow@iabervon.org \
    --cc=herbert@13thfloor.at \
    --cc=jengelh@linux01.gwdg.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sam@ravnborg.org \
    /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®