[PATCH xquartz 04/10] randr: Silence -Wshift-negative-value warnings

walter harms wharms at bfs.de
Thu Oct 15 09:24:38 PDT 2015



Am 15.10.2015 00:33, schrieb Alan Coopersmith:
> On 10/14/15 03:13 PM, Jeremy Huddleston Sequoia wrote:
>> rrtransform.c:199:23: warning: shifting a negative signed value is
>> undefined [-Wshift-negative-value,Semantic Issue]
>>              rot_cos = F(-1);
> 
> 
>> -            rot_cos = F(-1);
>> +            rot_cos = F(~0u);
> 
> Is -1 guaranteed to be ~0u on all platforms?   Or just all the ones we know
> and care about?
> 
> Would it be better to instead do:
> -#define F(x)    IntToxFixed(x)
> +#define F(x)    IntToxFixed((uint32_t) x)
> 
> in randr/rrtransform.c ?
> 

i always feel bad when seeing 1char macros.
Perhaps we can remove it also by simple S&R ?

just my 2 cents.

re,
 wh


More information about the xorg-devel mailing list