[PATCH] test/input: Replace negative architecture test by test for 64-bit

walter harms wharms at bfs.de
Tue Feb 12 05:41:14 PST 2013



Am 12.02.2013 13:40, schrieb Mark Kettenis:
>> From: Geert Uytterhoeven <geert at linux-m68k.org>
>> Date: Tue, 12 Feb 2013 11:17:22 +0100
>>
>> The test for double-aligned members in dix_valuator_alloc() currently
>> depends on "if !defined(__i386__) && !defined(__sh__)". This covers
>> m68k, where it fails.
>>
>> According to the comment, the test should be limited to 64-bit
>> platforms only. Hence check if sizeof(long) == 8 instead.
> 
> Unfortunately the comment isn't accurate.  There are quite a few
> 32-bit architectures that demand 64-bit alignment of doubles.  At
> least arm, hppa, powerpc and sparc fall into that category.  Those
> that only required 32-bit alignment seemed to be a minority.  Even if
> you include m68k in that category, that's still the case.
> 
hi all,

is it possible the add something like:
_FORCE_64-BIT_ALIGMENT_OF_DOUBLES_
instead  of !defined(__i386__) ....   ??
A nice additional effect would be the explanation what
to archive.

people are very bad of thinking inverse so it
is always a good idea to avoid things like "!defined".

just my 2 cents,
 wh



> My advice would be to add __m68k__ to the list and adjust the comment
> to say something like: "Most architectures, even 32-bit ones, require
> 64-bit alignment".
> 
>> Signed-off-by: Geert Uytterhoeven <geert at linux-m68k.org>
>> ---
>> Untested for now
>>
>>  test/input.c |   10 +++++-----
>>  1 files changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/test/input.c b/test/input.c
>> index be988a4..ed29bdc 100644
>> --- a/test/input.c
>> +++ b/test/input.c
>> @@ -1384,11 +1384,11 @@ dix_valuator_alloc(void)
>>  
>>          assert(v);
>>          assert(v->numAxes == num_axes);
>> -#if !defined(__i386__) && !defined(__sh__)
>> -        /* must be double-aligned on 64 bit */
>> -        assert(((void *) v->axisVal - (void *) v) % sizeof(double) == 0);
>> -        assert(((void *) v->axes - (void *) v) % sizeof(double) == 0);
>> -#endif
>> +        if (sizeof(long) == 8) {
>> +            /* must be double-aligned on 64 bit */
>> +            assert(((void *) v->axisVal - (void *) v) % sizeof(double) == 0);
>> +            assert(((void *) v->axes - (void *) v) % sizeof(double) == 0);
>> +        }
>>          num_axes++;
>>      }
>>  
>> -- 
>> 1.7.0.4
>>
>> _______________________________________________
>> xorg-devel at lists.x.org: X.Org development
>> Archives: http://lists.x.org/archives/xorg-devel
>> Info: http://lists.x.org/mailman/listinfo/xorg-devel
>>
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
> 


More information about the xorg-devel mailing list