Re: [PATCH] make size_t better approximate the reality

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux