From: "Zhao\, Gang" <gamerh2o@gmail.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org
Subject: Re: [PATCH 8/8] cfg80211: remove unnecessary include clauses
Date: Thu, 10 Apr 2014 10:37:35 +0800 [thread overview]
Message-ID: <87txa1ewpc.fsf@gmail.com> (raw)
In-Reply-To: <1397047400.4964.13.camel@jlt4.sipsolutions.net> (Johannes Berg's message of "Wed, 09 Apr 2014 14:43:20 +0200")
On Wed, 2014-04-09 at 14:43:20 +0200, Johannes Berg wrote:
> On Wed, 2014-04-09 at 14:36 +0200, Johannes Berg wrote:
>
>> At the current point in time. If some of the headers that you rely on
>> including something no longer does in the future because it no longer
>> needs that, then you just broke everything.
>
> Take the first of those patches for example. You say
>
> <linux/bug.h> and <linux/net.h> is included by <linux/skbuff.h>.
>
> However, this is a side effect of some implementation detail in
> skbuff.h. If, in the future, some function in skbuff.h is no longer
> inlined, then skbuff.h will no longer have to include bug.h and can
> remove it. That change would break the build due to your patches.
>
> The way you should think about this isn't the mechanic include chain,
> it's the API that each file defines. skbuff.h includes bug.h due to an
> implementation detail, but it doesn't intentionally re-export all the
> bug.h API, that's not the purpose of skbuff.h. The purpose of skbuff.h
> is to capture the SKB related APIs and structures, so that's the only
> thing you should rely on getting from it.
>
> Similarly, you should include bug.h if you need the APIs from that,
> rather than relying on it being included more or less accidentally
> through something else.
>
> Obviously, the lack of namespaces etc. in the compiler makes it
> impossible to actually enforce this, and as a result we often *miss*
> includes that should be there, which sometimes gets found later when
> things change or on different platforms if the recursive include was
> platform specific, but we shouldn't exacerbate this problem by actively
> removing correct includes.
>
> Now, of course, if you find includes that aren't actually *needed* (e.g.
> bug.h in a file that doesn't use BUG() or WARN() variants) then those
> should be removed.
I just want to reduce the possibility that duplicate including could
hide some warnings which I explained in anoother thread. The current way
I use may be too aggressive as you said. I will try to use your
suggestion to remove duplicate including, so the last four patches can
be dropped.
BTW, after I explained why I changed the parameter type in the first
patch, do you still think that is not appropriate ?
>
> johannes
next prev parent reply other threads:[~2014-04-10 2:37 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-09 1:28 [PATCH 1/8] cfg80211: fix possible compile warning in wext-compat.h Zhao, Gang
2014-04-09 1:28 ` [PATCH 2/8] mac80211: fix possible compile warning in debugfs.h Zhao, Gang
2014-04-09 1:28 ` [PATCH 3/8] mac80211: fix possible compile warning in michael.h Zhao, Gang
2014-04-09 12:47 ` Johannes Berg
2014-04-09 1:28 ` [PATCH 4/8] mac80211: fix possible compile warning in debugfs_netdev.h Zhao, Gang
2014-04-09 12:50 ` Johannes Berg
2014-04-09 1:28 ` [PATCH 5/8] cfg80211: remove unnecessary include clauses (cfg80211.h) Zhao, Gang
2014-04-09 1:28 ` [PATCH 6/8] mac80211: remove unnecessary include clauses (mac80211.h) Zhao, Gang
2014-04-09 1:28 ` [PATCH 7/8] mac80211: remove unnecessary include clauses Zhao, Gang
2014-04-09 1:28 ` [PATCH 8/8] cfg80211: " Zhao, Gang
2014-04-09 7:49 ` Johannes Berg
2014-04-09 12:25 ` Zhao, Gang
2014-04-09 12:36 ` Johannes Berg
2014-04-09 12:43 ` Johannes Berg
2014-04-10 2:37 ` Zhao, Gang [this message]
2014-04-09 15:22 ` Zhao, Gang
2014-04-09 13:49 ` Zhao, Gang
2014-04-09 12:46 ` [PATCH 1/8] cfg80211: fix possible compile warning in wext-compat.h Johannes Berg
2014-04-09 14:18 ` Zhao, Gang
2014-04-10 8:02 ` Johannes Berg
2014-04-10 8:09 ` Johannes Berg
2014-04-11 0:27 ` Zhao, Gang
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=87txa1ewpc.fsf@gmail.com \
--to=gamerh2o@gmail.com \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.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 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.