From: Ingo Molnar <mingo@elte.hu>
To: Jesper Juhl <jj@chaosbits.net>
Cc: Tom Spink <tspink@gmail.com>, Ingo Brueckl <ib@wupperonline.de>,
linux-kernel@vger.kernel.org
Subject: Re: compile time warnings
Date: Fri, 2 Jan 2009 10:57:27 +0100 [thread overview]
Message-ID: <20090102095727.GH1975@elte.hu> (raw)
In-Reply-To: <alpine.LNX.2.00.0901020301230.11772@swampdragon.chaosbits.net>
* Jesper Juhl <jj@chaosbits.net> wrote:
> On Fri, 2 Jan 2009, Tom Spink wrote:
>
> > 2009/1/1 Jesper Juhl <jj@chaosbits.net>:
> > > On Thu, 1 Jan 2009, Ingo Brueckl wrote:
> > [snip]
> >
> > Hi,
> >
> > > pgd_base is very much used...
> >
> > It's probably something to do with:
> >
> > # define permanent_kmaps_init(pgd_base) do { } while (0)
> >
> > Which is within the #else part of #if CONFIG_HIGHMEM. So, if
> > CONFIG_HIGHMEM is not set, permanent_kmaps_init gets wiped out, and
> > therefore that warning will be issued.
> >
> > Perhaps changing that to an empty inline would remove the warning?
> >
> Yeah, I noticed that as well after sending the mail.
> Another way to silence the warning (which I think is nicer) would be
> something like this;
>
>
> Silence 'unused variable' warning in arch/x86/mm/init_32.c::pagetable_init
>
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>
> ---
>
> diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
> index 8655b5b..0affa8e 100644
> --- a/arch/x86/mm/init_32.c
> +++ b/arch/x86/mm/init_32.c
> @@ -511,9 +511,7 @@ static void __init early_ioremap_page_table_range_init(pgd_t *pgd_base)
>
> static void __init pagetable_init(void)
> {
> - pgd_t *pgd_base = swapper_pg_dir;
> -
> - permanent_kmaps_init(pgd_base);
> + permanent_kmaps_init((pgd_t *)swapper_pg_dir);
> }
no, this only works around the warning by 'silencing' it (it also includes
an ugly type cast) - instead of fixing the core problem.
The core problem is that permanent_kmaps_init() is a CPP macro in the
!HIGHMEM case - so the right fix would be to convert that to a proper C
inline function. (same for set_highmem_pages_init() while at it)
Would you mind to send a patch for that that we could push to Linus?
<soapbox>
The highest quality fixes that are motivated by compiler warnings are the
ones that do not actually 'fix a warning', but instead improve/reshape
some code so that as a side-effect the warning goes away.
If you ever see a patch that 'silences a warning', it usually shows that
the deeper problem has not been fully understood. (Except of course if the
warning shows a genuine bug in the code - but in that case we fix the bug
and not the warning - the warning was just the canary to it.)
</soapbox>
Ingo
next prev parent reply other threads:[~2009-01-02 9:57 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-01 21:13 compile time warnings Ingo Brueckl
2009-01-01 22:52 ` Jesper Juhl
2009-01-02 1:35 ` Tom Spink
2009-01-02 1:39 ` Harvey Harrison
2009-01-02 2:07 ` Jesper Juhl
2009-01-02 9:57 ` Ingo Molnar [this message]
2009-01-02 12:53 ` [PATCH] " Ingo Brueckl
2009-01-02 13:01 ` Ingo Molnar
2009-01-02 13:42 ` Ingo Brueckl
2009-01-02 14:42 ` Ingo Molnar
2009-01-02 16:07 ` Jesper Juhl
2009-01-02 16:10 ` Jesper Juhl
2009-01-02 2:48 ` Ingo Brueckl
2009-01-02 20:03 ` Robert Hancock
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=20090102095727.GH1975@elte.hu \
--to=mingo@elte.hu \
--cc=ib@wupperonline.de \
--cc=jj@chaosbits.net \
--cc=linux-kernel@vger.kernel.org \
--cc=tspink@gmail.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