[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-sparse
Subject:    Re: sparse handles int64_t type wrong
From:       Yura Pakhuchiy <pakhuchiy () gmail ! com>
Date:       2006-12-12 20:25:25
Message-ID: 1165955125.17896.13.camel () chaos ! malinovka7 ! net
[Download RAW message or body]

On Tue, 12 Dec 2006 at 12:02 -0800, Linus Torvalds wrote:
> On Tue, 12 Dec 2006, Linus Torvalds wrote:
> > 
> > Did you use "-m64" if you are doing this on an architecture with 64-bit 
> > /usr/include?
> 
> Never mind, that's not it.
> 
> The problem is that the standard headers use _this_ for "int64_t":
> 
> 	typedef int int64_t __attribute__ ((__mode__ (__DI__)));
> 
> and sparse just says "ok, int64_t is an 'int'"
> 
> The "__attribute__((__mode__()))" thing has always been a quick hack - 
> sparse actually tries to parse it, but not very well.
> 
> If you use 
> 
> 	typedef long long s64;
> 
> sparse gets it right.
> 
> In fact, sparse even gets it right if you do
> 
> 	typedef int __attribute__((__mode__(__DI__))) int64_t;
> 
> because then the attribute gets attached to the underlying type, before it 
> gets bound to the typedef.

Great! This works for me. So I will probably use
	#ifdef __CHECKER__
	typedef int __attribute__((__mode__(__DI__))) int64_t;
	#endif
until it will be fixed in sparse.

> I'll take a look if I can fix typedef to accept the crapola __attibute__ 
> syntax.
> 
> Putting the attributes at the end really _does_ suck. It's as if you were 
> to write
> 
> 	typedef void * const_ptr_t const;
> 
> and that obviously isn't supposed to work. Why gcc thinks attributes can 
> go at the end will never be clear to me.
> 
> Gcc attributes suck. Some gcc extensions really were thought out really 
> really badly.

Thanks for quick reply and explanations!

-- 
Best regards,
        Yura

-
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic