[Mesa-dev] [PATCH] mesa: Fix format specifier warning in mesa_DispatchComputeIndirect()
Boyan Ding
boyan.j.ding at gmail.com
Wed Sep 30 05:07:47 PDT 2015
2015-09-30 19:15 GMT+08:00 Rhys Kidd <rhyskidd at gmail.com>:
> Commit 1665d29ee3125743fd6daf3c43fc715f543d5669 introduced an incorrect
> format specifier that operates on GLintptr indirect within the function
> _mesa_DispatchComputeIndirect().
>
> This patch mitigates the introduced GCC warning:
>
> src/mesa/main/compute.c: In function '_mesa_DispatchComputeIndirect':
> src/mesa/main/compute.c:53:7: warning: format '%d' expects argument of type 'int', but argument 3 has type 'GLintptr' [-Wformat=]
> _mesa_debug(ctx, "glDispatchComputeIndirect(%d)\n", indirect);
> ^
>
> Signed-off-by: Rhys Kidd <rhyskidd at gmail.com>
> ---
> src/mesa/main/compute.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/mesa/main/compute.c b/src/mesa/main/compute.c
> index 8bc3bcd..00956f0 100644
> --- a/src/mesa/main/compute.c
> +++ b/src/mesa/main/compute.c
> @@ -50,7 +50,7 @@ _mesa_DispatchComputeIndirect(GLintptr indirect)
> GET_CURRENT_CONTEXT(ctx);
>
> if (MESA_VERBOSE & VERBOSE_API)
> - _mesa_debug(ctx, "glDispatchComputeIndirect(%d)\n", indirect);
> + _mesa_debug(ctx, "glDispatchComputeIndirect(%d)\n", (int) indirect);
This change only suppresses the compiler warning, but the new code is
no better (or even worse, since the no alarm will be given for possible
overflow). I advise changing the format string from %d to %ld instead.
Cheers,
Boyan Ding
>
> if (!_mesa_validate_DispatchComputeIndirect(ctx, indirect))
> return;
> --
> 2.1.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list