[Mesa-dev] [PATCH 1/2 v2] gallium: Silence unused variable warnings

Gurkirpal Singh gurkirpal204 at gmail.com
Tue Jun 28 22:14:50 UTC 2016


v2: Use MAYBE_UNUSED as suggested by Ian Romanick

Signed-off-by: Gurkirpal Singh <gurkirpal204 at gmail.com>
---
 src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nv50.cpp | 4 +++-
 src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp  | 4 +++-
 src/gallium/drivers/nouveau/nv50/nv98_video.c             | 4 +++-
 src/gallium/drivers/nouveau/nvc0/nvc0_video.c             | 8 +++++---
 src/gallium/drivers/softpipe/sp_state_shader.c            | 3 ++-
 src/gallium/state_trackers/xvmc/surface.c                 | 5 +++--
 src/gallium/state_trackers/xvmc/tests/xvmc_bench.c        | 8 +++++---
 7 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nv50.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nv50.cpp
index 0fe399b..9fc7c5a 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nv50.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nv50.cpp
@@ -23,6 +23,8 @@
 #include "codegen/nv50_ir.h"
 #include "codegen/nv50_ir_target_nv50.h"
 
+#include "util/macros.h"
+
 namespace nv50_ir {
 
 #define NV50_OP_ENC_LONG     0
@@ -621,7 +623,7 @@ void
 CodeEmitterNV50::emitLOAD(const Instruction *i)
 {
    DataFile sf = i->src(0).getFile();
-   int32_t offset = i->getSrc(0)->reg.data.offset;
+   MAYBE_UNUSED int32_t offset = i->getSrc(0)->reg.data.offset;
 
    switch (sf) {
    case FILE_SHADER_INPUT:
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
index 3213188..6a60a7b 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
@@ -24,6 +24,8 @@
 #include "codegen/nv50_ir_target.h"
 #include "codegen/nv50_ir_build_util.h"
 
+#include "util/macros.h"
+
 extern "C" {
 #include "util/u_math.h"
 }
@@ -2963,7 +2965,7 @@ NV50PostRaConstantFolding::visit(BasicBlock *bb)
                i->setSrc(1, def->getSrc(0));
             } else {
                ImmediateValue val;
-               bool ret = def->src(0).getImmediate(val);
+               MAYBE_UNUSED bool ret = def->src(0).getImmediate(val);
                assert(ret);
                if (i->getSrc(1)->reg.data.id & 1)
                   val.reg.data.u32 >>= 16;
diff --git a/src/gallium/drivers/nouveau/nv50/nv98_video.c b/src/gallium/drivers/nouveau/nv50/nv98_video.c
index 177a7e0..d348807 100644
--- a/src/gallium/drivers/nouveau/nv50/nv98_video.c
+++ b/src/gallium/drivers/nouveau/nv50/nv98_video.c
@@ -24,6 +24,7 @@
 
 #include "util/u_sampler.h"
 #include "util/u_format.h"
+#include "util/macros.h"
 
 #include <nvif/class.h>
 
@@ -40,7 +41,8 @@ nv98_decoder_decode_bitstream(struct pipe_video_codec *decoder,
    uint32_t comm_seq = ++dec->fence_seq;
    union pipe_desc desc;
 
-   unsigned vp_caps, is_ref, ret;
+   unsigned vp_caps, is_ref;
+   MAYBE_UNUSED unsigned ret;
    struct nouveau_vp3_video_buffer *refs[16] = {};
 
    desc.base = picture;
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_video.c b/src/gallium/drivers/nouveau/nvc0/nvc0_video.c
index a9fd1d2..10cb31e 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_video.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_video.c
@@ -24,6 +24,7 @@
 
 #include "util/u_sampler.h"
 #include "util/u_format.h"
+#include "util/macros.h"
 
 static void
 nvc0_decoder_begin_frame(struct pipe_video_codec *decoder,
@@ -32,7 +33,7 @@ nvc0_decoder_begin_frame(struct pipe_video_codec *decoder,
 {
    struct nouveau_vp3_decoder *dec = (struct nouveau_vp3_decoder *)decoder;
    uint32_t comm_seq = ++dec->fence_seq;
-   unsigned ret = 0;
+   MAYBE_UNUSED unsigned ret = 0;
 
    assert(dec);
    assert(target);
@@ -53,7 +54,7 @@ nvc0_decoder_decode_bitstream(struct pipe_video_codec *decoder,
 {
    struct nouveau_vp3_decoder *dec = (struct nouveau_vp3_decoder *)decoder;
    uint32_t comm_seq = dec->fence_seq;
-   unsigned ret = 0;
+   MAYBE_UNUSED unsigned ret = 0;
 
    assert(decoder);
 
@@ -72,7 +73,8 @@ nvc0_decoder_end_frame(struct pipe_video_codec *decoder,
    uint32_t comm_seq = dec->fence_seq;
    union pipe_desc desc;
 
-   unsigned vp_caps, is_ref, ret;
+   unsigned vp_caps, is_ref;
+   MAYBE_UNUSED unsigned ret;
    struct nouveau_vp3_video_buffer *refs[16] = {};
 
    desc.base = picture;
diff --git a/src/gallium/drivers/softpipe/sp_state_shader.c b/src/gallium/drivers/softpipe/sp_state_shader.c
index a745662..d02727f 100644
--- a/src/gallium/drivers/softpipe/sp_state_shader.c
+++ b/src/gallium/drivers/softpipe/sp_state_shader.c
@@ -34,6 +34,7 @@
 #include "util/u_memory.h"
 #include "util/u_inlines.h"
 #include "util/u_pstipple.h"
+#include "util/macros.h"
 #include "draw/draw_context.h"
 #include "draw/draw_vs.h"
 #include "draw/draw_gs.h"
@@ -420,7 +421,7 @@ static void
 softpipe_delete_compute_state(struct pipe_context *pipe,
                               void *cs)
 {
-   struct softpipe_context *softpipe = softpipe_context(pipe);
+   MAYBE_UNUSED struct softpipe_context *softpipe = softpipe_context(pipe);
    struct sp_compute_shader *state = (struct sp_compute_shader *)cs;
 
    assert(softpipe->cs != state);
diff --git a/src/gallium/state_trackers/xvmc/surface.c b/src/gallium/state_trackers/xvmc/surface.c
index 199712b..b818dfd 100644
--- a/src/gallium/state_trackers/xvmc/surface.c
+++ b/src/gallium/state_trackers/xvmc/surface.c
@@ -37,6 +37,7 @@
 #include "util/u_inlines.h"
 #include "util/u_memory.h"
 #include "util/u_math.h"
+#include "util/macros.h"
 #include "vl/vl_winsys.h"
 
 #include "xvmc_private.h"
@@ -226,8 +227,8 @@ Status XvMCRenderSurface(Display *dpy, XvMCContext *context, unsigned int pictur
 
    XvMCContextPrivate *context_priv;
    XvMCSurfacePrivate *target_surface_priv;
-   XvMCSurfacePrivate *past_surface_priv;
-   XvMCSurfacePrivate *future_surface_priv;
+   MAYBE_UNUSED XvMCSurfacePrivate *past_surface_priv;
+   MAYBE_UNUSED XvMCSurfacePrivate *future_surface_priv;
    XvMCMacroBlock *xvmc_mb;
 
    XVMC_MSG(XVMC_TRACE, "[XvMC] Rendering to surface %p, with past %p and future %p\n",
diff --git a/src/gallium/state_trackers/xvmc/tests/xvmc_bench.c b/src/gallium/state_trackers/xvmc/tests/xvmc_bench.c
index 4dc95ba..e3b5384 100644
--- a/src/gallium/state_trackers/xvmc/tests/xvmc_bench.c
+++ b/src/gallium/state_trackers/xvmc/tests/xvmc_bench.c
@@ -32,6 +32,8 @@
 #include <sys/time.h>
 #include "testlib.h"
 
+#include "util/macros.h"
+
 #define MACROBLOCK_WIDTH		16
 #define MACROBLOCK_HEIGHT		16
 #define BLOCKS_PER_MACROBLOCK		6
@@ -184,9 +186,9 @@ int main(int argc, char **argv)
 	int			surface_type_id;
 	unsigned int		is_overlay, intra_unsigned;
 	int			colorkey;
-	XvMCContext		context;
-	XvMCSurface		surface;
-	XvMCBlockArray		block_array;
+	MAYBE_UNUSED XvMCContext		context;
+	MAYBE_UNUSED XvMCSurface		surface;
+	MAYBE_UNUSED XvMCBlockArray		block_array;
 	XvMCMacroBlockArray	mb_array;
 	unsigned int		mbw, mbh;
 	unsigned int		mbx, mby;
-- 
2.7.4



More information about the mesa-dev mailing list