On 02.04.2024 09:22, Federico Serafini wrote: > MISRA C:2012 Rule 16.3 states: "An unconditional `break' statement > shall terminate every switch-clause". > > Add break statement to address violations of the rule or add > pseudo-keyword fallthrough to meet the requirements to deviate it.
While the latter half of the sentence properly describes the latter two of the hunks, the former half doesn't match the former two hunks at all: > --- a/xen/common/vsprintf.c > +++ b/xen/common/vsprintf.c > @@ -377,7 +377,7 @@ static char *pointer(char *str, const char *end, const > char **fmt_ptr, > str = number(str, end, hex_buffer[i], 16, 2, -1, ZEROPAD); > > if ( ++i == field_width ) > - return str; > + break; This "break" is inside for(), not switch(). > @@ -386,6 +386,8 @@ static char *pointer(char *str, const char *end, const > char **fmt_ptr, > ++str; > } > } > + > + return str; > } And this "return" is what now "delimits" case 'h' of the switch(). The original situation therefore was that the for() could not be exited by other than the "return" inside. The supposedly missing "break" in that arrangement would have been "unreachable code", i.e. violate another rule. Hence the (undescribed) further re-arrangement. Jan