linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@osdl.org>
To: Yura Pakhuchiy <pakhuchiy@gmail.com>
Cc: Josh Triplett <josh@freedesktop.org>, linux-sparse@vger.kernel.org
Subject: Re: sparse handles int64_t type wrong
Date: Tue, 12 Dec 2006 12:02:54 -0800 (PST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0612121155450.3535@woody.osdl.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0612121143280.3535@woody.osdl.org>



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.

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.

		Linus

  parent reply	other threads:[~2006-12-12 20:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-12 19:34 sparse handles int64_t type wrong Yura Pakhuchiy
2006-12-12 19:44 ` Linus Torvalds
2006-12-12 19:50   ` Yura Pakhuchiy
2006-12-12 20:02   ` Linus Torvalds [this message]
2006-12-12 20:25     ` Yura Pakhuchiy
2006-12-13  5:18     ` [PATCH][RFC] " Christopher Li
2006-12-13 15:36       ` Linus Torvalds
2006-12-14  0:13         ` Christopher Li
2006-12-14  0:57           ` Linus Torvalds
2006-12-14  4:21             ` Christopher Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.0612121155450.3535@woody.osdl.org \
    --to=torvalds@osdl.org \
    --cc=josh@freedesktop.org \
    --cc=linux-sparse@vger.kernel.org \
    --cc=pakhuchiy@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).