[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130121213823.GA4774@us.ibm.com>
Date: Mon, 21 Jan 2013 13:38:23 -0800
From: Sukadev Bhattiprolu <sukadev@...ux.vnet.ibm.com>
To: Jiri Olsa <jolsa@...hat.com>
Cc: acme@...stprotocols.net, Anton Blanchard <anton@....ibm.com>,
paulus@...ba.org, linux-kernel@...r.kernel.org,
linuxppc-dev@...abs.org
Subject: Re: [PATCH] perf: Fix compile warnings in tests/attr.c
Jiri Olsa [jolsa@...hat.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@...ux.vnet.ibm.com>
| > Date: Fri, 18 Jan 2013 11:14:28 -0800
| > Subject: [PATCH] perf: Fix compile warnings in tests/attr.c
| >
| > Replace '%llu' in printf()s with 'PRIu64' in 'tools/perf/tests/attr.c'
| > to fix compile warnings (which become errors due to -Werror).
|
| 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.
|
| with your patch for x86_64 I'm getting following warnings/errors:
|
| CC tests/attr.o
| tests/attr.c: In function ‘store_event’:
| tests/attr.c:69:4: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 6 has type ‘__u64’ [-Werror=format]
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 unsigned long long
where the #error is my debug message.
<snip>
| make: *** [tests/attr.o] Error 1
|
| 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 __WORDSIZE
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=0 make' ?
Sukadev
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists