From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id AF3F63857817 for ; Thu, 9 Sep 2021 01:08:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AF3F63857817 From: Mike Frysinger To: gdb-patches@sourceware.org Subject: [PATCH 2/2] sim: ppc: align format string settings with common code Date: Wed, 8 Sep 2021 21:08:31 -0400 Message-Id: <20210909010831.13078-2-vapier@gentoo.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210909010831.13078-1-vapier@gentoo.org> References: <20210909010831.13078-1-vapier@gentoo.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Thu, 09 Sep 2021 01:08:50 -0000 This copies logic used in the common sim warning configure code to fix build errors for mingw targets. Turning format warnings on triggers a failure in the debug.c file, so apply a minor fix at the same time. --- sim/ppc/configure | 6 ++++++ sim/ppc/configure.ac | 6 ++++++ sim/ppc/debug.c | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/sim/ppc/configure b/sim/ppc/configure index 0bab1af81398..2cb7ccdb86a7 100755 --- a/sim/ppc/configure +++ b/sim/ppc/configure @@ -3489,6 +3489,12 @@ sim_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith -Wno-pointer-sign -Wold-style-declaration -Wold-style-definition " +# Enable -Wno-format by default when using gcc on mingw since many +# GCC versions complain about %I64. +case "${host}" in + *-*-mingw32*) sim_warnings="$sim_warnings -Wno-format" ;; + *) sim_warnings="$sim_warnings -Wformat-nonliteral" ;; +esac # Check whether --enable-sim-warnings was given. if test "${enable_sim_warnings+set}" = set; then : enableval=$enable_sim_warnings; case "${enableval}" in diff --git a/sim/ppc/configure.ac b/sim/ppc/configure.ac index 42ccda3811a5..0fa7f4ee221b 100644 --- a/sim/ppc/configure.ac +++ b/sim/ppc/configure.ac @@ -430,6 +430,12 @@ sim_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith -Wno-pointer-sign -Wold-style-declaration -Wold-style-definition " +# Enable -Wno-format by default when using gcc on mingw since many +# GCC versions complain about %I64. +case "${host}" in + *-*-mingw32*) sim_warnings="$sim_warnings -Wno-format" ;; + *) sim_warnings="$sim_warnings -Wformat-nonliteral" ;; +esac AC_ARG_ENABLE(sim-warnings, [ --enable-sim-warnings=opts Extra CFLAGS for turning on compiler warnings except for idecode.o, semantics.o and psim.o], [case "${enableval}" in diff --git a/sim/ppc/debug.c b/sim/ppc/debug.c index 53a392a303ef..a9b48c3e4cca 100644 --- a/sim/ppc/debug.c +++ b/sim/ppc/debug.c @@ -140,7 +140,7 @@ trace_usage(int verbose) printf_filtered("\n"); } if (verbose > 1) { - const char *format = "\t%-18s%s\n"; + static const char format[] = "\t%-18s%s\n"; int i; printf_filtered(format, "all", "enable all the trace options"); for (i = 0; trace_description[i].option < nr_trace_options; i++) -- 2.33.0