From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 189EE3851165 for ; Wed, 12 Oct 2022 13:50:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 189EE3851165 Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-605-ykUcehWwPA2p2t2_A2F8Nw-1; Wed, 12 Oct 2022 09:50:47 -0400 X-MC-Unique: ykUcehWwPA2p2t2_A2F8Nw-1 Received: by mail-wr1-f69.google.com with SMTP id p7-20020adfba87000000b0022cc6f805b1so5050849wrg.21 for ; Wed, 12 Oct 2022 06:50:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=qGmEybYZndX4aQvFqx93rr/KPypCwDYpmYZExvL66Gc=; b=7rlnoRlspoBQuddhI88L345m7KflC51A35EEsAbAr7TCb+6PkgFoCz5deAbq1BB0m0 xP7WJS5wCcWL4PFF85Ba+ke/s4T3InXxj7DFpte70pXBuLxA+4gqYfHsURFiBqvYJu7R WrULgL4RLRdZHrC9Gd9G2yrURL/LiVgJbuxQeTb6HSeT4Av97Np8F4BFnVumrCZ1/2KY D6PVlMCa0ce9jHRdt8WEgqXtcdb88ivbJWbzolIXRyL5uJnE5wL3hR9xtSq6XoETsf2Z A2H5UFmusZOs/915TTEsDt3PfUMQoNkLDCtZxnP/UatK6kK98G2O+KyjQBgyTDsKa+A3 ZqqQ== X-Gm-Message-State: ACrzQf1cbFOcTVdRzn39/mLPMo2z7+AFht6eJJ0Tc9NS6sZVreDcPhYH WGsGmKRabbAAsUorUR4gXWk2rY/aYZZkpAJH+Fs/UwUaSZvDGRuThkbNgwr3uxpr4IC9TWm8ITS frCEsX+2KHFZWezodwmJnyg== X-Received: by 2002:a5d:4b8b:0:b0:22e:4185:bcc7 with SMTP id b11-20020a5d4b8b000000b0022e4185bcc7mr19036029wrt.174.1665582645856; Wed, 12 Oct 2022 06:50:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Dg7qBJFRUjpKqil/hH3cC2U8wVrXxdrzYm/epRaZPITp/VNWEIp9DboY8SL8Uu9ALWDYAmQ== X-Received: by 2002:a5d:4b8b:0:b0:22e:4185:bcc7 with SMTP id b11-20020a5d4b8b000000b0022e4185bcc7mr19036013wrt.174.1665582645551; Wed, 12 Oct 2022 06:50:45 -0700 (PDT) Received: from localhost (52.72.115.87.dyn.plus.net. [87.115.72.52]) by smtp.gmail.com with ESMTPSA id f7-20020a05600c154700b003a3442f1229sm2005739wmg.29.2022.10.12.06.50.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Oct 2022 06:50:45 -0700 (PDT) From: Andrew Burgess To: Tsukasa OI , gdb-patches@sourceware.org Subject: Re: [PATCH 2/5] sim/ppc: fix warnings related to printf format strings In-Reply-To: <37cd07d6-5e79-b718-f8ac-7282c0ba931c@irq.a4lg.com> References: <97bcb87aa4ece94b30b62ec5d1845909dbb933a1.1665578246.git.aburgess@redhat.com> <37cd07d6-5e79-b718-f8ac-7282c0ba931c@irq.a4lg.com> Date: Wed, 12 Oct 2022 14:50:44 +0100 Message-ID: <87o7uhb16z.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-10.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Oct 2022 13:50:51 -0000 Tsukasa OI writes: > On 2022/10/12 21:38, Andrew Burgess via Gdb-patches wrote: >> This commit is a follow on to: >> >> commit 182421c9d2eea8c4877d983a2124e591f0aca710 >> Date: Tue Oct 11 15:02:08 2022 +0100 >> >> sim/ppc: fixes for arguments to printf style functions >> >> where commit 182421c9d2ee addressed issues with printf format >> arguments that were causing the compiler to give an error, this commit >> addresses issues that caused the compiler to emit a warning. >> >> This commit is mostly either changing the format string to match the >> argument, or in some cases, excess, unused arguments are removed. >> --- >> sim/ppc/igen.c | 2 +- >> sim/ppc/ld-cache.c | 4 ++-- >> sim/ppc/ld-decode.c | 2 +- >> sim/ppc/ld-insn.c | 41 +++++++++++++++-------------------------- >> 4 files changed, 19 insertions(+), 30 deletions(-) >> >> diff --git a/sim/ppc/igen.c b/sim/ppc/igen.c >> index 6a6dbc30f31..27b48638276 100644 >> --- a/sim/ppc/igen.c >> +++ b/sim/ppc/igen.c >> @@ -442,7 +442,7 @@ main(int argc, >> code |= generate_with_icache; >> break; >> default: >> - error (NULL, "Expecting -Ggen-icache or -Ggen-icache=\n"); >> + error ("Expecting -Ggen-icache or -Ggen-icache=\n"); >> } >> } >> } >> diff --git a/sim/ppc/ld-cache.c b/sim/ppc/ld-cache.c >> index f57f7db650a..b30b1f4d898 100644 >> --- a/sim/ppc/ld-cache.c >> +++ b/sim/ppc/ld-cache.c >> @@ -88,13 +88,13 @@ static void >> dump_cache_rule(cache_table* rule, >> int indent) >> { >> - dumpf(indent, "((cache_table*)0x%x\n", rule); >> + dumpf(indent, "((cache_table*)0x%p\n", rule); > > Replacing "0x%p" with "%p" is recommended (as I submitted earlier). Thanks. I've made this change locally for now. I'll wait to see if there's any more feedback over the next couple of days. Thanks, Andrew > > Thanks, > Tsukasa > >> dumpf(indent, " (type %s)\n", i2name(rule->type, cache_type_map)); >> dumpf(indent, " (field_name \"%s\")\n", rule->field_name); >> dumpf(indent, " (derived_name \"%s\")\n", rule->derived_name); >> dumpf(indent, " (type-def \"%s\")\n", rule->type_def); >> dumpf(indent, " (expression \"%s\")\n", rule->expression); >> - dumpf(indent, " (next 0x%x)\n", rule->next); >> + dumpf(indent, " (next 0x%p)\n", rule->next); >> dumpf(indent, " )\n"); >> } >> >> diff --git a/sim/ppc/ld-decode.c b/sim/ppc/ld-decode.c >> index 68d9f5f4f52..83ff1216b30 100644 >> --- a/sim/ppc/ld-decode.c >> +++ b/sim/ppc/ld-decode.c >> @@ -120,7 +120,7 @@ dump_decode_rule(decode_table *rule, >> dumpf(indent, " (special_mask 0x%x)\n", rule->special_mask); >> dumpf(indent, " (special_value 0x%x)\n", rule->special_value); >> dumpf(indent, " (special_constant 0x%x)\n", rule->special_constant); >> - dumpf(indent, " (next 0x%x)\n", rule->next); >> + dumpf(indent, " (next 0x%p)\n", rule->next); >> } >> dumpf(indent, " )\n"); >> } >> diff --git a/sim/ppc/ld-insn.c b/sim/ppc/ld-insn.c >> index 3910af3fdf6..c89c81c1073 100644 >> --- a/sim/ppc/ld-insn.c >> +++ b/sim/ppc/ld-insn.c >> @@ -827,29 +827,18 @@ static void >> dump_insn_field(insn_field *field, >> int indent) >> { >> - >> - printf("(insn_field*)0x%lx\n", (unsigned long)field); >> - >> - dumpf(indent, "(first %d)\n", field->first); >> - >> - dumpf(indent, "(last %d)\n", field->last); >> - >> - dumpf(indent, "(width %d)\n", field->width); >> - >> + printf ("(insn_field*)0x%p\n", field); >> + dumpf (indent, "(first %d)\n", field->first); >> + dumpf (indent, "(last %d)\n", field->last); >> + dumpf (indent, "(width %d)\n", field->width); >> if (field->is_int) >> - dumpf(indent, "(is_int %d)\n", field->val_int); >> - >> + dumpf (indent, "(is_int %d)\n", field->val_int); >> if (field->is_slash) >> - dumpf(indent, "(is_slash)\n"); >> - >> + dumpf (indent, "(is_slash)\n"); >> if (field->is_string) >> - dumpf(indent, "(is_string `%s')\n", field->val_string); >> - >> - dumpf(indent, "(next 0x%x)\n", field->next); >> - >> - dumpf(indent, "(prev 0x%x)\n", field->prev); >> - >> - >> + dumpf (indent, "(is_string `%s')\n", field->val_string); >> + dumpf (indent, "(next 0x%p)\n", field->next); >> + dumpf (indent, "(prev 0x%p)\n", field->prev); >> } >> >> static void >> @@ -860,13 +849,13 @@ dump_insn_fields(insn_fields *fields, >> >> printf("(insn_fields*)%p\n", fields); >> >> - dumpf(indent, "(first 0x%x)\n", fields->first); >> - dumpf(indent, "(last 0x%x)\n", fields->last); >> + dumpf(indent, "(first 0x%p)\n", fields->first); >> + dumpf(indent, "(last 0x%p)\n", fields->last); >> >> dumpf(indent, "(value 0x%x)\n", fields->value); >> >> for (i = 0; i < insn_bit_size; i++) { >> - dumpf(indent, "(bits[%d] ", i, fields->bits[i]); >> + dumpf(indent, "(bits[%d]", i); >> dump_insn_field(fields->bits[i], indent+1); >> dumpf(indent, " )\n"); >> } >> @@ -961,16 +950,16 @@ dump_insn_table(insn_table *table, >> dump_opcode_field(table->opcode, indent+1, 1); >> dumpf(indent, " )\n"); >> >> - dumpf(indent, "(nr_entries %d)\n", table->entries); >> + dumpf(indent, "(nr_entries %d)\n", table->nr_entries); >> dumpf(indent, "(entries "); >> dump_insn_table(table->entries, indent+1, table->nr_entries); >> dumpf(indent, " )\n"); >> >> - dumpf(indent, "(sibling ", table->sibling); >> + dumpf(indent, "(sibling "); >> dump_insn_table(table->sibling, indent+1, levels-1); >> dumpf(indent, " )\n"); >> >> - dumpf(indent, "(parent ", table->parent); >> + dumpf(indent, "(parent "); >> dump_insn_table(table->parent, indent+1, 0); >> dumpf(indent, " )\n"); >>