Rename 'fallthrough' attribute to 'fio_fallthrough'
authorJens Axboe <axboe@kernel.dk>
Wed, 30 Mar 2022 23:31:36 +0000 (17:31 -0600)
committerJens Axboe <axboe@kernel.dk>
Wed, 30 Mar 2022 23:31:36 +0000 (17:31 -0600)
fallthrough is reserved in C++, so this causes issues with C++
programs pulling in the fio.h -> compiler.h header.

Rename it to something fio specific instead.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
compiler/compiler.h
crc/murmur3.c
engines/http.c
hash.h
init.c
io_u.c
lib/lfsr.c
parse.c
t/lfsr-test.c

index 3fd0822f3b77bca92a99472ebbc9fbd1fb241df0..fefadeaa89fc5e4043d3024a98488f07fe9cbdb9 100644 (file)
@@ -72,9 +72,9 @@
 #endif
 
 #if __has_attribute(__fallthrough__)
-#define fallthrough     __attribute__((__fallthrough__))
+#define fio_fallthrough         __attribute__((__fallthrough__))
 #else
-#define fallthrough    do {} while (0)  /* fallthrough */
+#define fio_fallthrough        do {} while (0)  /* fallthrough */
 #endif
 
 #endif
index ba408a9e80c8df60f8a9466cb862024cdad69135..08660bc8cb4a7e4b4308e8e6ce905eb6015448b3 100644 (file)
@@ -30,10 +30,10 @@ static uint32_t murmur3_tail(const uint8_t *data, const int nblocks,
        switch (len & 3) {
        case 3:
                k1 ^= tail[2] << 16;
-               fallthrough;
+               fio_fallthrough;
        case 2:
                k1 ^= tail[1] << 8;
-               fallthrough;
+               fio_fallthrough;
        case 1:
                k1 ^= tail[0];
                k1 *= c1;
index 57d4967def689796459b38ff04fc0e11749ae46d..696febe15105784e505847ef2f12d6071c0bbd97 100644 (file)
@@ -297,7 +297,7 @@ static int _curl_trace(CURL *handle, curl_infotype type,
        switch (type) {
        case CURLINFO_TEXT:
                fprintf(stderr, "== Info: %s", data);
-               fallthrough;
+               fio_fallthrough;
        default:
        case CURLINFO_SSL_DATA_OUT:
        case CURLINFO_SSL_DATA_IN:
diff --git a/hash.h b/hash.h
index 2c04bc296974dbe7708fe2ef940afd5893a92ec0..f7596a56367572b2852d049144103979ead08eea 100644 (file)
--- a/hash.h
+++ b/hash.h
@@ -142,20 +142,20 @@ 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) {
-       case 12: c += (uint32_t) k[11] << 24;   fallthrough;
-       case 11: c += (uint32_t) k[10] << 16;   fallthrough;
-       case 10: c += (uint32_t) k[9] << 8;     fallthrough;
-       case 9:  c += k[8];                     fallthrough;
-       case 8:  b += (uint32_t) k[7] << 24;    fallthrough;
-       case 7:  b += (uint32_t) k[6] << 16;    fallthrough;
-       case 6:  b += (uint32_t) k[5] << 8;     fallthrough;
-       case 5:  b += k[4];                     fallthrough;
-       case 4:  a += (uint32_t) k[3] << 24;    fallthrough;
-       case 3:  a += (uint32_t) k[2] << 16;    fallthrough;
-       case 2:  a += (uint32_t) k[1] << 8;     fallthrough;
+       case 12: c += (uint32_t) k[11] << 24;   fio_fallthrough;
+       case 11: c += (uint32_t) k[10] << 16;   fio_fallthrough;
+       case 10: c += (uint32_t) k[9] << 8;     fio_fallthrough;
+       case 9:  c += k[8];                     fio_fallthrough;
+       case 8:  b += (uint32_t) k[7] << 24;    fio_fallthrough;
+       case 7:  b += (uint32_t) k[6] << 16;    fio_fallthrough;
+       case 6:  b += (uint32_t) k[5] << 8;     fio_fallthrough;
+       case 5:  b += k[4];                     fio_fallthrough;
+       case 4:  a += (uint32_t) k[3] << 24;    fio_fallthrough;
+       case 3:  a += (uint32_t) k[2] << 16;    fio_fallthrough;
+       case 2:  a += (uint32_t) k[1] << 8;     fio_fallthrough;
        case 1:  a += k[0];
                 __jhash_final(a, b, c);
-                fallthrough;
+                fio_fallthrough;
        case 0: /* Nothing left to add */
                break;
        }
diff --git a/init.c b/init.c
index b7f866e65972b7882e123669cb7ec871404f2630..6f1860518f689814913209ceb2f836b428bc41fb 100644 (file)
--- a/init.c
+++ b/init.c
@@ -2990,7 +2990,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]);
-                       fallthrough;
+                       fio_fallthrough;
                default:
                        do_exit++;
                        exit_val = 1;
diff --git a/io_u.c b/io_u.c
index 50197a4bfa70c83f99981c0f7719172a9243d178..eec378ddc0258169e3edbeb84046f7f27cef6282 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -993,7 +993,7 @@ static void __io_u_mark_map(uint64_t *map, unsigned int nr)
                break;
        case 1 ... 4:
                idx = 1;
-               fallthrough;
+               fio_fallthrough;
        case 0:
                break;
        }
@@ -1035,7 +1035,7 @@ void io_u_mark_depth(struct thread_data *td, unsigned int nr)
                break;
        case 2 ... 3:
                idx = 1;
-               fallthrough;
+               fio_fallthrough;
        case 1:
                break;
        }
@@ -1076,7 +1076,7 @@ static void io_u_mark_lat_nsec(struct thread_data *td, unsigned long long nsec)
                break;
        case 2 ... 3:
                idx = 1;
-               fallthrough;
+               fio_fallthrough;
        case 0 ... 1:
                break;
        }
@@ -1118,7 +1118,7 @@ static void io_u_mark_lat_usec(struct thread_data *td, unsigned long long usec)
                break;
        case 2 ... 3:
                idx = 1;
-               fallthrough;
+               fio_fallthrough;
        case 0 ... 1:
                break;
        }
@@ -1166,7 +1166,7 @@ static void io_u_mark_lat_msec(struct thread_data *td, unsigned long long msec)
                break;
        case 2 ... 3:
                idx = 1;
-               fallthrough;
+               fio_fallthrough;
        case 0 ... 1:
                break;
        }
index a32e850a704f08e8e43456a5b684cae6cd8aba22..e86086c4af123645c4ba02693d954816feae6f34 100644 (file)
@@ -88,37 +88,37 @@ static inline void __lfsr_next(struct fio_lfsr *fl, unsigned int spin)
         */
        switch (spin) {
                case 15: __LFSR_NEXT(fl, fl->last_val);
-               fallthrough;
+               fio_fallthrough;
                case 14: __LFSR_NEXT(fl, fl->last_val);
-               fallthrough;
+               fio_fallthrough;
                case 13: __LFSR_NEXT(fl, fl->last_val);
-               fallthrough;
+               fio_fallthrough;
                case 12: __LFSR_NEXT(fl, fl->last_val);
-               fallthrough;
+               fio_fallthrough;
                case 11: __LFSR_NEXT(fl, fl->last_val);
-               fallthrough;
+               fio_fallthrough;
                case 10: __LFSR_NEXT(fl, fl->last_val);
-               fallthrough;
+               fio_fallthrough;
                case  9: __LFSR_NEXT(fl, fl->last_val);
-               fallthrough;
+               fio_fallthrough;
                case  8: __LFSR_NEXT(fl, fl->last_val);
-               fallthrough;
+               fio_fallthrough;
                case  7: __LFSR_NEXT(fl, fl->last_val);
-               fallthrough;
+               fio_fallthrough;
                case  6: __LFSR_NEXT(fl, fl->last_val);
-               fallthrough;
+               fio_fallthrough;
                case  5: __LFSR_NEXT(fl, fl->last_val);
-               fallthrough;
+               fio_fallthrough;
                case  4: __LFSR_NEXT(fl, fl->last_val);
-               fallthrough;
+               fio_fallthrough;
                case  3: __LFSR_NEXT(fl, fl->last_val);
-               fallthrough;
+               fio_fallthrough;
                case  2: __LFSR_NEXT(fl, fl->last_val);
-               fallthrough;
+               fio_fallthrough;
                case  1: __LFSR_NEXT(fl, fl->last_val);
-               fallthrough;
+               fio_fallthrough;
                case  0: __LFSR_NEXT(fl, fl->last_val);
-               fallthrough;
+               fio_fallthrough;
                default: break;
        }
 }
diff --git a/parse.c b/parse.c
index e0bee0049b189d25c643c82ef50cb4ca529d9c82..656a50250b43cb09712de51fc2876c2aaefd5d65 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -601,7 +601,7 @@ static int __handle_option(const struct fio_option *o, const char *ptr,
        }
        case FIO_OPT_STR_VAL_TIME:
                is_time = 1;
-               fallthrough;
+               fio_fallthrough;
        case FIO_OPT_ULL:
        case FIO_OPT_INT:
        case FIO_OPT_STR_VAL:
@@ -980,7 +980,7 @@ store_option_value:
        }
        case FIO_OPT_DEPRECATED:
                ret = 1;
-               fallthrough;
+               fio_fallthrough;
        case FIO_OPT_SOFT_DEPRECATED:
                log_info("Option %s is deprecated\n", o->name);
                break;
index 279e07f0ecd05110fae4e78e12787b8d7788fc27..4b255e19bb07445bfe9564807676123b06cd75af 100644 (file)
@@ -41,11 +41,11 @@ int main(int argc, char *argv[])
        switch (argc) {
                case 5: if (strncmp(argv[4], "verify", 7) == 0)
                                verify = 1;
-                       fallthrough;
+                       fio_fallthrough;
                case 4: spin = atoi(argv[3]);
-                       fallthrough;
+                       fio_fallthrough;
                case 3: seed = atol(argv[2]);
-                       fallthrough;
+                       fio_fallthrough;
                case 2: numbers = strtol(argv[1], NULL, 16);
                                break;
                default: usage();