microsoft/compiler: Add scope for declaration in case statement.
authorVinson Lee <vlee@freedesktop.org>
Wed, 11 Nov 2020 22:08:48 +0000 (14:08 -0800)
committerMarge Bot <eric+marge@anholt.net>
Wed, 18 Nov 2020 03:38:37 +0000 (03:38 +0000)
This patch fixes this build error.

../src/microsoft/compiler/dxil_nir.c: In function 'extract_comps_from_vec32':
../src/microsoft/compiler/dxil_nir.c:52:10: error: a label can only be part of a statement and a declaration is not a statement
   52 |          unsigned dst_offs = i * comps_per32b;
      |          ^~~~~~~~

Fixes: b9c61379ab4 ("microsoft/compiler: translate nir to dxil")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7563>

src/microsoft/compiler/dxil_nir.c

index a79c8f5..e6c7a09 100644 (file)
@@ -48,12 +48,13 @@ extract_comps_from_vec32(nir_builder *b, nir_ssa_def *vec32,
          dst_comps[i] = nir_channel(b, vec32, i);
          break;
       case 16:
-      case 8:
+      case 8: {
          unsigned dst_offs = i * comps_per32b;
 
          tmp = nir_unpack_bits(b, nir_channel(b, vec32, i), dst_bit_size);
          for (unsigned j = 0; j < comps_per32b && dst_offs + j < num_dst_comps; j++)
             dst_comps[dst_offs + j] = nir_channel(b, tmp, j);
+         }
 
          break;
       }