linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
To: Jiri Olsa <jolsa@redhat.com>
Cc: linuxppc-dev@ozlabs.org, Anton Blanchard <anton@au1.ibm.com>,
	paulus@samba.org, linux-kernel@vger.kernel.org,
	acme@ghostprotocols.net
Subject: Re: [PATCH] perf: Fix compile warnings in tests/attr.c
Date: Mon, 21 Jan 2013 13:38:23 -0800	[thread overview]
Message-ID: <20130121213823.GA4774@us.ibm.com> (raw)
In-Reply-To: <20130121135906.GD1995@krava.brq.redhat.com>

Jiri Olsa [jolsa@redhat.com] wrote:
| On Fri, Jan 18, 2013 at 05:30:52PM -0800, Sukadev Bhattiprolu wrote:
| > From 4d266e5040c33103f5d226b0d16b89f8ef79e3ad Mon Sep 17 00:00:00 2001
| > From: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
| > Date: Fri, 18 Jan 2013 11:14:28 -0800
| > Subject: [PATCH] perf: Fix compile warnings in tests/attr.c
| >=20
| > Replace '%llu' in printf()s with 'PRIu64' in 'tools/perf/tests/attr.c'
| > to fix compile warnings (which become errors due to -Werror).
|=20
| i386 and x86_64 compiles fine for me with gcc versions 4.6.3-2 and 4.7.2-2

But is broken on Power for 64bit :-( I am trying to fix that and thought
that use of format specifiers like 'PRIu64' was the way to go.

|=20
| with your patch for x86_64 I'm getting following warnings/errors:

|=20
|     CC tests/attr.o
| tests/attr.c: In function =E2=80=98store_event=E2=80=99:
| tests/attr.c:69:4: error: format =E2=80=98%lu=E2=80=99 expects argument o=
f type =E2=80=98long unsigned int=E2=80=99, but argument 6 has type =E2=80=
=98__u64=E2=80=99 [-Werror=3Dformat]

Here is what I see on an x86_64 box, RHEL6.2 box:

	$ rpm -qf /usr/include/linux/types.h
	kernel-headers-2.6.32-220.4.2.el6.x86_64

	$ cat foo.c
	#include <linux/types.h>

	$ cc -Werror -Wall foo.c
	In file included from /usr/include/asm-generic/types.h:7,
			 from /usr/include/asm/types.h:6,
			 from /usr/include/linux/types.h:4,
			 from foo5.c:1:
	/usr/include/asm-generic/int-ll64.h:31:2: error: #error __u64 defined as u=
nsigned long long

where the #error is my debug message.

<snip>

| make: *** [tests/attr.o] Error 1
|=20
| i386 compiles fine

__u64 is 'unsigned long long' on x86 and PRIu64 is 'llu' which is fine.

__u64 is 'unsigned long' on Power and PRIu64 is 'lu' which is again fine.

But __u64 is 'unsigned long long' on x86_64, but PRIu64 is '%lu' bc __WORDS=
IZE
is 64.

On x86_64, shouldn't __u64, be defined as 'unsigned long' rather than
'unsigned long long' - ie include 'int-l64.h' rather than 'int-ll64.h' ?

BTW, does 'perf' with my patch compile, (with warnings) for you on x86_64
with 'WERROR=3D0 make' ?

Sukadev

  reply	other threads:[~2013-01-21 21:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-19  1:30 [PATCH] perf: Fix compile warnings in tests/attr.c Sukadev Bhattiprolu
2013-01-21 13:59 ` Jiri Olsa
2013-01-21 21:38   ` Sukadev Bhattiprolu [this message]
2013-01-22 13:57     ` Jiri Olsa
2013-01-22 23:45     ` Michael Ellerman
2013-01-23 18:57       ` Sukadev Bhattiprolu
2013-01-24  2:42         ` Michael Ellerman

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=20130121213823.GA4774@us.ibm.com \
    --to=sukadev@linux.vnet.ibm.com \
    --cc=acme@ghostprotocols.net \
    --cc=anton@au1.ibm.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=paulus@samba.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).