Re: [Mesa-dev] [PATCH] gallium/util: Silence GCC unused-but-set-variable warning.
On Wed, Jul 29, 2015 at 8:12 PM, Vinson Lee v...@freedesktop.org wrote: u_surface.c: In function 'util_resource_copy_region': u_surface.c:257:21: warning: variable 'src_format' set but not used [-Wunused-but-set-variable] enum pipe_format src_format, dst_format; ^ Signed-off-by: Vinson Lee v...@freedesktop.org --- src/gallium/auxiliary/util/u_surface.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gallium/auxiliary/util/u_surface.c b/src/gallium/auxiliary/util/u_surface.c index 654b5bb..e362471 100644 --- a/src/gallium/auxiliary/util/u_surface.c +++ b/src/gallium/auxiliary/util/u_surface.c @@ -270,6 +270,7 @@ util_resource_copy_region(struct pipe_context *pipe, assert(util_format_get_blocksize(dst_format) == util_format_get_blocksize(src_format)); assert(util_format_get_blockwidth(dst_format) == util_format_get_blockwidth(src_format)); assert(util_format_get_blockheight(dst_format) == util_format_get_blockheight(src_format)); + (void) src_format; We've recently begun using gcc's __attribute__((unused)) -- There's a macro named UNUSED. I might suggest using it. I've seen some case where the (void) trick wasn't sufficient. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] gallium/util: Silence GCC unused-but-set-variable warning.
u_surface.c: In function 'util_resource_copy_region': u_surface.c:257:21: warning: variable 'src_format' set but not used [-Wunused-but-set-variable] enum pipe_format src_format, dst_format; ^ Signed-off-by: Vinson Lee v...@freedesktop.org --- src/gallium/auxiliary/util/u_surface.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gallium/auxiliary/util/u_surface.c b/src/gallium/auxiliary/util/u_surface.c index 654b5bb..e362471 100644 --- a/src/gallium/auxiliary/util/u_surface.c +++ b/src/gallium/auxiliary/util/u_surface.c @@ -270,6 +270,7 @@ util_resource_copy_region(struct pipe_context *pipe, assert(util_format_get_blocksize(dst_format) == util_format_get_blocksize(src_format)); assert(util_format_get_blockwidth(dst_format) == util_format_get_blockwidth(src_format)); assert(util_format_get_blockheight(dst_format) == util_format_get_blockheight(src_format)); + (void) src_format; src_map = pipe-transfer_map(pipe, src, -- 2.1.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] gallium/util: Silence GCC unused-but-set-variable warning.
On Wed, Jul 29, 2015 at 8:33 PM, Matt Turner matts...@gmail.com wrote: On Wed, Jul 29, 2015 at 8:12 PM, Vinson Lee v...@freedesktop.org wrote: u_surface.c: In function 'util_resource_copy_region': u_surface.c:257:21: warning: variable 'src_format' set but not used [-Wunused-but-set-variable] enum pipe_format src_format, dst_format; ^ Signed-off-by: Vinson Lee v...@freedesktop.org --- src/gallium/auxiliary/util/u_surface.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gallium/auxiliary/util/u_surface.c b/src/gallium/auxiliary/util/u_surface.c index 654b5bb..e362471 100644 --- a/src/gallium/auxiliary/util/u_surface.c +++ b/src/gallium/auxiliary/util/u_surface.c @@ -270,6 +270,7 @@ util_resource_copy_region(struct pipe_context *pipe, assert(util_format_get_blocksize(dst_format) == util_format_get_blocksize(src_format)); assert(util_format_get_blockwidth(dst_format) == util_format_get_blockwidth(src_format)); assert(util_format_get_blockheight(dst_format) == util_format_get_blockheight(src_format)); + (void) src_format; We've recently begun using gcc's __attribute__((unused)) -- There's a macro named UNUSED. I might suggest using it. I've seen some case where the (void) trick wasn't sufficient. The variable is definitely used though in debug builds. Would unused still be the appropriate annotation in these cases? ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev