From: David Miller <davem@davemloft.net>
To: sfr@canb.auug.org.au
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] af_key: suppress a warning for 64k pages.
Date: Tue, 30 Oct 2007 21:42:19 -0700 (PDT) [thread overview]
Message-ID: <20071030.214219.256397507.davem@davemloft.net> (raw)
In-Reply-To: <20071031153422.44f864e8.sfr@canb.auug.org.au>
From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Wed, 31 Oct 2007 15:34:22 +1100
> On Tue, 30 Oct 2007 21:08:46 -0700 (PDT) David Miller <davem@davemloft.net> wrote:
> > I think we should retain the check, but modify it so that GCC knows we
> > understand that it's OK if it is always false. Perhaps a simple (u32)
> > cast on the left branch of the comparison is sufficient?
>
> Unfortunately, that does not suppress the warning (gcc is getting too
> smart :-().
It seems if you break the comparison out into a function which
takes a u32, that's enough to get rid of the warning.
I can't figure out a way to make this prettier, can you?
#define PAGE_SIZE (64 * 1024)
typedef unsigned int u32;
typedef unsigned short u16;
int compare(u32 val)
{
if (val >= PAGE_SIZE)
return -1;
return 0;
}
int foo(u16 val)
{
#if 1
return compare(val);
#else
if (val >= PAGE_SIZE)
return -1;
return 0;
#endif
}
next prev parent reply other threads:[~2007-10-31 4:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-31 3:59 [PATCH] af_key: suppress a warning for 64k pages Stephen Rothwell
2007-10-31 4:08 ` David Miller
2007-10-31 4:34 ` Stephen Rothwell
2007-10-31 4:42 ` David Miller [this message]
2007-10-31 5:24 ` Stephen Rothwell
2007-10-31 6:58 ` David Miller
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=20071030.214219.256397507.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=sfr@canb.auug.org.au \
/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