[Mesa-dev] [PATCH] intel/compiler: fix 64bit value prints on 32bit

Grazvydas Ignotas notasas at gmail.com
Sat Feb 3 22:19:50 UTC 2018


Fix the following:
warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but
argument 3 has type ‘uint64_t {aka long long unsigned int}.
---
 src/intel/compiler/brw_disasm.c                 | 4 ++--
 src/intel/compiler/brw_nir_analyze_ubo_ranges.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/intel/compiler/brw_disasm.c b/src/intel/compiler/brw_disasm.c
index 1a94ed3..429ed78 100644
--- a/src/intel/compiler/brw_disasm.c
+++ b/src/intel/compiler/brw_disasm.c
@@ -1247,14 +1247,14 @@ static int
 imm(FILE *file, const struct gen_device_info *devinfo, enum brw_reg_type type,
     const brw_inst *inst)
 {
    switch (type) {
    case BRW_REGISTER_TYPE_UQ:
-      format(file, "0x%016lxUQ", brw_inst_imm_uq(devinfo, inst));
+      format(file, "0x%016"PRIx64"UQ", brw_inst_imm_uq(devinfo, inst));
       break;
    case BRW_REGISTER_TYPE_Q:
-      format(file, "%ldQ", brw_inst_imm_uq(devinfo, inst));
+      format(file, "%"PRId64"Q", brw_inst_imm_uq(devinfo, inst));
       break;
    case BRW_REGISTER_TYPE_UD:
       format(file, "0x%08xUD", brw_inst_imm_ud(devinfo, inst));
       break;
    case BRW_REGISTER_TYPE_D:
diff --git a/src/intel/compiler/brw_nir_analyze_ubo_ranges.c b/src/intel/compiler/brw_nir_analyze_ubo_ranges.c
index 32fbf8f..d58fe3d 100644
--- a/src/intel/compiler/brw_nir_analyze_ubo_ranges.c
+++ b/src/intel/compiler/brw_nir_analyze_ubo_ranges.c
@@ -156,11 +156,11 @@ print_ubo_entry(FILE *file,
                 struct ubo_analysis_state *state)
 {
    struct ubo_block_info *info = get_block_info(state, entry->range.block);
 
    fprintf(file,
-           "block %2d, start %2d, length %2d, bits = %zx, "
+           "block %2d, start %2d, length %2d, bits = %"PRIx64", "
            "benefit %2d, cost %2d, score = %2d\n",
            entry->range.block, entry->range.start, entry->range.length,
            info->offsets, entry->benefit, entry->range.length, score(entry));
 }
 
-- 
2.7.4



More information about the mesa-dev mailing list