[Mesa-dev] [PATCH 05/21] mesa: Resolve GCC sign-compare warning.

Brian Paul brianp at vmware.com
Mon Aug 3 07:22:26 PDT 2015


On 08/03/2015 12:09 AM, Rhys Kidd wrote:
> mesa/src/mesa/drivers/dri/common/utils.c: In function 'driGetConfigAttrib':
> mesa/src/mesa/drivers/dri/common/utils.c:457:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
>       for (i = 0; i < ARRAY_SIZE(attribMap); i++)
>                     ^
>
> Signed-off-by: Rhys Kidd <rhyskidd at gmail.com>
> ---
>   src/mesa/drivers/dri/common/utils.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/mesa/drivers/dri/common/utils.c b/src/mesa/drivers/dri/common/utils.c
> index b51b263..4ff71cc 100644
> --- a/src/mesa/drivers/dri/common/utils.c
> +++ b/src/mesa/drivers/dri/common/utils.c
> @@ -452,7 +452,7 @@ int
>   driGetConfigAttrib(const __DRIconfig *config,
>   		   unsigned int attrib, unsigned int *value)
>   {
> -    int i;
> +    unsigned int i;
>
>       for (i = 0; i < ARRAY_SIZE(attribMap); i++)
>   	if (attribMap[i].attrib == attrib)
>

These look OK to me, but we typically just used 'unsigned' instead of 
'unsigned int'.

In the i965 code, the Intel guys would probably prefer 'unsigned' 
instead of 'GLuint'.

-Brian



More information about the mesa-dev mailing list