refactor: warn against implicit fallthrough
Enable the `-Wimplicit-fallthrough` warning, which will warn if `case`
statements in a `switch` block fall through to the next `case`.
Intentional fallthrough can be signalled with the `[[fallthrough]]`
attribute which was added in C23.
Change-Id: I421cacadafba6457847c3a067483c97fdd9896cf
Signed-off-by: Karl Meakin <karl.meakin@arm.com>
diff --git a/src/ffa_memory.c b/src/ffa_memory.c
index 53fe449..d376ddb 100644
--- a/src/ffa_memory.c
+++ b/src/ffa_memory.c
@@ -1129,6 +1129,7 @@
* unprotecting memory that it had protected before.
*/
CHECK(arch_memory_unprotect(pa_begin, pa_end));
+ [[fallthrough]];
case MAP_ACTION_COMMIT:
vm_identity_commit(vm_locked, pa_begin, pa_end, mode, ppool,
NULL);
@@ -2726,7 +2727,7 @@
}
break;
}
- /* Intentional fall-through. */
+ [[fallthrough]];
case FFA_DATA_ACCESS_RO:
if (requested_data_access == FFA_DATA_ACCESS_NOT_SPECIFIED ||
requested_data_access == FFA_DATA_ACCESS_RO) {
@@ -2782,7 +2783,7 @@
}
break;
}
- /* Fall through if the operation targets a single borrower. */
+ [[fallthrough]];
case FFA_MEM_DONATE_64:
case FFA_MEM_DONATE_32:
if (!multiple_borrowers &&
@@ -2814,6 +2815,7 @@
* Fall through if requested permissions are less
* permissive than those provided by the sender.
*/
+ [[fallthrough]];
case FFA_INSTRUCTION_ACCESS_NX:
if (requested_instruction_access ==
FFA_INSTRUCTION_ACCESS_NOT_SPECIFIED ||