From: Gary Hade <garyhade@us.ibm.com>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Ingo Molnar <mingo@redhat.com>,
"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
Lance Ortiz <lance.ortiz@hp.com>, Gary Hade <garyhade@us.ibm.com>
Subject: Re: "unsigned expression < 0" always false warning
Date: Fri, 19 Apr 2013 15:45:50 -0700 [thread overview]
Message-ID: <20130419224550.GA10898@us.ibm.com> (raw)
In-Reply-To: <CAErSpo7TgvkqcPk-aAJvY17yacDZcPjRLFxoNzf48_p3Jis7LQ@mail.gmail.com>
On Fri, Apr 19, 2013 at 04:30:14PM -0600, Bjorn Helgaas wrote:
> On Fri, Apr 19, 2013 at 3:17 PM, Steven Rostedt <rostedt@goodmis.org> wrote:
> > Does this fix your issue?
>
> Yep, that fixes the warning for me. Thanks!
>
> Bjorn
It also worked for me. It got rid of every one the 1401 is_signed_type
associated "warning: comparison of unsigned expression < 0 is always false"
occurrences (during 3.9-rc7 `make W=1` kernel build) mentioned in my
previous email.
Gary
>
> > From d2802d0739dcc61af5e5ea00773ce7ddead4e9c2 Mon Sep 17 00:00:00 2001
> > From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
> > Date: Fri, 19 Apr 2013 17:10:27 -0400
> > Subject: [PATCH] tracing: Compare to 1 instead of zero for is_signed_type()
> >
> > The formats of the trace events show if the type of a event field
> > is signed or not via a macro called is_signed_type(). This does
> > a trick with the type and compares a -1 to zero after typecasting
> > to the tested type. If it returns true, it's signed, otherwise
> > its not. But this unfortunately triggers a warning by gcc:
> >
> > warning: comparison of unsigned expression < 0 is always false
> >
> > As we know it is always false (that's why we do it), this is a
> > false warning. Luckily for us, the comparison works with a 1 as
> > well, without giving the warning.
> >
> > Convert the check to compare (type)-1 < (type)0 to (type)-1 < (type)1
> > to determine if the type is signed or not.
> >
> > Link: http://lkml.kernel.org/r/CAErSpo4YXcY9fuOKWYGDkddJwk68kmZTohsmVB6QvrhjboOh1Q@mail.gmail.com
> >
> > Reported-by: Bjorn Helgaas <bhelgaas@google.com>
> > Reported-by: Gary Hade <garyhade@us.ibm.com>
> > Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
> > ---
> > include/linux/ftrace_event.h | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
> > index 4e28b01..34e00fb 100644
> > --- a/include/linux/ftrace_event.h
> > +++ b/include/linux/ftrace_event.h
> > @@ -333,7 +333,7 @@ extern int trace_define_field(struct ftrace_event_call *call, const char *type,
> > extern int trace_add_event_call(struct ftrace_event_call *call);
> > extern void trace_remove_event_call(struct ftrace_event_call *call);
> >
> > -#define is_signed_type(type) (((type)(-1)) < (type)0)
> > +#define is_signed_type(type) (((type)(-1)) < (type)1)
> >
> > int trace_set_clr_event(const char *system, const char *event, int set);
> >
> > --
> > 1.7.10.4
> >
> >
> >
>
prev parent reply other threads:[~2013-04-19 22:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-15 17:17 "unsigned expression < 0" always false warning Bjorn Helgaas
2013-04-19 20:43 ` Gary Hade
2013-04-19 21:05 ` Steven Rostedt
2013-04-19 21:17 ` Steven Rostedt
2013-04-19 22:30 ` Bjorn Helgaas
2013-04-19 22:45 ` Gary Hade [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=20130419224550.GA10898@us.ibm.com \
--to=garyhade@us.ibm.com \
--cc=bhelgaas@google.com \
--cc=fweisbec@gmail.com \
--cc=lance.ortiz@hp.com \
--cc=linux-pci@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rostedt@goodmis.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;
as well as URLs for NNTP newsgroup(s).