Linux-PCI Archive on lore.kernel.org
 help / color / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Gary Hade <garyhade@us.ibm.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
	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>
Subject: Re: "unsigned expression < 0" always false warning
Date: Fri, 19 Apr 2013 17:05:57 -0400
Message-ID: <1366405557.9609.122.camel@gandalf.local.home> (raw)
In-Reply-To: <20130419204304.GA28603@us.ibm.com>

On Fri, 2013-04-19 at 13:43 -0700, Gary Hade wrote:

> The above
>   "__field(        u32,            status          )"
> gets expanded to
>   "ret = trace_define_field(event_call, "u32", "status", __builtin_offsetof(typeof(field),status), sizeof(field.status), (((u32)(-1)) < (u32)0), FILTER_OTHER); if (ret) return ret;"
> 
> The warning is triggered by:
>   "(((u32)(-1)) < (u32)0)"
> which was put there by is_signed_type.
> 
> It appears that is_signed_type is simply taking advantage of the same
> action that the compiler is warning about to perform it's function.

Yeah, that's the point of the macro.

> 
> Not sure how to make is_signed_type warningless although
> it does create a significant amount of noise during a full
> `make W=1` kernel build.  With 3.9-rc7 it appears to be
> responsible for 1401 of 1476 occurrences of "warning: comparison
> of unsigned expression < 0 is always false".

Since it is complaining about being less than zero, I just checked, the
following also works.

#define is_signed_type(type) ((type)-1 < (type)1)

And doesn't give the warning.

I'll go make a patch.

Thanks!

-- Steve



  reply index

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-15 17:17 Bjorn Helgaas
2013-04-19 20:43 ` Gary Hade
2013-04-19 21:05   ` Steven Rostedt [this message]
2013-04-19 21:17 ` Steven Rostedt
2013-04-19 22:30   ` Bjorn Helgaas
2013-04-19 22:45     ` Gary Hade

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=1366405557.9609.122.camel@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=bhelgaas@google.com \
    --cc=fweisbec@gmail.com \
    --cc=garyhade@us.ibm.com \
    --cc=lance.ortiz@hp.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=mingo@redhat.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

Linux-PCI Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-pci/0 linux-pci/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-pci linux-pci/ https://lore.kernel.org/linux-pci \
		linux-pci@vger.kernel.org
	public-inbox-index linux-pci

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-pci


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git