From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7905) id A87613858CD1; Thu, 18 Jan 2024 08:58:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A87613858CD1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1705568326; bh=fcXdgYdeptl3TahHaQTJWUztu/25eLW2JiqnxfNI3jM=; h=From:To:Subject:Date:From; b=OpYsRHRxnd2q5qWBI40OkupiQx9g0xe4JzbwUePL9KGkoB7zrBMXFaqy+HwkTobMs o1p64f+YNDhT8/RtdkHlzOT07keYTGkEr6pTiBPAxGW4Um0yTCfAduT9whMS61OQLW 1AyFXNHN3l7yodg0PrPiPL9UJmlWMxMRN6PPMilQ= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Arthur Cohen To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-8211] rust_debug: Cast size_t values to unsigned long before printing. X-Act-Checkin: gcc X-Git-Author: Arthur Cohen X-Git-Refname: refs/heads/trunk X-Git-Oldrev: 484f48f03cf9a382b3bcf4dadac09c4ee59c2ddf X-Git-Newrev: 2341df1cb9b3681bfefe29207887b2b3dc271a95 Message-Id: <20240118085846.A87613858CD1@sourceware.org> Date: Thu, 18 Jan 2024 08:58:46 +0000 (GMT) List-Id: https://gcc.gnu.org/g:2341df1cb9b3681bfefe29207887b2b3dc271a95 commit r14-8211-g2341df1cb9b3681bfefe29207887b2b3dc271a95 Author: Arthur Cohen Date: Wed Jan 17 14:15:27 2024 +0100 rust_debug: Cast size_t values to unsigned long before printing. 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. Diff: --- 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 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 (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);