From ca9ba3cc8097615bfca78483c9dfe2c3edec8ed8 Mon Sep 17 00:00:00 2001 From: Alessandro Bono Date: Tue, 13 Feb 2024 16:59:53 +0100 Subject: [PATCH] gsk: Remove unnecessary G_GNUC_FALLTHROUGH In GSK the following pattern is used four times: ``` switch (self->filter) { default: g_assert_not_reached (); G_GNUC_FALLTHROUGH; case GSK_GPU_BLIT_LINEAR: filter = GL_LINEAR; break; case GSK_GPU_BLIT_NEAREST: filter = GL_NEAREST; break; } ``` The G_GNUC_FALLTHROUGH macro is not required. When G_DISABLE_ASSERT is defined the body of the `default` case is empty, thus there is no need. When G_DISABLE_ASSERT is not defined the body of the `default` case contains g_assert_not_reached() thus it won't fallthrough. This resolves the following: ``` [221/1379] Compiling C object gsk/libgsk.a.p/gpu_gskgpublitop.c.o [...] error: fallthrough annotation in unreachable code [-Werror,-Wimplicit-fallthrough] 1 error generated. ``` --- gsk/gpu/gskgpublitop.c | 2 -- gsk/gpu/gskgpunodeprocessor.c | 1 - gsk/gpu/gskgpurenderpassop.c | 1 - 3 files changed, 4 deletions(-) diff --git a/gsk/gpu/gskgpublitop.c b/gsk/gpu/gskgpublitop.c index b2baf07422..f45f7c3a98 100644 --- a/gsk/gpu/gskgpublitop.c +++ b/gsk/gpu/gskgpublitop.c @@ -85,7 +85,6 @@ gsk_gpu_blit_op_vk_command (GskGpuOp *op, { default: g_assert_not_reached (); - G_GNUC_FALLTHROUGH; case GSK_GPU_BLIT_LINEAR: filter = VK_FILTER_LINEAR; break; @@ -160,7 +159,6 @@ gsk_gpu_blit_op_gl_command (GskGpuOp *op, { default: g_assert_not_reached (); - G_GNUC_FALLTHROUGH; case GSK_GPU_BLIT_LINEAR: filter = GL_LINEAR; break; diff --git a/gsk/gpu/gskgpunodeprocessor.c b/gsk/gpu/gskgpunodeprocessor.c index ac2ab41c89..70af8a2d20 100644 --- a/gsk/gpu/gskgpunodeprocessor.c +++ b/gsk/gpu/gskgpunodeprocessor.c @@ -563,7 +563,6 @@ extract_scale_from_transform (GskTransform *transform, { default: g_assert_not_reached (); - G_GNUC_FALLTHROUGH; case GSK_TRANSFORM_CATEGORY_IDENTITY: case GSK_TRANSFORM_CATEGORY_2D_TRANSLATE: *out_scale_x = 1.0f; diff --git a/gsk/gpu/gskgpurenderpassop.c b/gsk/gpu/gskgpurenderpassop.c index 4ed10584d2..c9f7ee2615 100644 --- a/gsk/gpu/gskgpurenderpassop.c +++ b/gsk/gpu/gskgpurenderpassop.c @@ -54,7 +54,6 @@ gsk_gpu_render_pass_type_to_vk_image_layout (GskRenderPassType type) { default: g_assert_not_reached (); - G_GNUC_FALLTHROUGH; case GSK_RENDER_PASS_PRESENT: return VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; case GSK_RENDER_PASS_OFFSCREEN: