diff mbox series

[RFC,v2,60/78] qga: add fallthrough pseudo-keyword

Message ID 4af9c55f0b548bd4df233dc3aeb2bd34efb8929f.1697183699.git.manos.pitsidianakis@linaro.org (mailing list archive)
State New, archived
Headers show
Series Strict disable implicit fallthrough | expand

Commit Message

Manos Pitsidianakis Oct. 13, 2023, 7:57 a.m. UTC
In preparation of raising -Wimplicit-fallthrough to 5, replace all
fall-through comments with the fallthrough attribute pseudo-keyword.

Signed-off-by: Emmanouil Pitsidianakis <manos.pitsidianakis@linaro.org>
---
 qga/main.c                  | 2 +-
 qga/vss-win32/requester.cpp | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/qga/main.c b/qga/main.c
index 8668b9f3d3..40471e8a0b 100644
--- a/qga/main.c
+++ b/qga/main.c
@@ -644,37 +644,37 @@  end:
 /* false return signals GAChannel to close the current client connection */
 static gboolean channel_event_cb(GIOCondition condition, gpointer data)
 {
     GAState *s = data;
     gchar buf[QGA_READ_COUNT_DEFAULT + 1];
     gsize count;
     GIOStatus status = ga_channel_read(s->channel, buf, QGA_READ_COUNT_DEFAULT, &count);
     switch (status) {
     case G_IO_STATUS_ERROR:
         g_warning("error reading channel");
         stop_agent(s, false);
         return false;
     case G_IO_STATUS_NORMAL:
         buf[count] = 0;
         g_debug("read data, count: %d, data: %s", (int)count, buf);
         json_message_parser_feed(&s->parser, (char *)buf, (int)count);
         break;
     case G_IO_STATUS_EOF:
         g_debug("received EOF");
         if (!s->virtio) {
             return false;
         }
-        /* fall through */
+        fallthrough;
     case G_IO_STATUS_AGAIN:
         /* virtio causes us to spin here when no process is attached to
          * host-side chardev. sleep a bit to mitigate this
          */
         if (s->virtio) {
             g_usleep(G_USEC_PER_SEC / 10);
         }
         return true;
     default:
         g_warning("unknown channel read status, closing");
         return false;
     }
     return true;
 }
diff --git a/qga/vss-win32/requester.cpp b/qga/vss-win32/requester.cpp
index 9884c65e70..36fa4fdf28 100644
--- a/qga/vss-win32/requester.cpp
+++ b/qga/vss-win32/requester.cpp
@@ -563,72 +563,73 @@  out1:
 void requester_thaw(int *num_vols, void *mountpints, ErrorSet *errset)
 {
     qga_debug_begin;
     COMPointer<IVssAsync> pAsync;
 
     if (!vss_ctx.hEventThaw) {
         /*
          * In this case, DoSnapshotSet is aborted or not started,
          * and no volumes must be frozen. We return without an error.
          */
         *num_vols = 0;
         qga_debug("finished, no volumes were frozen");
 
         return;
     }
 
     /* Tell the provider that the snapshot is finished. */
     SetEvent(vss_ctx.hEventThaw);
 
     assert(vss_ctx.pVssbc);
     assert(vss_ctx.pAsyncSnapshot);
 
     HRESULT hr = WaitForAsync(vss_ctx.pAsyncSnapshot);
     switch (hr) {
     case VSS_S_ASYNC_FINISHED:
         hr = vss_ctx.pVssbc->BackupComplete(pAsync.replace());
         if (SUCCEEDED(hr)) {
             hr = WaitForAsync(pAsync);
         }
         if (FAILED(hr)) {
             err_set(errset, hr, "failed to complete backup");
         }
         break;
 
     case (HRESULT)VSS_E_OBJECT_NOT_FOUND:
         /*
          * On Windows earlier than 2008 SP2 which does not support
          * VSS_VOLSNAP_ATTR_NO_AUTORECOVERY context, the final commit is not
          * skipped and VSS is aborted by VSS_E_OBJECT_NOT_FOUND. However, as
          * the system had been frozen until fsfreeze-thaw command was issued,
          * we ignore this error.
          */
         vss_ctx.pVssbc->AbortBackup();
         break;
 
     case VSS_E_UNEXPECTED_PROVIDER_ERROR:
         if (WaitForSingleObject(vss_ctx.hEventTimeout, 0) != WAIT_OBJECT_0) {
             err_set(errset, hr, "unexpected error in VSS provider");
             break;
         }
         /* fall through if hEventTimeout is signaled */
+        fallthrough;
 
     case (HRESULT)VSS_E_HOLD_WRITES_TIMEOUT:
         err_set(errset, hr, "couldn't hold writes: "
                 "fsfreeze is limited up to 10 seconds");
         break;
 
     default:
         err_set(errset, hr, "failed to do snapshot set");
     }
 
     if (err_is_set(errset)) {
         vss_ctx.pVssbc->AbortBackup();
     }
     *num_vols = vss_ctx.cFrozenVols;
     requester_cleanup();
 
     CoUninitialize();
     StopService();
 
     qga_debug_end;
 }