[Mesa-dev] [PATCH] spirv: Silence a couple of warnings

Jason Ekstrand jason at jlekstrand.net
Wed Dec 5 21:13:32 UTC 2018


They occur when building with clang:

[1/40] Compiling C object 'src/compiler/nir/s...piler at nir@@nir at sta/.._spirv_vtn_glsl450.c.o'.
../src/compiler/spirv/vtn_glsl450.c:845:39: warning: implicit conversion from enumeration type 'SpvOp' (aka 'enum SpvOp_') to different enumeration type 'enum GLSLstd450' [-Wenum-conversion]
      handle_glsl450_interpolation(b, ext_opcode, w, count);
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~    ^~~~~~~~~~
1 warning generated.
[2/40] Compiling C object 'src/compiler/nir/s...iler at nir@@nir at sta/.._spirv_spirv_to_nir.c.o'.
../src/compiler/spirv/spirv_to_nir.c:2167:30: warning: suggest braces around initialization of subobject [-Wmissing-braces]
         nir_tex_src none = {0};
                             ^
                             {}
../src/compiler/spirv/spirv_to_nir.c:2167:30: warning: suggest braces around initialization of subobject [-Wmissing-braces]
         nir_tex_src none = {0};
                             ^
                             {}
2 warnings generated.
---
 src/compiler/spirv/spirv_to_nir.c | 2 +-
 src/compiler/spirv/vtn_glsl450.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c
index 22efaa276d9..2ce2cbd1c4d 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -2164,7 +2164,7 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode,
          (*p++) = vtn_tex_src(b, w[idx++], nir_tex_src_offset);
 
       if (operands & SpvImageOperandsConstOffsetsMask) {
-         nir_tex_src none = {0};
+         nir_tex_src none = { .src_type = 0 };
          gather_offsets = vtn_ssa_value(b, w[idx++]);
          (*p++) = none;
       }
diff --git a/src/compiler/spirv/vtn_glsl450.c b/src/compiler/spirv/vtn_glsl450.c
index b54aeb9b217..dcfc85a579c 100644
--- a/src/compiler/spirv/vtn_glsl450.c
+++ b/src/compiler/spirv/vtn_glsl450.c
@@ -842,7 +842,7 @@ vtn_handle_glsl450_instruction(struct vtn_builder *b, SpvOp ext_opcode,
    case GLSLstd450InterpolateAtCentroid:
    case GLSLstd450InterpolateAtSample:
    case GLSLstd450InterpolateAtOffset:
-      handle_glsl450_interpolation(b, ext_opcode, w, count);
+      handle_glsl450_interpolation(b, (enum GLSLstd450)ext_opcode, w, count);
       break;
 
    default:
-- 
2.19.2



More information about the mesa-dev mailing list