public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/2] sim: ppc: drop unnecessary config includes
@ 2021-09-09  1:08 Mike Frysinger
  2021-09-09  1:08 ` [PATCH 2/2] sim: ppc: align format string settings with common code Mike Frysinger
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Frysinger @ 2021-09-09  1:08 UTC (permalink / raw)
  To: gdb-patches

This file is compiled for the --host & --build system which leads to
including the configure generated config.h in both environments.
This obviously doesn't work when the two targets don't look alike at
all and can cause build failures here (e.g. a mingw host & a linux
build).  Since we don't actually need any config settings in this
very simple file, drop the includes entirely.
---
 sim/ppc/filter_filename.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/sim/ppc/filter_filename.c b/sim/ppc/filter_filename.c
index b59ca21ca559..fb2457c0b2c2 100644
--- a/sim/ppc/filter_filename.c
+++ b/sim/ppc/filter_filename.c
@@ -17,10 +17,6 @@
  
     */
 
-/* This must come before any other includes.  */
-#include "defs.h"
-
-#include "ppc-config.h"
 #include "filter_filename.h"
 
 /* Shorten traces by eliminating the directory component to filenames.  */
-- 
2.33.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 2/2] sim: ppc: align format string settings with common code
  2021-09-09  1:08 [PATCH 1/2] sim: ppc: drop unnecessary config includes Mike Frysinger
@ 2021-09-09  1:08 ` Mike Frysinger
  0 siblings, 0 replies; 2+ messages in thread
From: Mike Frysinger @ 2021-09-09  1:08 UTC (permalink / raw)
  To: gdb-patches

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-09  1:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-09  1:08 [PATCH 1/2] sim: ppc: drop unnecessary config includes Mike Frysinger
2021-09-09  1:08 ` [PATCH 2/2] sim: ppc: align format string settings with common code Mike Frysinger

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).