public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Arthur Cohen <arthur.cohen@embecosm.com>
To: gcc-patches@gcc.gnu.org
Cc: gcc-rust@gcc.gnu.org, Arthur Cohen <arthur.cohen@embecosm.com>
Subject: [COMMITTED] rust_debug: Cast size_t values to unsigned long before printing.
Date: Thu, 18 Jan 2024 10:00:47 +0100	[thread overview]
Message-ID: <20240118090056.2910410-2-arthur.cohen@embecosm.com> (raw)

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

gcc/rust/ChangeLog:

	* backend/rust-compile-base.cc (HIRCompileBase::resolve_method_address):
	Cast size_t value to unsigned long.
	* expand/rust-proc-macro.cc (load_macros): Likewise.
	* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Likewise.
---
 gcc/rust/backend/rust-compile-base.cc          | 3 ++-
 gcc/rust/expand/rust-proc-macro.cc             | 2 +-
 gcc/rust/typecheck/rust-hir-type-check-expr.cc | 4 ++--
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/gcc/rust/backend/rust-compile-base.cc b/gcc/rust/backend/rust-compile-base.cc
index b4a3685ad93..ae9f6707b72 100644
--- a/gcc/rust/backend/rust-compile-base.cc
+++ b/gcc/rust/backend/rust-compile-base.cc
@@ -965,7 +965,8 @@ HIRCompileBase::resolve_method_address (TyTy::FnType *fntype,
     }
 
   const Resolver::PathProbeCandidate *selectedCandidate = nullptr;
-  rust_debug_loc (expr_locus, "resolved to %lu candidates", candidates.size ());
+  rust_debug_loc (expr_locus, "resolved to %lu candidates",
+		  (unsigned long) candidates.size ());
 
   // filter for the possible case of non fn type items
   std::set<Resolver::PathProbeCandidate> filteredFunctionCandidates;
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);
 
   return std::vector<ProcMacro::Procmacro> (array->macros,
 					    array->macros + array->length);
diff --git a/gcc/rust/typecheck/rust-hir-type-check-expr.cc b/gcc/rust/typecheck/rust-hir-type-check-expr.cc
index 9dbf657958d..030e5f1b63c 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-expr.cc
+++ b/gcc/rust/typecheck/rust-hir-type-check-expr.cc
@@ -1122,10 +1122,10 @@ TypeCheckExpr::visit (HIR::MethodCallExpr &expr)
 
   auto candidate = *candidates.begin ();
   rust_debug_loc (expr.get_method_name ().get_locus (),
-		  "resolved method to: {%u} {%s} with [%zu] adjustments",
+		  "resolved method to: {%u} {%s} with [%lu] adjustments",
 		  candidate.candidate.ty->get_ref (),
 		  candidate.candidate.ty->debug_str ().c_str (),
-		  candidate.adjustments.size ());
+		  (unsigned long) candidate.adjustments.size ());
 
   // Get the adjusted self
   Adjuster adj (receiver_tyty);
-- 
2.42.1


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

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-18  9:00 Arthur Cohen [this message]
2024-01-18  9:13 ` Rainer Orth
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=20240118090056.2910410-2-arthur.cohen@embecosm.com \
    --to=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).