lkml.org 
[lkml]   [2008]   [Dec]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch] powerpc: change u64/s64 to a long long integer type
On Tue, 23 Dec 2008 00:00:35 +0100
Sam Ravnborg <sam@ravnborg.org> wrote:

> On Mon, Dec 22, 2008 at 02:43:19PM -0800, Andrew Morton wrote:
> > On Mon, 22 Dec 2008 09:03:41 +0100
> > Ingo Molnar <mingo@elte.hu> wrote:
> >
> > > Subject: powerpc: change u64/s64 to a long long integer type
> >
> > <applause>
> >
> > There are lots of other architctures that need doing though.
>
> I have missed the introduction.
> Can you explain why?

People keep on doing

printk("%llu", some_u64);

testing it only on x86_64 and this generates a warning storm on
powerpc, sparc64, etc. Because they use `long', not `long long'.

And not just a little bit - this bug gets repeated maybe ten times per
week - it's insane.

If we make all architectures use `long long' then the above code
becomes correct and warning-free on all architectures.

And we then get to remove all the open-coded (unsigned long long) casts
which we added all over the tree (hundreds of them).

> I have done a bit of sparc hacking lately and was wondering if
> sparc needs something similar.
>
> cd arch/sparc
> git grep u64 | grep -v __u64 | wc -l
> 448
>
> [On the unified tree]

Yes, quite a few 64-bit architectures are using `long' for their
s64/u64 types. We should convert them all to `long long'.

That's quite trivial to do, but it causes a lot of warnings due to code
in arch-speciic files which does

printk("%lu", some_u64);

which will then generate a warning. Or an error if the archtiecture
uses -Werror, which several do. So we need to simultaneously convert
all those to %llu. (Or %Lu, which saves a byte :))





\
 
 \ /
  Last update: 2008-12-23 00:17    [W:0.084 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site