[Mesa-dev] [PATCH v2 17/29] mesa/main/framebuffer.h: Fix one -Wsign-compare warning in ?: construct.

Emil Velikov emil.l.velikov at gmail.com
Thu Nov 23 17:22:53 UTC 2017


On 21 November 2017 at 10:47, Gert Wollny <gw.fossdev at gmail.com> wrote:
> Am Donnerstag, den 16.11.2017, 22:52 +0100 schrieb Gert Wollny:
>> Am Donnerstag, den 16.11.2017, 17:13 +0000 schrieb Emil Velikov:
>> >
>> > According to the spec both of these are 'Z + Non-negative integer
>> > or enumerated value' Worth doing that instead?
>>
>> After having a short look into it, I guess it is doable, but I'd then
>> prefer to drop this patch from the series and do this separately,
>> i.e. really track this value to make its use consistent (also with
>> respect to function parameters etc).
>
> I had now a closer look at this: AFAICS the Visual.samples parameter is
> ultimately a user provided value via glXChooseVisual and could be set
> to a negative value.
>
> Right now a negative value is silently interpreted as if it would be
> zero. When one changes the definition of this variable
> (gl_config::samples) to unsigned, one should check that no negative
> value is passed. The question is, should it be silently set to zero
> thereby keeping the current behaviour, or should glXChooseVisual return
> NULL (i.e. an error)?
>
I seriously doubt any application is providing negative value, so
personally I'd just error out.
A better option is to see what other drivers do and follow suit.

-Emil


More information about the mesa-dev mailing list