Skip to content

gsk: Remove unnecessary G_GNUC_FALLTHROUGH

Alessandro Bono requested to merge abono/gtk:wip/abono/fallthrough into main

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.
Edited by Alessandro Bono

Merge request reports