public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/3 committed] sim: ppc: cleanup getrusage decls
@ 2023-12-05  4:46 Mike Frysinger
  2023-12-05  4:46 ` [PATCH 2/3 committed] sim: ppc: fix -Wmisleading-indentation warnings Mike Frysinger
  2023-12-05  4:46 ` [PATCH 3/3 committed] sim: ppc: fix implicit enum conversion Mike Frysinger
  0 siblings, 2 replies; 3+ messages in thread
From: Mike Frysinger @ 2023-12-05  4:46 UTC (permalink / raw)
  To: gdb-patches

Don't conflate HAVE_GETRUSAGE & HAVE_SYS_RESOURCE_H.  Use the latter
to include the header and nothing else.  Use the former to determine
whether to use the function and nothing else.  If we find a system
that doesn't follow POSIX and provides only one of these, we can
figure out how to support it then.  The manual local definition is
clashing with the system ones and leading to build failures with
newer C standards.

sim/ppc/emul_netbsd.c:51:5: error: a function declaration without a
	prototype is deprecated in all versions of C and is treated as a
	zero-parameter prototype in C2x, conflicting with a previous
	declaration [-Werror,-Wdeprecated-non-prototype]
---
 sim/ppc/emul_netbsd.c | 9 +--------
 sim/ppc/emul_unix.c   | 9 +--------
 sim/ppc/mon.c         | 1 -
 3 files changed, 2 insertions(+), 17 deletions(-)

diff --git a/sim/ppc/emul_netbsd.c b/sim/ppc/emul_netbsd.c
index 51f8e98ae32b..950f1f4a696a 100644
--- a/sim/ppc/emul_netbsd.c
+++ b/sim/ppc/emul_netbsd.c
@@ -40,15 +40,8 @@
 #include "emul_generic.h"
 #include "emul_netbsd.h"
 
-#ifdef HAVE_GETRUSAGE
-#ifndef HAVE_SYS_RESOURCE_H
-#undef HAVE_GETRUSAGE
-#endif
-#endif
-
-#ifdef HAVE_GETRUSAGE
+#ifdef HAVE_SYS_RESOURCE_H
 #include <sys/resource.h>
-int getrusage();
 #endif
 
 #if HAVE_SYS_IOCTL_H
diff --git a/sim/ppc/emul_unix.c b/sim/ppc/emul_unix.c
index be9e8385f526..88f6e3abc0a2 100644
--- a/sim/ppc/emul_unix.c
+++ b/sim/ppc/emul_unix.c
@@ -87,15 +87,8 @@
 #include <sys/termio.h>
 #endif
 
-#ifdef HAVE_GETRUSAGE
-#ifndef HAVE_SYS_RESOURCE_H
-#undef HAVE_GETRUSAGE
-#endif
-#endif
-
-#ifdef HAVE_GETRUSAGE
+#ifdef HAVE_SYS_RESOURCE_H
 #include <sys/resource.h>
-int getrusage();
 #endif
 
 #if HAVE_DIRENT_H
diff --git a/sim/ppc/mon.c b/sim/ppc/mon.c
index 8ab42af84589..8bbabe6e50d4 100644
--- a/sim/ppc/mon.c
+++ b/sim/ppc/mon.c
@@ -36,7 +36,6 @@
 
 #ifdef HAVE_SYS_RESOURCE_H
 #include <sys/resource.h>
-int getrusage();
 #endif
 
 #include "basics.h"
-- 
2.43.0


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

* [PATCH 2/3 committed] sim: ppc: fix -Wmisleading-indentation warnings
  2023-12-05  4:46 [PATCH 1/3 committed] sim: ppc: cleanup getrusage decls Mike Frysinger
@ 2023-12-05  4:46 ` Mike Frysinger
  2023-12-05  4:46 ` [PATCH 3/3 committed] sim: ppc: fix implicit enum conversion Mike Frysinger
  1 sibling, 0 replies; 3+ messages in thread
From: Mike Frysinger @ 2023-12-05  4:46 UTC (permalink / raw)
  To: gdb-patches

Fix building with -Wmisleading-indentation.
---
 sim/ppc/igen.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sim/ppc/igen.c b/sim/ppc/igen.c
index 445afb9ee00d..8aa19c757f59 100644
--- a/sim/ppc/igen.c
+++ b/sim/ppc/igen.c
@@ -233,7 +233,7 @@ gen_semantics_c(insn_table *table,
     lf_printf(file, "  option_mpc860c0 = 0;\n");
     lf_printf(file, "  if (tree_find_property(root, \"/options/mpc860c0\"))\n");
     lf_printf(file, "    option_mpc860c0 = tree_find_integer_property(root, \"/options/mpc860c0\");\n");
-    lf_printf(file, "    option_mpc860c0 *= 4;   /* convert word count to byte count */\n");
+    lf_printf(file, "  option_mpc860c0 *= 4;   /* convert word count to byte count */\n");
     lf_printf(file, "}\n");
     lf_printf(file, "\n");
     if (generate_expanded_instructions)
-- 
2.43.0


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

* [PATCH 3/3 committed] sim: ppc: fix implicit enum conversion
  2023-12-05  4:46 [PATCH 1/3 committed] sim: ppc: cleanup getrusage decls Mike Frysinger
  2023-12-05  4:46 ` [PATCH 2/3 committed] sim: ppc: fix -Wmisleading-indentation warnings Mike Frysinger
@ 2023-12-05  4:46 ` Mike Frysinger
  1 sibling, 0 replies; 3+ messages in thread
From: Mike Frysinger @ 2023-12-05  4:46 UTC (permalink / raw)
  To: gdb-patches

This code tries to use attach_type enums as hw_phb_decode, and while
they're setup to have compatible values, the compiler doesn't like it
when the cast is missing.  So cast it explicitly and then use that.

sim/ppc/hw_phb.c:322:28: error:
	implicit conversion from enumeration type 'attach_type'
	(aka 'enum _attach_type') to different enumeration type
	'hw_phb_decode' [-Werror,-Wenum-conversion]
---
 sim/ppc/hw_phb.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sim/ppc/hw_phb.c b/sim/ppc/hw_phb.c
index a3c192642351..ec1119ee7d9b 100644
--- a/sim/ppc/hw_phb.c
+++ b/sim/ppc/hw_phb.c
@@ -303,6 +303,7 @@ hw_phb_attach_address(device *me,
 {
   hw_phb_device *phb = device_data(me);
   phb_space *pci_space;
+  hw_phb_decode phb_type = (hw_phb_decode)type;
   /* sanity checks */
   if (space < 0 || space >= nr_hw_phb_spaces)
     device_error(me, "attach space (%d) specified by %s invalid",
@@ -312,14 +313,13 @@ hw_phb_attach_address(device *me,
       || addr < pci_space->my_base)
     device_error(me, "attach addr (0x%lx) specified by %s outside of bus address range",
 		 (unsigned long)addr, device_path(client));
-  if ((hw_phb_decode)type != hw_phb_normal_decode
-      && (hw_phb_decode)type != hw_phb_subtractive_decode)
+  if (phb_type != hw_phb_normal_decode && phb_type != hw_phb_subtractive_decode)
     device_error(me, "attach type (%d) specified by %s invalid",
 		 type, device_path(client));
   /* attach it to the relevent bus */
   DTRACE(phb, ("attach %s - %s %s:0x%lx (0x%lx bytes)\n",
 	       device_path(client),
-	       hw_phb_decode_name(type),
+	       hw_phb_decode_name(phb_type),
 	       pci_space->name,
 	       (unsigned long)addr,
 	       (unsigned long)nr_bytes));
-- 
2.43.0


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

end of thread, other threads:[~2023-12-05  4:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-05  4:46 [PATCH 1/3 committed] sim: ppc: cleanup getrusage decls Mike Frysinger
2023-12-05  4:46 ` [PATCH 2/3 committed] sim: ppc: fix -Wmisleading-indentation warnings Mike Frysinger
2023-12-05  4:46 ` [PATCH 3/3 committed] sim: ppc: fix implicit enum conversion 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).