public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: gdb-patches@sourceware.org
Subject: [PATCH 3/3 committed] sim: ppc: fix implicit enum conversion
Date: Mon,  4 Dec 2023 23:46:16 -0500	[thread overview]
Message-ID: <20231205044616.4000-3-vapier@gentoo.org> (raw)
In-Reply-To: <20231205044616.4000-1-vapier@gentoo.org>

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


      parent reply	other threads:[~2023-12-05  4:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

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=20231205044616.4000-3-vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --cc=gdb-patches@sourceware.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).