From a67850df01f04267bd618eac260890da0ef02032 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Thu, 14 Apr 2022 20:54:13 +0200 Subject: [PATCH] tree: Add fall through annotations Gcc can warn on implicit fallthoughs. Mark them with a comment which is recognized by gcc. --- mx_util.c | 18 +++++++++--------- mxqsub.c | 2 ++ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/mx_util.c b/mx_util.c index 66a51f28..6d72f4a0 100644 --- a/mx_util.c +++ b/mx_util.c @@ -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; @@ -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; diff --git a/mxqsub.c b/mxqsub.c index af901d67..52e941dd 100644 --- a/mxqsub.c +++ b/mxqsub.c @@ -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); @@ -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;