broadcom/compiler: prevent FALLTHROUGH error with C23

When building for the C23 standard, the compiler gives the following
error:

-----------------------------------------------------------------------
../src/broadcom/compiler/vir_register_allocate.c
../src/broadcom/compiler/vir_register_allocate.c: In function ‘update_graph_and_reg_classes_for_inst’:
../src/broadcom/compiler/vir_register_allocate.c:1225:44: error: expected statement before ‘;’ token
 1225 |                                 FALLTHROUGH;
      |                                            ^
../src/broadcom/compiler/vir_register_allocate.c:1225:44: warning: ‘fallthrough’ attribute ignored [-Wattributes]
../src/broadcom/compiler/vir_register_allocate.c:1225:44: error: suggest braces around empty body in an ‘else’ statement [-Werror=empty-body]
../src/broadcom/compiler/vir_register_allocate.c:1222:28: warning: this statement may fall through [-Wimplicit-fallthrough=]
 1222 |                         if (c->devinfo->ver >= 71)
      |                            ^
../src/broadcom/compiler/vir_register_allocate.c:1226:17: note: here
 1226 |                 case 1:
      |                 ^~~~
-----------------------------------------------------------------------

Fix that by doing what the compiler suggests, i.e. by using braces
around empty body in the ‘else’ statement.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36323>
This commit is contained in:
Antonio Ospite 2025-07-24 13:47:10 +02:00 committed by Marge Bot
parent 9c96f4f13f
commit 1b55314615

View file

@ -1219,10 +1219,11 @@ update_graph_and_reg_classes_for_inst(struct v3d_compile *c,
switch (inst->src[0].index) {
case 0:
/* V3D 7.x doesn't use rf0 for thread payload */
if (c->devinfo->ver >= 71)
if (c->devinfo->ver >= 71) {
break;
else
} else {
FALLTHROUGH;
}
case 1:
case 2:
case 3: {