intel/compiler: Explicitly cast register type in switch
authorIan Romanick <ian.d.romanick@intel.com>
Thu, 29 Mar 2018 18:29:09 +0000 (11:29 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Fri, 6 Apr 2018 22:22:10 +0000 (15:22 -0700)
brw_reg::type is "enum brw_reg_type type:4".  For whatever reason, GCC
is treating this as an int instead of an enum.  As a result, it doesn't
detect missing switch cases and it doesn't detect that flow can get out
of the switch.

This silences the warning:

src/intel/compiler/brw_reg.h: In function ‘bool brw_regs_negative_equal(const brw_reg*, const brw_reg*)’:
src/intel/compiler/brw_reg.h:305:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
src/intel/compiler/brw_reg.h

index afcd146de2c007a1338d05d3fda3c9da3d4062e8..dff9b970b2fd781514dbb839499fe0c966c3a879 100644 (file)
@@ -262,7 +262,7 @@ brw_regs_negative_equal(const struct brw_reg *a, const struct brw_reg *b)
       if (a->bits != b->bits)
          return false;
 
-      switch (a->type) {
+      switch ((enum brw_reg_type) a->type) {
       case BRW_REGISTER_TYPE_UQ:
       case BRW_REGISTER_TYPE_Q:
          return a->d64 == -b->d64;