public inbox for gcc-rust@gcc.gnu.org
 help / color / mirror / Atom feed
From: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
To: Arthur Cohen <arthur.cohen@embecosm.com>
Cc: gcc-patches@gcc.gnu.org,  gcc-rust@gcc.gnu.org
Subject: Re: [COMMITTED] rust_debug: Cast size_t values to unsigned long before printing.
Date: Thu, 18 Jan 2024 10:13:35 +0100	[thread overview]
Message-ID: <yddy1cn3sxs.fsf@CeBiTec.Uni-Bielefeld.DE> (raw)
In-Reply-To: <20240118090056.2910410-2-arthur.cohen@embecosm.com> (Arthur Cohen's message of "Thu, 18 Jan 2024 10:00:47 +0100")

Arthur Cohen <arthur.cohen@embecosm.com> writes:

> Using %lu to format size_t values breaks 32 bit targets, and %zu is not
> supported by one of the hosts GCC aims to support - HPUX

But we do have uses of %zu in gcc/rust already!

> diff --git a/gcc/rust/expand/rust-proc-macro.cc b/gcc/rust/expand/rust-proc-macro.cc
> index e8618485b71..09680733e98 100644
> --- a/gcc/rust/expand/rust-proc-macro.cc
> +++ b/gcc/rust/expand/rust-proc-macro.cc
> @@ -171,7 +171,7 @@ load_macros (std::string path)
>    if (array == nullptr)
>      return {};
>  
> -  rust_debug ("Found %lu procedural macros", array->length);
> +  rust_debug ("Found %lu procedural macros", (unsigned long) array->length);

Not the best way either: array->length is std::uint64_t, so the format
should use

... %" PRIu64 " procedural...

instead.

I've attached my patch to PR rust/113461.

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

  reply	other threads:[~2024-01-18  9:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-18  9:00 Arthur Cohen
2024-01-18  9:13 ` Rainer Orth [this message]
2024-01-18 10:30   ` Arthur Cohen
2024-01-18  9:34     ` Rainer Orth
2024-01-18 20:19       ` Arthur Cohen
2024-01-18 11:02     ` Iain Sandoe
2024-01-18 20:21       ` Arthur Cohen

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=yddy1cn3sxs.fsf@CeBiTec.Uni-Bielefeld.DE \
    --to=ro@cebitec.uni-bielefeld.de \
    --cc=arthur.cohen@embecosm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gcc-rust@gcc.gnu.org \
    /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).