[Mesa-dev] [PATCH] silence unused code warnings

Brian Paul brianp at vmware.com
Wed Dec 5 07:56:07 PST 2012


Comments below.

On 12/05/2012 07:02 AM, Fabio Pedretti wrote:
> diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir_print.cpp b/src/gallium/drivers/nv50/codegen/nv50_ir_print.cpp
> index ded4f61..ea81e53 100644
> --- a/src/gallium/drivers/nv50/codegen/nv50_ir_print.cpp
> +++ b/src/gallium/drivers/nv50/codegen/nv50_ir_print.cpp
> @@ -67,26 +67,6 @@ static void init_colours()
>        colour = _colour;
>  }
>
> -static const char *OpClassStr[OPCLASS_OTHER + 1] =
> -{
> -   "MOVE",
> -   "LOAD",
> -   "STORE",
> -   "ARITH",
> -   "SHIFT",
> -   "SFU",
> -   "LOGIC",
> -   "COMPARE",
> -   "CONVERT",
> -   "ATOMIC",
> -   "TEXTURE",
> -   "SURFACE",
> -   "FLOW",
> -   "(INVALID)",
> -   "PSEUDO",
> -   "OTHER"
> -};
> -
>  const char *operationStr[OP_LAST + 1] =
>  {
>     "nop",

I'd call that "nv50: remove unused OpClassStr array"


> diff --git a/src/gallium/drivers/nvc0/nvc0_state_validate.c b/src/gallium/drivers/nvc0/nvc0_state_validate.c
> index 0f92614..80a8c01 100644
> --- a/src/gallium/drivers/nvc0/nvc0_state_validate.c
> +++ b/src/gallium/drivers/nvc0/nvc0_state_validate.c
> @@ -3,6 +3,7 @@
>
>  #include "nvc0_context.h"
>
> +#if 0
>  static void
>  nvc0_validate_zcull(struct nvc0_context *nvc0)
>  {
> @@ -51,6 +52,7 @@ nvc0_validate_zcull(struct nvc0_context *nvc0)
>      BEGIN_NVC0(push, NVC0_3D(ZCULL_INVALIDATE), 1);
>      PUSH_DATA (push, 0);
>  }
> +#endif
>
>  static void
>  nvc0_validate_fb(struct nvc0_context *nvc0)

This doesn't appear to apply to the master branch.


> diff --git a/src/gallium/state_trackers/vega/path.c b/src/gallium/state_trackers/vega/path.c
> index 43755f4..31ec719 100644
> --- a/src/gallium/state_trackers/vega/path.c
> +++ b/src/gallium/state_trackers/vega/path.c
> @@ -1085,10 +1085,8 @@ static INLINE VGubyte normalize_coords(struct path_iter_data *pd,
>     }
>        break;
>     case VG_SCUBIC_TO: {
> -      VGfloat x0, y0, x1, y1, x2, y2, x3, y3;
> +      VGfloat x1, y1, x2, y2, x3, y3;
>        data_at(&pd->coords, pd->path, 0, 4, data);
> -      x0 = pd->ox;
> -      y0 = pd->oy;
>        x1 = 2*pd->ox-pd->px;
>        y1 = 2*pd->oy-pd->py;
>        x2 = data[0];

That patch is fine.  I'd suggest "vega: remove unused variables" as 
the name.


> diff --git a/src/gallium/state_trackers/vega/vg_translate.c b/src/gallium/state_trackers/vega/vg_translate.c
> index 7b3df27..6c1e354 100644
> --- a/src/gallium/state_trackers/vega/vg_translate.c
> +++ b/src/gallium/state_trackers/vega/vg_translate.c
> @@ -201,8 +201,7 @@ void _vega_pack_rgba_span_float(struct vg_context *ctx,
>     case VG_BW_1: {
>        VGshort *dst = (VGshort *)dstAddr;
>        for (i = 0; i < n; ++i) {
> -         VGubyte r, g, b, a;
> -         VGubyte res;
> +         VGubyte r, g, b, a, res;
>           r = float_to_ubyte(rgba[i][0]);
>           g = float_to_ubyte(rgba[i][1]);
>           b = float_to_ubyte(rgba[i][2]);
> @@ -229,8 +228,7 @@ void _vega_pack_rgba_span_float(struct vg_context *ctx,
>     case VG_A_4: {
>        VGshort *dst = (VGshort *)dstAddr;
>        for (i = 0; i < n; ++i) {
> -         VGubyte a;
> -         VGubyte res;
> +         VGubyte a, res;
>           a = float_to_ubyte(rgba[i][3]);
>
>           res = a/4;
>

I don't really see the need for these cosmetic changes.

-Brian


More information about the mesa-dev mailing list