Re: [PATCH] Fix build with GCC 8 new warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2018-02-13 at 12:21 +0000, Daniel P. Berrangé wrote:
> @@ -175,9 +175,9 @@ qemuDomainAsyncJobPhaseToString(qemuDomainAsyncJob job,
>      case QEMU_ASYNC_JOB_NONE:
>      case QEMU_ASYNC_JOB_LAST:
>          ATTRIBUTE_FALLTHROUGH;
> +    default:
> +        return "none";
>      }
> -
> -    return "none";
>  }

Can't we just replace ATTRIBUTE_FALLTHROUGH with a break? Or even
just duplicate the return statement, without adding the default
label, if that doesn't help? Same for the next hunk.

> @@ -532,6 +532,7 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev,
>              case VIR_DOMAIN_CONTROLLER_MODEL_USB_QUSB2: /* xen only */
>              case VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE:
>              case VIR_DOMAIN_CONTROLLER_MODEL_USB_LAST:
> +            default:
>                  return 0;
>              }

Adding the default label here and in the following hunks will
forfeit the advantage of having the compiler catch for us cases
where we introduced a new model but didn't update all the code
that needs to deal with it accordingly. IMHO that should only be
considered as a very last resort if we can't possibly otherwise
restructure the code in a way that makes the compiler happy.

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux