Re: [patch] new version, u64 cast avoidance

From: Matt Mackall
Date: Sat Feb 28 2004 - 22:28:07 EST


On Sat, Feb 28, 2004 at 06:49:23PM -0500, Albert Cahalan wrote:
> 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
> /* ... */

And if we can actually manage to eliminate the long-deprecated
inclusion of kernel headers by userspace in 2.7, we can kill that
conditional too.

--
Matt Mackall : http://www.selenic.com : Linux development and consulting
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/