Re: [RFC/PATCH 2/2] sparse: Use native sizes for data types

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

 



On Sun, Oct 23, 2011 at 8:13 PM, Josh Triplett <josh@xxxxxxxxxxxxxxxx> wrote:
> On Sun, Oct 23, 2011 at 11:53:00AM -0400, Jeff Garzik wrote:
>> On 10/23/2011 08:37 AM, penberg@xxxxxxxxxxxxxx wrote:
>> >From: Pekka Enberg<penberg@xxxxxxxxxx>
>> >
>> >This patch is needed to fix the sparsec LLVM backend data type sizes.
>> >
>> >Cc: Christopher Li<sparse@xxxxxxxxxxx>
>> >Cc: Jeff Garzik<jgarzik@xxxxxxxxxx>
>> >Cc: Linus Torvalds<torvalds@xxxxxxxxxxxxxxxxxxxx>
>> >Signed-off-by: Pekka Enberg<penberg@xxxxxxxxxx>
>> >---
>> >  target.c |   10 +++++-----
>> >  1 files changed, 5 insertions(+), 5 deletions(-)
>> >
>> >diff --git a/target.c b/target.c
>> >index 6a535bc..009002f 100644
>> >--- a/target.c
>> >+++ b/target.c
>> >@@ -17,9 +17,9 @@ int max_alignment = 16;
>> >  int bits_in_bool = 8;
>> >  int bits_in_char = 8;
>> >  int bits_in_short = 16;
>> >-int bits_in_int = 32;
>> >-int bits_in_long = 32;
>> >-int bits_in_longlong = 64;
>> >+int bits_in_int = sizeof(int) * 8;
>> >+int bits_in_long = sizeof(long) * 8;
>> >+int bits_in_longlong = sizeof(long long) * 8;
>> >  int bits_in_longlonglong = 128;
>> >
>> >  int max_int_alignment = 4;
>> >@@ -36,8 +36,8 @@ int max_fp_alignment = 8;
>> >  /*
>> >   * Pointer data type
>> >   */
>> >-int bits_in_pointer = 32;
>> >-int pointer_alignment = 4;
>> >+int bits_in_pointer = sizeof(void *) * 8;
>> >+int pointer_alignment = sizeof(void *);
>>
>> No objection, but ideally we should select from a target template.
>>
>> We don't want to start down the road of making runtime target
>> switching (i386/x86-64) difficult.
>
> Agreed.  The platform that sparse checks code for should not necessarily
> correlate with what sparse observes at compile-time about the build
> platform.

Sure, I'm happy to implement this in some other way if you have an
idea how to do it cleanly. My patches don't make runtime switching
harder and I think using native data type sizes for plain sparse is a
better default.

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


[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