Document switch fall-through cases
authorJens Axboe <axboe@kernel.dk>
Mon, 11 Feb 2019 18:20:29 +0000 (11:20 -0700)
committerJens Axboe <axboe@kernel.dk>
Mon, 11 Feb 2019 18:20:29 +0000 (11:20 -0700)
Signed-off-by: Jens Axboe <axboe@kernel.dk>
crc/murmur3.c
engines/http.c
hash.h
init.c
lib/lfsr.c
t/lfsr-test.c

index e316f592ceb7fad41f3a0f43d0aa4e0347190d53..f4f2f2c648d24e51fa9eed9febda91142c28300f 100644 (file)
@@ -29,8 +29,10 @@ static uint32_t murmur3_tail(const uint8_t *data, const int nblocks,
        switch (len & 3) {
        case 3:
                k1 ^= tail[2] << 16;
        switch (len & 3) {
        case 3:
                k1 ^= tail[2] << 16;
+               /* fall through */
        case 2:
                k1 ^= tail[1] << 8;
        case 2:
                k1 ^= tail[1] << 8;
+               /* fall through */
        case 1:
                k1 ^= tail[0];
                k1 *= c1;
        case 1:
                k1 ^= tail[0];
                k1 *= c1;
index d81e4288ff7bfdec000781240cea3aafa687ca88..a35c03327ec1f2751711ab73f64a5b42113e65e4 100644 (file)
@@ -296,9 +296,11 @@ static int _curl_trace(CURL *handle, curl_infotype type,
 
        switch (type) {
        case CURLINFO_TEXT:
 
        switch (type) {
        case CURLINFO_TEXT:
-       fprintf(stderr, "== Info: %s", data);
+               fprintf(stderr, "== Info: %s", data);
+               /* fall through */
        default:
        case CURLINFO_SSL_DATA_OUT:
        default:
        case CURLINFO_SSL_DATA_OUT:
+               /* fall through */
        case CURLINFO_SSL_DATA_IN:
                return 0;
 
        case CURLINFO_SSL_DATA_IN:
                return 0;
 
diff --git a/hash.h b/hash.h
index d227b938a246881229ab5d5e304427da8f03cff3..66dd3d6916ea5b1386948c2d2a661d8bce59abf9 100644 (file)
--- a/hash.h
+++ b/hash.h
@@ -141,17 +141,17 @@ static inline uint32_t jhash(const void *key, uint32_t length, uint32_t initval)
        /* Last block: affect all 32 bits of (c) */
        /* All the case statements fall through */
        switch (length) {
        /* Last block: affect all 32 bits of (c) */
        /* All the case statements fall through */
        switch (length) {
-       case 12: c += (uint32_t) k[11] << 24;
-       case 11: c += (uint32_t) k[10] << 16;
-       case 10: c += (uint32_t) k[9] << 8;
-       case 9:  c += k[8];
-       case 8:  b += (uint32_t) k[7] << 24;
-       case 7:  b += (uint32_t) k[6] << 16;
-       case 6:  b += (uint32_t) k[5] << 8;
-       case 5:  b += k[4];
-       case 4:  a += (uint32_t) k[3] << 24;
-       case 3:  a += (uint32_t) k[2] << 16;
-       case 2:  a += (uint32_t) k[1] << 8;
+       case 12: c += (uint32_t) k[11] << 24;   /* fall through */
+       case 11: c += (uint32_t) k[10] << 16;   /* fall through */
+       case 10: c += (uint32_t) k[9] << 8;     /* fall through */
+       case 9:  c += k[8];                     /* fall through */
+       case 8:  b += (uint32_t) k[7] << 24;    /* fall through */
+       case 7:  b += (uint32_t) k[6] << 16;    /* fall through */
+       case 6:  b += (uint32_t) k[5] << 8;     /* fall through */
+       case 5:  b += k[4];                     /* fall through */
+       case 4:  a += (uint32_t) k[3] << 24;    /* fall through */
+       case 3:  a += (uint32_t) k[2] << 16;    /* fall through */
+       case 2:  a += (uint32_t) k[1] << 8;     /* fall through */
        case 1:  a += k[0];
                 __jhash_final(a, b, c);
        case 0: /* Nothing left to add */
        case 1:  a += k[0];
                 __jhash_final(a, b, c);
        case 0: /* Nothing left to add */
diff --git a/init.c b/init.c
index a2b70c4acb4ba51a7916eda28f90bbcf3cdb10a9..e6378715b2fe4d42b882da45bc0c43ac44dcba66 100644 (file)
--- a/init.c
+++ b/init.c
@@ -2907,6 +2907,7 @@ int parse_cmd_line(int argc, char *argv[], int client_type)
                        log_err("%s: unrecognized option '%s'\n", argv[0],
                                                        argv[optind - 1]);
                        show_closest_option(argv[optind - 1]);
                        log_err("%s: unrecognized option '%s'\n", argv[0],
                                                        argv[optind - 1]);
                        show_closest_option(argv[optind - 1]);
+                       /* fall through */
                default:
                        do_exit++;
                        exit_val = 1;
                default:
                        do_exit++;
                        exit_val = 1;
index 49e34a8cfa9e3227d75342438fefbaae8804ae85..32fbec566432d300f65b028e1534cd2a435898c6 100644 (file)
@@ -88,21 +88,37 @@ static inline void __lfsr_next(struct fio_lfsr *fl, unsigned int spin)
         */
        switch (spin) {
                case 15: __LFSR_NEXT(fl, fl->last_val);
         */
        switch (spin) {
                case 15: __LFSR_NEXT(fl, fl->last_val);
+               /* fall through */
                case 14: __LFSR_NEXT(fl, fl->last_val);
                case 14: __LFSR_NEXT(fl, fl->last_val);
+               /* fall through */
                case 13: __LFSR_NEXT(fl, fl->last_val);
                case 13: __LFSR_NEXT(fl, fl->last_val);
+               /* fall through */
                case 12: __LFSR_NEXT(fl, fl->last_val);
                case 12: __LFSR_NEXT(fl, fl->last_val);
+               /* fall through */
                case 11: __LFSR_NEXT(fl, fl->last_val);
                case 11: __LFSR_NEXT(fl, fl->last_val);
+               /* fall through */
                case 10: __LFSR_NEXT(fl, fl->last_val);
                case 10: __LFSR_NEXT(fl, fl->last_val);
+               /* fall through */
                case  9: __LFSR_NEXT(fl, fl->last_val);
                case  9: __LFSR_NEXT(fl, fl->last_val);
+               /* fall through */
                case  8: __LFSR_NEXT(fl, fl->last_val);
                case  8: __LFSR_NEXT(fl, fl->last_val);
+               /* fall through */
                case  7: __LFSR_NEXT(fl, fl->last_val);
                case  7: __LFSR_NEXT(fl, fl->last_val);
+               /* fall through */
                case  6: __LFSR_NEXT(fl, fl->last_val);
                case  6: __LFSR_NEXT(fl, fl->last_val);
+               /* fall through */
                case  5: __LFSR_NEXT(fl, fl->last_val);
                case  5: __LFSR_NEXT(fl, fl->last_val);
+               /* fall through */
                case  4: __LFSR_NEXT(fl, fl->last_val);
                case  4: __LFSR_NEXT(fl, fl->last_val);
+               /* fall through */
                case  3: __LFSR_NEXT(fl, fl->last_val);
                case  3: __LFSR_NEXT(fl, fl->last_val);
+               /* fall through */
                case  2: __LFSR_NEXT(fl, fl->last_val);
                case  2: __LFSR_NEXT(fl, fl->last_val);
+               /* fall through */
                case  1: __LFSR_NEXT(fl, fl->last_val);
                case  1: __LFSR_NEXT(fl, fl->last_val);
+               /* fall through */
                case  0: __LFSR_NEXT(fl, fl->last_val);
                case  0: __LFSR_NEXT(fl, fl->last_val);
+               /* fall through */
                default: break;
        }
 }
                default: break;
        }
 }
index a01f2cfcb43c2cf963f69675bd462eb7f0f2fa33..ea8c8ddbde9a3429624ddde9cb9615a24c7b8c9b 100644 (file)
@@ -39,9 +39,12 @@ int main(int argc, char *argv[])
        /* Read arguments */
        switch (argc) {
                case 5: if (strncmp(argv[4], "verify", 7) == 0)
        /* Read arguments */
        switch (argc) {
                case 5: if (strncmp(argv[4], "verify", 7) == 0)
-                                       verify = 1;
+                               verify = 1;
+                       /* fall through */
                case 4: spin = atoi(argv[3]);
                case 4: spin = atoi(argv[3]);
+                       /* fall through */
                case 3: seed = atol(argv[2]);
                case 3: seed = atol(argv[2]);
+                       /* fall through */
                case 2: numbers = strtol(argv[1], NULL, 16);
                                break;
                default: usage();
                case 2: numbers = strtol(argv[1], NULL, 16);
                                break;
                default: usage();