sim: ppc: fix some Wenum-compare warnings
authorTom de Vries <tdevries@suse.de>
Wed, 19 May 2021 17:08:53 +0000 (19:08 +0200)
committerTom de Vries <tdevries@suse.de>
Wed, 19 May 2021 17:08:53 +0000 (19:08 +0200)
When compiling with --enable-werror and CFLAGS="-O0 -g -Wall", we run into:
...
src/sim/ppc/hw_phb.c: In function 'hw_phb_attach_address':
src/sim/ppc/hw_phb.c:315:12: error: comparison between \
  'attach_type {aka enum _attach_type}' and \
  'enum <anonymous>' [-Werror=enum-compare]
   if (type != hw_phb_normal_decode
            ^~
...

Fix this by casting type to hw_phb_decode.

sim/ppc/hw_phb.c

index 70d59d3084494cf0d3649ec7d358f486e78eba52..a3c19264235114e517505a991ef91427e32366df 100644 (file)
@@ -312,8 +312,8 @@ 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 (type != hw_phb_normal_decode
-      && type != hw_phb_subtractive_decode)
+  if ((hw_phb_decode)type != hw_phb_normal_decode
+      && (hw_phb_decode)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 */