refactor: add [[fallthrough]] annotation (#1886)

This commit is contained in:
Charles Kerr 2021-10-06 12:24:02 -05:00 committed by GitHub
parent 003685b40a
commit f876a100a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 10 additions and 16 deletions

View File

@ -161,8 +161,7 @@ static void onProgressDialogResponse(GtkDialog* d, int response, gpointer data)
case GTK_RESPONSE_ACCEPT:
addTorrent(ui);
/* fall-through */
[[fallthrough]];
case GTK_RESPONSE_CLOSE:
gtk_widget_destroy(ui->builder->result ? GTK_WIDGET(d) : ui->dialog);

View File

@ -247,10 +247,12 @@ void tr_bandwidthAllocate(tr_bandwidth* b, tr_direction dir, unsigned int period
switch (io->priority)
{
case TR_PRI_HIGH:
tr_ptrArrayAppend(&high, io); /* fall through */
tr_ptrArrayAppend(&high, io);
[[fallthrough]];
case TR_PRI_NORMAL:
tr_ptrArrayAppend(&normal, io); /* fall through */
tr_ptrArrayAppend(&normal, io);
[[fallthrough]];
default:
tr_ptrArrayAppend(&low, io);

View File

@ -647,7 +647,7 @@ static int tr_lpdAnnounceMore(time_t const now, int const interval)
announcePrio = 2;
break;
default: /* fall through */
default:
break;
}

View File

@ -121,12 +121,6 @@
#define TR_GNUC_MALLOC
#endif
#if __has_attribute(__fallthrough__) || TR_GNUC_CHECK_VERSION(7, 0)
#define TR_GNUC_FALLTHROUGH __attribute__((__fallthrough__))
#else
#define TR_GNUC_FALLTHROUGH
#endif
/***
****
***/

View File

@ -120,8 +120,8 @@ static int piperead(tr_pipe_end_t s, void* buf, int len)
case WSAECONNRESET:
/* EOF on the pipe! (win32 socket based implementation) */
ret = 0;
[[fallthrough]];
/* fall through */
default:
errno = werror;
break;

View File

@ -1042,7 +1042,8 @@ void Session::addTorrent(AddData const& add_me, tr_variant* args, bool trash_ori
dictAdd(args, TR_KEY_filename, add_me.url.toString());
break;
case AddData::FILENAME: /* fall-through */
case AddData::FILENAME:
[[fallthrough]];
case AddData::METAINFO:
dictAdd(args, TR_KEY_metainfo, add_me.toBase64());
break;

View File

@ -2112,9 +2112,7 @@ static int processResponse(char const* rpcurl, void const* response, size_t len)
{
tr_snprintf(id, sizeof(id), "%" PRId64, i);
}
/* fall-through to default: to give success or failure msg */
TR_GNUC_FALLTHROUGH;
[[fallthrough]];
}
default: