[virt-tools-list] [virt-viewer v1] Fix implicit fallthrough warning on new gcc

Eduardo Lima (Etrunko) etrunko at redhat.com
Tue Apr 18 14:25:20 UTC 2017


On 18/04/17 10:39, Victor Toso wrote:
> From: Victor Toso <me at victortoso.com>
> 
> The option -Wimplicit-fallthrough was added to -Wall recently which
> generates a few warnings. Based on the comment above the switch, the
> fallthrough is on purpose so let's add a comment to avoid the following
> warnings.

Meh, it seems that babysitting compilers are the rule nowadays. :/

Acked-by: Eduardo Lima (Etrunko) <etrunko at redhat.com>

> 
> ovirt-foreign-menu.c: In function 'ovirt_foreign_menu_next_async_step':
> ovirt-foreign-menu.c:293:12: warning: this statement may fall through
>          if (menu->priv->api == NULL) {
>             ^
>  ovirt-foreign-menu.c:297:5: note: here
>       case STATE_VM:
>            ^~~~
> ovirt-foreign-menu.c:298:12: warning: this statement may fall through
>          if (menu->priv->vm == NULL) {
>             ^
> ovirt-foreign-menu.c:302:5: note: here
>      case STATE_STORAGE_DOMAIN:
>           ^~~~
> ovirt-foreign-menu.c:303:12: warning: this statement may fall through
>          if (menu->priv->files == NULL) {
>             ^
> ovirt-foreign-menu.c:307:5: note: here
>      case STATE_VM_CDROM:
>           ^~~~
> 
> ovirt-foreign-menu.c:308:12: warning: this statement may fall through
>          if (menu->priv->cdrom == NULL) {
>             ^
> ovirt-foreign-menu.c:312:5: note: here
>    case STATE_CDROM_FILE:
>         ^~~~
> 
> Signed-off-by: Victor Toso <victortoso at redhat.com>
> ---
>  src/ovirt-foreign-menu.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/src/ovirt-foreign-menu.c b/src/ovirt-foreign-menu.c
> index 2939ae5..fdfd327 100644
> --- a/src/ovirt-foreign-menu.c
> +++ b/src/ovirt-foreign-menu.c
> @@ -294,21 +294,25 @@ ovirt_foreign_menu_next_async_step(OvirtForeignMenu *menu,
>              ovirt_foreign_menu_fetch_api_async(menu, task);
>              break;
>          }
> +        /* fall through */
>      case STATE_VM:
>          if (menu->priv->vm == NULL) {
>              ovirt_foreign_menu_fetch_vm_async(menu, task);
>              break;
>          }
> +        /* fall through */
>      case STATE_STORAGE_DOMAIN:
>          if (menu->priv->files == NULL) {
>              ovirt_foreign_menu_fetch_storage_domain_async(menu, task);
>              break;
>          }
> +        /* fall through */
>      case STATE_VM_CDROM:
>          if (menu->priv->cdrom == NULL) {
>              ovirt_foreign_menu_fetch_vm_cdrom_async(menu, task);
>              break;
>          }
> +        /* fall through */
>      case STATE_CDROM_FILE:
>          ovirt_foreign_menu_refresh_cdrom_file_async(menu, task);
>          break;
> 


-- 
Eduardo de Barros Lima (Etrunko)
Software Engineer - RedHat
etrunko at redhat.com




More information about the virt-tools-list mailing list