[Mesa-dev] [PATCH 1/9] i965: Silence unused parameter warnings in intel_fbo.c

Anuj Phogat anuj.phogat at gmail.com
Thu Sep 10 11:57:32 PDT 2015


On Thu, Sep 10, 2015 at 11:47 AM, Ian Romanick <idr at freedesktop.org> wrote:

> On 09/10/2015 11:27 AM, Anuj Phogat wrote:
> >
> >
> > On Wed, Sep 9, 2015 at 7:18 PM, Ian Romanick <idr at freedesktop.org
> > <mailto:idr at freedesktop.org>> wrote:
> >
> >     From: Ian Romanick <ian.d.romanick at intel.com
> >     <mailto:ian.d.romanick at intel.com>>
> >
> >     intel_fbo.c: In function 'intel_alloc_window_storage':
> >     intel_fbo.c:415:48: warning: unused parameter 'ctx'
> [-Wunused-parameter]
> >      intel_alloc_window_storage(struct gl_context * ctx, struct
> >     gl_renderbuffer *rb,
> >                                                     ^
> >     intel_fbo.c: In function 'intel_nop_alloc_storage':
> >     intel_fbo.c:428:74: warning: unused parameter 'rb'
> [-Wunused-parameter]
> >      intel_nop_alloc_storage(struct gl_context * ctx, struct
> >     gl_renderbuffer *rb,
> >
> >           ^
> >     intel_fbo.c:429:32: warning: unused parameter 'internalFormat'
> >     [-Wunused-parameter]
> >                              GLenum internalFormat, GLuint width, GLuint
> >     height)
> >                                     ^
> >     intel_fbo.c:429:55: warning: unused parameter 'width'
> >     [-Wunused-parameter]
> >                              GLenum internalFormat, GLuint width, GLuint
> >     height)
> >                                                            ^
> >     intel_fbo.c:429:69: warning: unused parameter 'height'
> >     [-Wunused-parameter]
> >                              GLenum internalFormat, GLuint width, GLuint
> >     height)
> >
> ^
> >     intel_fbo.c: In function 'intel_blit_framebuffer_with_blitter':
> >     intel_fbo.c:790:61: warning: unused parameter 'filter'
> >     [-Wunused-parameter]
> >                                          GLbitfield mask, GLenum filter)
> >                                                                  ^
> >
> >     Signed-off-by: Ian Romanick <ian.d.romanick at intel.com
> >     <mailto:ian.d.romanick at intel.com>>
> >     ---
> >      src/mesa/drivers/dri/i965/intel_fbo.c | 11 ++++++++---
> >      1 file changed, 8 insertions(+), 3 deletions(-)
> >
> >     diff --git a/src/mesa/drivers/dri/i965/intel_fbo.c
> >     b/src/mesa/drivers/dri/i965/intel_fbo.c
> >     index 64d57e8..cc90a49 100644
> >     --- a/src/mesa/drivers/dri/i965/intel_fbo.c
> >     +++ b/src/mesa/drivers/dri/i965/intel_fbo.c
> >     @@ -415,6 +415,7 @@ static GLboolean
> >      intel_alloc_window_storage(struct gl_context * ctx, struct
> >     gl_renderbuffer *rb,
> >                                 GLenum internalFormat, GLuint width,
> >     GLuint height)
> >      {
> >     +   (void) ctx;
> >         assert(rb->Name == 0);
> >         rb->Width = width;
> >         rb->Height = height;
> >     @@ -428,6 +429,10 @@ static GLboolean
> >      intel_nop_alloc_storage(struct gl_context * ctx, struct
> >     gl_renderbuffer *rb,
> >                              GLenum internalFormat, GLuint width, GLuint
> >     height)
> >      {
> >     +   (void) rb;
> >     +   (void) internalFormat;
> >     +   (void) width;
> >     +   (void) height;
> >
> >
> > Using a macro might make the code more readable.
> > #define UNUSED(x) (void) (x)
>
> Maybe... there are a LOT of existing instance of the '(void) x;' idiom
> in Mesa.
>
> $ grep -r '(void) ' src/ | wc -l
> 1913
>
> Some of those are false positives of things like
>
>     (void) XSetErrorHandler(old_handler);
>
> but there are also cases like
>
>     (void) texImage; (void) i; (void) j; (void) k;
>
> that only get counted once by wc.
>
> I think if we want to change to using a macro, we should do it in one
> giant patch across the code base (and document it in docs/devinfo.html).
>  That will prevent future people from using the old method.
>
> It shouldn't be too hard to make a script that will make the change
> across the whole code base.
>

Sounds good.

>
> >         _mesa_problem(ctx, "intel_nop_alloc_storage should never be
> >     called.");
> >         return false;
> >      }
> >     @@ -787,7 +792,7 @@ intel_blit_framebuffer_with_blitter(struct
> >     gl_context *ctx,
> >                                          GLint srcX1, GLint srcY1,
> >                                          GLint dstX0, GLint dstY0,
> >                                          GLint dstX1, GLint dstY1,
> >     -                                    GLbitfield mask, GLenum filter)
> >     +                                    GLbitfield mask)
> >      {
> >         struct brw_context *brw = brw_context(ctx);
> >
> >     @@ -907,7 +912,7 @@ intel_blit_framebuffer(struct gl_context *ctx,
> >         mask = intel_blit_framebuffer_with_blitter(ctx, readFb, drawFb,
> >                                                    srcX0, srcY0, srcX1,
> >     srcY1,
> >                                                    dstX0, dstY0, dstX1,
> >     dstY1,
> >     -                                              mask, filter);
> >     +                                              mask);
> >         if (mask == 0x0)
> >            return;
> >
> >     @@ -945,7 +950,7 @@ gen4_blit_framebuffer(struct gl_context *ctx,
> >         mask = intel_blit_framebuffer_with_blitter(ctx, readFb, drawFb,
> >                                                    srcX0, srcY0, srcX1,
> >     srcY1,
> >                                                    dstX0, dstY0, dstX1,
> >     dstY1,
> >     -                                              mask, filter);
> >     +                                              mask);
> >         if (mask == 0x0)
> >            return;
> >
> >     --
> >     2.1.0
> >
> >     _______________________________________________
> >     mesa-dev mailing list
> >     mesa-dev at lists.freedesktop.org <mailto:
> mesa-dev at lists.freedesktop.org>
> >     http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> >
> >
> > Irrespective of the above suggestion, this patch is:
> > Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com
> > <mailto:anuj.phogat at gmail.com>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150910/d0b26f4d/attachment.html>


More information about the mesa-dev mailing list