public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: David Faust <dfaust@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r14-1504] btf: fix bootstrap -Wformat errors [PR110073]
Date: Fri,  2 Jun 2023 16:33:34 +0000 (GMT)	[thread overview]
Message-ID: <20230602163334.B62BC3856604@sourceware.org> (raw)

https://gcc.gnu.org/g:934da923a7295ae97e37425e269195c7d8770ef0

commit r14-1504-g934da923a7295ae97e37425e269195c7d8770ef0
Author: David Faust <david.faust@oracle.com>
Date:   Fri Jun 2 09:28:32 2023 -0700

    btf: fix bootstrap -Wformat errors [PR110073]
    
    Commit 7aae58b04b9 "btf: improve -dA comments for testsuite" broke
    bootstrap on a number of architectures because it introduced some
    new -Wformat errors.
    
    Fix those errors by properly using PRIu64 and a small refactor to
    the offending code.
    
    Based on the suggested patch from Rainer Orth.
    
            PR debug/110073
    
    gcc/ChangeLog:
    
            * btfout.cc (btf_absolute_func_id): New function.
            (btf_asm_func_type): Call it here.  Change index parameter from
            size_t to ctf_id_t.  Use PRIu64 formatter.

Diff:
---
 gcc/btfout.cc | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/gcc/btfout.cc b/gcc/btfout.cc
index 1ea68b9e8ba..e07fed302c2 100644
--- a/gcc/btfout.cc
+++ b/gcc/btfout.cc
@@ -192,6 +192,14 @@ btf_relative_var_id (ctf_id_t abs)
   return abs - (num_types_added + 1);
 }
 
+/* Return the final BTF ID of the func record at relative index REL.  */
+
+static ctf_id_t
+btf_absolute_func_id (ctf_id_t rel)
+{
+  return rel + (num_types_added + 1) + num_vars_added;
+}
+
 /* Return the relative index of the func record with final BTF ID ABS.  */
 
 static ctf_id_t
@@ -937,13 +945,12 @@ btf_asm_func_arg (ctf_container_ref ctfc, ctf_func_arg_t * farg,
 /* Asm'out a BTF_KIND_FUNC type.  */
 
 static void
-btf_asm_func_type (ctf_container_ref ctfc, ctf_dtdef_ref dtd, size_t i)
+btf_asm_func_type (ctf_container_ref ctfc, ctf_dtdef_ref dtd, ctf_id_t id)
 {
   ctf_id_t ref_id = dtd->dtd_data.ctti_type;
   dw2_asm_output_data (4, dtd->dtd_data.ctti_name,
-		       "TYPE %lu BTF_KIND_FUNC '%s'",
-		       num_types_added + num_vars_added + 1 + i,
-		       dtd->dtd_name);
+		       "TYPE %" PRIu64 " BTF_KIND_FUNC '%s'",
+		       btf_absolute_func_id (id), dtd->dtd_name);
   dw2_asm_output_data (4, BTF_TYPE_INFO (BTF_KIND_FUNC, 0, dtd->linkage),
 		       "btt_info: kind=%u, kflag=%u, linkage=%u",
 		       BTF_KIND_FUNC, 0, dtd->linkage);

                 reply	other threads:[~2023-06-02 16:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20230602163334.B62BC3856604@sourceware.org \
    --to=dfaust@gcc.gnu.org \
    --cc=gcc-cvs@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).