]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
rust_debug: Cast size_t values to unsigned long before printing.
authorArthur Cohen <arthur.cohen@embecosm.com>
Wed, 17 Jan 2024 13:15:27 +0000 (14:15 +0100)
committerArthur Cohen <arthur.cohen@embecosm.com>
Thu, 18 Jan 2024 08:54:31 +0000 (09:54 +0100)
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
gcc/rust/expand/rust-proc-macro.cc
gcc/rust/typecheck/rust-hir-type-check-expr.cc

index b4a3685ad93c26779f0640d9888d0a75a71cdba8..ae9f6707b727db26d4b877cd1774d505ea267f85 100644 (file)
@@ -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;
index e8618485b71dabe27858b7cfa3f9bbcfca3e6447..09680733e988fa4c9cc30634502b8c15bfc4fb1a 100644 (file)
@@ -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);
index 9dbf657958d30613946761b854871e6351a3d5e5..030e5f1b63ce2d645764ceec9a4e1aa09d8f2202 100644 (file)
@@ -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);