From: "Jörn Engel" <joern@wohnheim.fh-wedel.de>
To: Matthew Wilcox <willy@debian.org>
Cc: Linus Torvalds <torvalds@osdl.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] CONFIG_* In Comments Considered Harmful
Date: Wed, 1 Oct 2003 16:39:59 +0200 [thread overview]
Message-ID: <20031001143959.GI31698@wohnheim.fh-wedel.de> (raw)
In-Reply-To: <20031001132619.GL24824@parcelfarce.linux.theplanet.co.uk>
On Wed, 1 October 2003 14:26:19 +0100, Matthew Wilcox wrote:
>
> I reviewed the dependency list for a file this morning to see why it was
> being unnecessarily recompiled (a little fetish of mine, mostly harmless).
> I was a little discombobulated to find this line:
>
> $(wildcard include/config/higmem.h) \
>
> Naturally, I assumed a typo somewhere. It turns out there is indeed
> a CONFIG_HIGMEM in include/linux/mm.h, but it's in a comment. The
> fixdep script doesn't parse C itself, so it doesn't know that this should
> be ignored. Rather than fix the typo, I deleted the comment; the ifdef'ed
> code is a mere two lines so the comment seems unnecessary.
>
> This serves as a useful warning to people -- don't put CONFIG_FOO in a
> comment unnecessarily. Because even when it's true now, maybe the #if
> gets changed and the comment doesn't.
>
> Index: include/linux/mm.h
> ===================================================================
> RCS file: /var/cvs/linux-2.6/include/linux/mm.h,v
> retrieving revision 1.5
> diff -u -p -r1.5 mm.h
> --- a/include/linux/mm.h 28 Sep 2003 04:06:20 -0000 1.5
> +++ b/include/linux/mm.h 1 Oct 2003 13:15:53 -0000
> @@ -196,7 +196,7 @@ struct page {
> #if defined(WANT_PAGE_VIRTUAL)
> void *virtual; /* Kernel virtual address (NULL if
> not kmapped, ie. highmem) */
> -#endif /* CONFIG_HIGMEM || WANT_PAGE_VIRTUAL */
> +#endif
> };
To me, this sounds more like our tools are too stupid. Ok, I don't
like to copy&paste conditions either, but in many header files, those
comments are the lesser evil. If we cannot put every #endif on the
same screen (24 lines) as the corresponding #if, they do help.
What we do need is a version of cpp, that only removes comments. Then
we can pipe all input for our tools through that cppp or whatever it
would be called, and noone would worry about comments confusing the
tools anymore.
All right, here is a patch that simply corrects the typo. Linus, you
decide which one is better.
Index: include/linux/mm.h
===================================================================
RCS file: /var/cvs/linux-2.6/include/linux/mm.h,v
retrieving revision 1.5
diff -u -p -r1.5 mm.h
--- a/include/linux/mm.h 28 Sep 2003 04:06:20 -0000 1.5
+++ b/include/linux/mm.h 1 Oct 2003 13:15:53 -0000
@@ -196,7 +196,7 @@ struct page {
#if defined(WANT_PAGE_VIRTUAL)
void *virtual; /* Kernel virtual address (NULL if
not kmapped, ie. highmem) */
-#endif /* CONFIG_HIGMEM || WANT_PAGE_VIRTUAL */
+#endif /* CONFIG_HIGHMEM || WANT_PAGE_VIRTUAL */
};
Jörn
--
The only real mistake is the one from which we learn nothing.
-- John Powell
next prev parent reply other threads:[~2003-10-01 14:40 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-10-01 13:26 Matthew Wilcox
2003-10-01 14:19 ` Dave Jones
2003-10-01 14:29 ` Valdis.Kletnieks
2003-10-01 14:42 ` Jörn Engel
2003-10-01 14:49 ` Matthew Wilcox
2003-10-01 14:41 ` Muli Ben-Yehuda
2003-10-01 14:39 ` Jörn Engel [this message]
[not found] ` <20031001145206.GH29313@actcom.co.il>
2003-10-01 15:10 ` Jörn Engel
2003-10-01 20:15 ` Muli Ben-Yehuda
2003-10-01 20:27 ` Linus Torvalds
2003-10-01 14:58 ` Sam Ravnborg
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=20031001143959.GI31698@wohnheim.fh-wedel.de \
--to=joern@wohnheim.fh-wedel.de \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
--cc=willy@debian.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®