linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josh Triplett <josh@freedesktop.org>
To: Al Viro <viro@ftp.linux.org.uk>
Cc: linux-sparse@vger.kernel.org
Subject: Re: [PATCH] make size_t better approximate the reality
Date: Sun, 08 Jul 2007 19:24:17 -0700	[thread overview]
Message-ID: <46919C51.1080903@freedesktop.org> (raw)
In-Reply-To: <20070701074953.GC1101@ftp.linux.org.uk>

[-- Attachment #1: Type: text/plain, Size: 1398 bytes --]

Al Viro wrote:
> Instead of "always unsigned long" go for "unsigned int unless
> -m64 is given, unsigned long otherwise".  Add an option (-msize-long)
> forcing to unsigned long regardless.  Make __SIZE_TYPE__ expansion
> match that.
> 
> The thing is, addition of checks on comparisons make for very unhappy
> min() on (kernel) size_t and sizeof(something) on the targets where
> the former is unsigned int.  Which is to say, more than half of them...
> AFAICS, the only place needing explicit -msize-long in CHECK_FLAGS
> is s390 (it's using unsigned long both for 31- and 64-bit).

Seems reasonable.  One comment, though:

> @@ -599,7 +604,10 @@ void create_builtin_stream(void)
>  	// it is "long unsigned int".  In either case we can probably
>  	// get away with this.  We need the #weak_define as cgcc will define
>  	// the right __SIZE_TYPE__.
> -	add_pre_buffer("#weak_define __SIZE_TYPE__ long unsigned int\n");
> +	if (size_t_ctype == &ulong_ctype)
> +		add_pre_buffer("#weak_define __SIZE_TYPE__ long unsigned int\n");
> +	else
> +		add_pre_buffer("#weak_define __SIZE_TYPE__ unsigned int\n");

I think the comment above this needs updating for this change, as it describes
the situation created by the code you've removed, not the new situation.
Perhaps the comment should just go away?

In any case, I've applied the patch anyway.

- Josh Triplett



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

      reply	other threads:[~2007-07-09  2:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-01  7:49 [PATCH] make size_t better approximate the reality Al Viro
2007-07-09  2:24 ` Josh Triplett [this message]

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=46919C51.1080903@freedesktop.org \
    --to=josh@freedesktop.org \
    --cc=linux-sparse@vger.kernel.org \
    --cc=viro@ftp.linux.org.uk \
    /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).