Re: [patch] new version, u64 cast avoidance

Albert Cahalan
2004-02-29T02:09:33Z

On Sat, 2004-02-28 at 20:08, Benjamin Herrenschmidt wrote:
> > a. my solution, as given
> > b. move u64 and friends to include/linux/*.h
> > c. you promise to never complain about warnings
> > d. printk("Ugly: " U64_FMT "\n", some_u64_value);
> > e. you patch gcc to modify format strings :-)
> > f. ...
> >
> > In other words, how do you propose to eliminate
> > the casts?
>
> Can't we live with those casts at least for a while ?
>
> I don't know honestly what is the best solution,
> they all sound equally ugly to me.

They are, until you count the number of occurances.
My solution, as given, puts #if crud in just 6 files.
The existing situation has crud all over the place,
growing day by day.

If there is some patch merging issue, I'd be happy
to send you a separate patch for ppc64.

If you'd prefer, I can create <linux/bit_types.h>
for these types and pull that in. For now it would
be included by all the asm-*/types.h files. Like so:

#if defined(_BROKEN_USER_TYPES) && !defined(__KERNEL__)
typedef unsigned long __u64;
typedef __signed__ long __s64;
#else
#if defined(__GNUC__)
__extension__ typedef unsigned long long __u64;
__extension__ typedef __signed__ long long __s64;
endif
#endif
/* ... */