[Mesa-dev] [PATCH 01/12] i965: Silence "enumeral and non-enumeral type in conditional expression" warnings

Ian Romanick idr at freedesktop.org
Tue Nov 21 01:23:59 UTC 2017


From: Ian Romanick <ian.d.romanick at intel.com>

compiler/brw_inst.h: In function ‘brw_reg_type brw_inst_dst_type(const gen_device_info*, const brw_inst*)’:
compiler/brw_inst.h:801:55: warning: enumeral and non-enumeral type in conditional expression [-Wextra]
    unsigned file = __builtin_strcmp("dst", #reg) == 0 ?                       \
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
                    BRW_GENERAL_REGISTER_FILE :                                \
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                    brw_inst_##reg##_reg_file(devinfo, inst);                  \
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compiler/brw_inst.h:808:1: note: in expansion of macro ‘REG_TYPE’
 REG_TYPE(dst)
 ^~~~~~~~

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/intel/compiler/brw_inst.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/intel/compiler/brw_inst.h b/src/intel/compiler/brw_inst.h
index 99e637e..dcd955d 100644
--- a/src/intel/compiler/brw_inst.h
+++ b/src/intel/compiler/brw_inst.h
@@ -799,7 +799,7 @@ brw_inst_##reg##_type(const struct gen_device_info *devinfo,                  \
                       const brw_inst *inst)                                   \
 {                                                                             \
    unsigned file = __builtin_strcmp("dst", #reg) == 0 ?                       \
-                   BRW_GENERAL_REGISTER_FILE :                                \
+                   (unsigned) BRW_GENERAL_REGISTER_FILE :                     \
                    brw_inst_##reg##_reg_file(devinfo, inst);                  \
    unsigned hw_type = brw_inst_##reg##_reg_hw_type(devinfo, inst);            \
    return brw_hw_type_to_reg_type(devinfo, (enum brw_reg_file)file, hw_type); \
-- 
2.9.5



More information about the mesa-dev mailing list