From: Christoph Muellner <christoph.muellner@vrull.eu>
To: binutils@sourceware.org, Nelson Chu <nelson@rivosinc.com>,
Andrew Waterman <andrew@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Jim Wilson <jim.wilson.gcc@gmail.com>,
Philipp Tomsich <philipp.tomsich@vrull.eu>,
Jan Beulich <jbeulich@suse.com>
Cc: "Christoph Müllner" <christoph.muellner@vrull.eu>
Subject: [PATCH] RISC-V: Eliminate long-casts of X_add_number in diagnostics
Date: Fri, 30 Sep 2022 12:39:19 +0200 [thread overview]
Message-ID: <20220930103919.323690-1-christoph.muellner@vrull.eu> (raw)
From: Christoph Müllner <christoph.muellner@vrull.eu>
As reported in (and in addition to)
https://sourceware.org/pipermail/binutils/2022-September/123198.html
there is no need for casts to (signed/unsigned) long, as we can use
C99's PRIs64/PRIu64 format specifiers.
Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
---
gas/config/tc-riscv.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c
index b107420756b..035d8c55628 100644
--- a/gas/config/tc-riscv.c
+++ b/gas/config/tc-riscv.c
@@ -2921,8 +2921,8 @@ riscv_ip (char *str, struct riscv_cl_insn *ip, expressionS *imm_expr,
my_getExpression (imm_expr, asarg);
check_absolute_expr (ip, imm_expr, false);
if ((unsigned long) imm_expr->X_add_number > 31)
- as_bad (_("improper shift amount (%lu)"),
- (unsigned long) imm_expr->X_add_number);
+ as_bad (_("improper shift amount (%"PRIu64")"),
+ imm_expr->X_add_number);
INSERT_OPERAND (SHAMTW, *ip, imm_expr->X_add_number);
imm_expr->X_op = O_absent;
asarg = expr_end;
@@ -2932,8 +2932,8 @@ riscv_ip (char *str, struct riscv_cl_insn *ip, expressionS *imm_expr,
my_getExpression (imm_expr, asarg);
check_absolute_expr (ip, imm_expr, false);
if ((unsigned long) imm_expr->X_add_number >= xlen)
- as_bad (_("improper shift amount (%lu)"),
- (unsigned long) imm_expr->X_add_number);
+ as_bad (_("improper shift amount (%"PRIu64")"),
+ imm_expr->X_add_number);
INSERT_OPERAND (SHAMT, *ip, imm_expr->X_add_number);
imm_expr->X_op = O_absent;
asarg = expr_end;
@@ -2943,8 +2943,8 @@ riscv_ip (char *str, struct riscv_cl_insn *ip, expressionS *imm_expr,
my_getExpression (imm_expr, asarg);
check_absolute_expr (ip, imm_expr, false);
if ((unsigned long) imm_expr->X_add_number > 31)
- as_bad (_("improper CSRxI immediate (%lu)"),
- (unsigned long) imm_expr->X_add_number);
+ as_bad (_("improper CSRxI immediate (%"PRIu64")"),
+ imm_expr->X_add_number);
INSERT_OPERAND (RS1, *ip, imm_expr->X_add_number);
imm_expr->X_op = O_absent;
asarg = expr_end;
@@ -2960,8 +2960,8 @@ riscv_ip (char *str, struct riscv_cl_insn *ip, expressionS *imm_expr,
my_getExpression (imm_expr, asarg);
check_absolute_expr (ip, imm_expr, true);
if ((unsigned long) imm_expr->X_add_number > 0xfff)
- as_bad (_("improper CSR address (%lu)"),
- (unsigned long) imm_expr->X_add_number);
+ as_bad (_("improper CSR address (%"PRIu64")"),
+ imm_expr->X_add_number);
INSERT_OPERAND (CSR, *ip, imm_expr->X_add_number);
imm_expr->X_op = O_absent;
asarg = expr_end;
--
2.37.2
next reply other threads:[~2022-09-30 10:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-30 10:39 Christoph Muellner [this message]
2022-09-30 10:46 ` Jan Beulich
2022-09-30 14:45 ` Nelson Chu
2022-09-30 14:55 ` Philipp Tomsich
2022-09-30 19:26 ` Jeff Law
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220930103919.323690-1-christoph.muellner@vrull.eu \
--to=christoph.muellner@vrull.eu \
--cc=andrew@sifive.com \
--cc=binutils@sourceware.org \
--cc=jbeulich@suse.com \
--cc=jim.wilson.gcc@gmail.com \
--cc=nelson@rivosinc.com \
--cc=palmer@dabbelt.com \
--cc=philipp.tomsich@vrull.eu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).