Skip to content

Commit

Permalink
Rename 'fallthrough' attribute to 'fio_fallthrough'
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
axboe committed Mar 30, 2022
1 parent 5e64477 commit 87933e3
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 44 deletions.
4 changes: 2 additions & 2 deletions compiler/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions crc/murmur3.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion engines/http.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
24 changes: 12 additions & 12 deletions hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion init.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions io_u.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down
32 changes: 16 additions & 16 deletions lib/lfsr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
4 changes: 2 additions & 2 deletions parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -980,7 +980,7 @@ static int __handle_option(const struct fio_option *o, const char *ptr,
}
case FIO_OPT_DEPRECATED:
ret = 1;
fallthrough;
fio_fallthrough;
case FIO_OPT_SOFT_DEPRECATED:
log_info("Option %s is deprecated\n", o->name);
break;
Expand Down
6 changes: 3 additions & 3 deletions t/lfsr-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 87933e3

Please sign in to comment.