[PATCH v1 04/48] x86/insn: Silence -Wshorten-64-to-32 warnings
From: Ian Rogers
Date: Tue Apr 01 2025 - 14:25:39 EST
The clang warning -Wshorten-64-to-32 can be useful to catch
inadvertent truncation. In some instances this truncation can lead to
changing the sign of a result, for example, truncation to return an
int to fit a sort routine. Silence the warning by making the implicit
truncation explicit.
Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
---
tools/arch/x86/lib/insn.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/arch/x86/lib/insn.c b/tools/arch/x86/lib/insn.c
index e91d4c4e1c16..5fa8697498fe 100644
--- a/tools/arch/x86/lib/insn.c
+++ b/tools/arch/x86/lib/insn.c
@@ -92,7 +92,7 @@ static int __insn_get_emulate_prefix(struct insn *insn,
goto err_out;
}
- insn->emulate_prefix_size = len;
+ insn->emulate_prefix_size = (int)len;
insn->next_byte += len;
return 1;
--
2.49.0.504.g3bcea36a83-goog