Skip to contentSkip to conversation

system/vl: Tidy up break in QEMU_OPTION_machine case

PATCH In review Philippe Mathieu-Daudé 3 participants 4 messages Mar 23, 2025 – Mar 24, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 system/vl: Tidy up break in QEMU_OPTION_machine case

The break in the QEMU_OPTION_machine case is mis-placed.

Not a big deal, since producing the same outcome, but suspicious, so put it in the correct place.

---
 system/vl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
system/vl.c +1 -1
index ec93988a03a..dbca9ebba4d 100644
@@ -3409,8 +3409,8 @@ void qemu_init(int argc, char **argv)
                         machine_help_func(machine_opts_dict);
                         exit(EXIT_SUCCESS);
                     }
-                    break;
                 }
+                break;
             case QEMU_OPTION_accel:
                 accel_opts = qemu_opts_parse_noisily(qemu_find_opts("accel"),
                                                      optarg, true);
Signature · 1 line
2.47.1
#1 lore raw
Quoted 4 lines · Philippe Mathieu-Daudé

The break in the QEMU_OPTION_machine case is mis-placed.

Not a big deal, since producing the same outcome, but suspicious, so put it in the correct place.

Why is it misplaced? It's at the end of the block. This swich has other cases that put break outside or inside the block randomly so there's no agreement on that. Changing this one place does not make it consistent. IMO inside the block looks better but I'd align the {} with the case and not indent them but this probably does not worth the effort to clean it.

Regards,
BALATON Zoltan

Quoted 20 lines

---
system/vl.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
system/vl.c +1 -1
index ec93988a03a..dbca9ebba4d 100644
@@ -3409,8 +3409,8 @@ void qemu_init(int argc, char **argv)
                        machine_help_func(machine_opts_dict);
                        exit(EXIT_SUCCESS);
                    }
-                    break;
                }
+                break;
            case QEMU_OPTION_accel:
                accel_opts = qemu_opts_parse_noisily(qemu_find_opts("accel"),
                                                     optarg, true);
#2 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 1 line · Philippe Mathieu-Daudé

The break in the QEMU_OPTION_machine case is mis-placed.

I think that's largely a bikeshed colouring question. If you look at other places in the outer switch using a block in the case, eg

   case FOO:
      {
         .....
      }

or

   case FOO: {
         .....
   }

they'll also have 'break' inside the '{}', so either this patch should change all, or change none.

Quoted 27 lines

Not a big deal, since producing the same outcome, but suspicious, so put it in the correct place.

---
 system/vl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
system/vl.c +1 -1
index ec93988a03a..dbca9ebba4d 100644
@@ -3409,8 +3409,8 @@ void qemu_init(int argc, char **argv)
                         machine_help_func(machine_opts_dict);
                         exit(EXIT_SUCCESS);
                     }
-                    break;
                 }
+                break;
             case QEMU_OPTION_accel:
                 accel_opts = qemu_opts_parse_noisily(qemu_find_opts("accel"),
                                                      optarg, true);
Signature · 1 line
2.47.1

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#3 lore raw
Quoted 12 lines · Daniel P. Berrangé
Quoted 1 line · Philippe Mathieu-Daudé

The break in the QEMU_OPTION_machine case is mis-placed.

I think that's largely a bikeshed colouring question. If you look at other places in the outer switch using a block in the case, eg

    case FOO:
       {
          .....
       }
Quoted 8 lines

or

    case FOO: {
          .....
    }

they'll also have 'break' inside the '{}', so either this patch should change all, or change none.

OK, none then! Thanks :)

Quoted 9 lines
Quoted 9 lines

Not a big deal, since producing the same outcome, but suspicious, so put it in the correct place.

---
  system/vl.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)