public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] RISC-V: Eliminate long-casts of X_add_number in diagnostics
@ 2022-09-30 10:39 Christoph Muellner
  2022-09-30 10:46 ` Jan Beulich
  2022-09-30 19:26 ` Jeff Law
  0 siblings, 2 replies; 5+ messages in thread
From: Christoph Muellner @ 2022-09-30 10:39 UTC (permalink / raw)
  To: binutils, Nelson Chu, Andrew Waterman, Palmer Dabbelt,
	Jim Wilson, Philipp Tomsich, Jan Beulich
  Cc: Christoph Müllner

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] RISC-V: Eliminate long-casts of X_add_number in diagnostics
  2022-09-30 10:39 [PATCH] RISC-V: Eliminate long-casts of X_add_number in diagnostics Christoph Muellner
@ 2022-09-30 10:46 ` Jan Beulich
  2022-09-30 14:45   ` Nelson Chu
  2022-09-30 19:26 ` Jeff Law
  1 sibling, 1 reply; 5+ messages in thread
From: Jan Beulich @ 2022-09-30 10:46 UTC (permalink / raw)
  To: Christoph Muellner
  Cc: binutils, Nelson Chu, Andrew Waterman, Palmer Dabbelt,
	Jim Wilson, Philipp Tomsich

On 30.09.2022 12:39, Christoph Muellner wrote:
> 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.

For archaeologists you may want to s/PRIs64/PRId64/, such that no-one
will be misguided. Otherwise thanks for taking care of the other items
this quickly. I'll leave approving of this (as well as my earlier
patch) to the arch maintainers, though.

Jan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] RISC-V: Eliminate long-casts of X_add_number in diagnostics
  2022-09-30 10:46 ` Jan Beulich
@ 2022-09-30 14:45   ` Nelson Chu
  2022-09-30 14:55     ` Philipp Tomsich
  0 siblings, 1 reply; 5+ messages in thread
From: Nelson Chu @ 2022-09-30 14:45 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Christoph Muellner, binutils, Andrew Waterman, Palmer Dabbelt,
	Jim Wilson, Philipp Tomsich

Both approved, please commit.  Thanks for helping to fix them.

Nelson

On Fri, Sep 30, 2022 at 6:46 PM Jan Beulich <jbeulich@suse.com> wrote:
>
> On 30.09.2022 12:39, Christoph Muellner wrote:
> > 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.
>
> For archaeologists you may want to s/PRIs64/PRId64/, such that no-one
> will be misguided. Otherwise thanks for taking care of the other items
> this quickly. I'll leave approving of this (as well as my earlier
> patch) to the arch maintainers, though.
>
> Jan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] RISC-V: Eliminate long-casts of X_add_number in diagnostics
  2022-09-30 14:45   ` Nelson Chu
@ 2022-09-30 14:55     ` Philipp Tomsich
  0 siblings, 0 replies; 5+ messages in thread
From: Philipp Tomsich @ 2022-09-30 14:55 UTC (permalink / raw)
  To: Nelson Chu
  Cc: Jan Beulich, Christoph Muellner, binutils, Andrew Waterman,
	Palmer Dabbelt, Jim Wilson

Thanks! Applied to master.

Philipp.


On Fri, 30 Sept 2022 at 16:46, Nelson Chu <nelson@rivosinc.com> wrote:
>
> Both approved, please commit.  Thanks for helping to fix them.
>
> Nelson
>
> On Fri, Sep 30, 2022 at 6:46 PM Jan Beulich <jbeulich@suse.com> wrote:
> >
> > On 30.09.2022 12:39, Christoph Muellner wrote:
> > > 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.
> >
> > For archaeologists you may want to s/PRIs64/PRId64/, such that no-one
> > will be misguided. Otherwise thanks for taking care of the other items
> > this quickly. I'll leave approving of this (as well as my earlier
> > patch) to the arch maintainers, though.
> >
> > Jan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] RISC-V: Eliminate long-casts of X_add_number in diagnostics
  2022-09-30 10:39 [PATCH] RISC-V: Eliminate long-casts of X_add_number in diagnostics Christoph Muellner
  2022-09-30 10:46 ` Jan Beulich
@ 2022-09-30 19:26 ` Jeff Law
  1 sibling, 0 replies; 5+ messages in thread
From: Jeff Law @ 2022-09-30 19:26 UTC (permalink / raw)
  To: binutils


On 9/30/22 04:39, Christoph Muellner wrote:
> 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>

OK.


jeff



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-09-30 19:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-30 10:39 [PATCH] RISC-V: Eliminate long-casts of X_add_number in diagnostics Christoph Muellner
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

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).