Skip to content

Commit

Permalink
tree: Add fall through annotations
Browse files Browse the repository at this point in the history
Gcc can warn on implicit fallthoughs. Mark them with a comment which is
recognized by gcc.
  • Loading branch information
donald committed May 5, 2022
1 parent 8318176 commit a67850d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
18 changes: 9 additions & 9 deletions mx_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,17 @@ int mx_strtobytes(char *str, unsigned long long int *bytes)

case 'T': /* tebi */
t *= 1024;

// fall through
case 'G': /* gibi */
t *= 1024;

// fall through
case 'M': /* mebi */
t *= 1024;

// fall through
case 'k': /* kibi */
case 'K':
t *= 1024;

// fall through
case 'B': /* bytes */
end++;
break;
Expand Down Expand Up @@ -180,19 +180,19 @@ int mx_strtoseconds(char *str, unsigned long long int *seconds)

case 'y': /* years */
t *= 52;

// fall through
case 'w': /* weeks */
t *= 7;

// fall through
case 'd': /* days */
t *= 24;

// fall through
case 'h': /* hours */
t *= 60;

// fall through
case 'm': /* minutes */
t *= 60;

// fall through
case 's': /* seconds */
end++;
break;
Expand Down
2 changes: 2 additions & 0 deletions mxqsub.c
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,7 @@ int main(int argc, char *argv[])

case 2:
mx_log_warning("option --group_priority is deprecated. please use --group-priority instead.");
// fall through
case 'P':
if (mx_strtou16(optctl.optarg, &arg_group_priority) < 0) {
mx_log_crit("--group-priority '%s': %m", optctl.optarg);
Expand Down Expand Up @@ -931,6 +932,7 @@ int main(int argc, char *argv[])

case 4:
mx_log_warning("option '--time' is deprecated. please use '--runtime' or '-t' in future calls.");
// fall through
case 't':
if (mx_strtou32(optctl.optarg, &arg_time) < 0) {
unsigned long long int minutes;
Expand Down

0 comments on commit a67850d

Please sign in to comment.