add /* fall through */ comments for picky C compilers that don't like the FALLTHROUGH; macro

This commit is contained in:
Paul Gardner-Stephen 2018-11-14 13:51:44 +10:30
parent d20d7911c4
commit 87303c3436
15 changed files with 37 additions and 2 deletions

View File

@ -76,6 +76,7 @@ static size_t _base64_encodev(const char symbols[], char *dstBase64, const struc
case 1:
*dst++ = symbols[64];
FALLTHROUGH;
/* fall through */
case 2:
*dst++ = symbols[64];
}

View File

@ -1214,6 +1214,7 @@ static int http_request_decode_chunks(struct http_request *r){
}
FALLTHROUGH;
}
/* fall through */
case CHUNK_SIZE:{
const char *p;
// TODO fail on non hex input
@ -1242,6 +1243,7 @@ static int http_request_decode_chunks(struct http_request *r){
}
FALLTHROUGH;
}
/* fall through */
case CHUNK_DATA:{
// Skip over the chunk heading if we can, to avoid a memmove.
if (r->end_decoded == r->parsed)
@ -1532,6 +1534,7 @@ static int http_request_form_data_start_part(struct http_request *r, int b)
);
}
FALLTHROUGH;
/* fall through */
case HEADER:
_INVOKE_HANDLER_VOID(handle_mime_part_end);
break;
@ -1572,6 +1575,7 @@ static int http_request_parse_body_form_data(struct http_request *r)
at_start = 1;
r->form_data_state = PREAMBLE;
FALLTHROUGH;
/* fall through */
case PREAMBLE: {
DEBUGF(http_server, "PREAMBLE");
char *start = r->parsed;
@ -2166,6 +2170,7 @@ unsigned http_range_close(struct http_range *dst, const struct http_range *src,
case CLOSED:
last = range->last < resource_length ? range->last : resource_length - 1;
FALLTHROUGH;
/* fall through */
case OPEN:
first = range->first < resource_length ? range->first : resource_length;
break;

View File

@ -178,6 +178,7 @@ static int restful_keyring_identitylist_json_content_chunk(struct http_request *
case LIST_ROWS:
strbuf_putc(b, ',');
FALLTHROUGH;
/* fall through */
case LIST_FIRST:
r->u.sidlist.phase = LIST_ROWS;
const char *did = NULL;

2
lang.h
View File

@ -81,7 +81,7 @@ typedef char bool_t;
# define FALLTHROUGH __attribute__((__fallthrough__))
#else
# define __ATTRIBUTE_fallthrough
# define FALLTHROUGH
# define FALLTHROUGH /* fall through */
#endif
#endif // __SERVAL_DNA__LANG_H

View File

@ -213,6 +213,7 @@ static int activity_ack(struct meshmb_feeds *feeds, struct message_ply_ack *ack)
rhizome_manifest_set_tail(m, 0);
rhizome_manifest_set_filesize(m, 0);
FALLTHROUGH;
/* fall through */
case RHIZOME_BUNDLE_STATUS_SAME:
{
enum rhizome_payload_status pstatus = rhizome_write_open_journal(&feeds->ack_writer, m, 0, RHIZOME_SIZE_UNSET);
@ -220,6 +221,7 @@ static int activity_ack(struct meshmb_feeds *feeds, struct message_ply_ack *ack)
break;
}
FALLTHROUGH;
/* fall through */
case RHIZOME_BUNDLE_STATUS_BUSY:
rhizome_bundle_result_free(&result);
rhizome_manifest_free(m);

View File

@ -342,6 +342,7 @@ static int restful_meshmb_list_json_content_chunk(struct http_request *hr, strbu
ROWS:
case LIST_ROWS: FALLTHROUGH;
/* fall through */
case LIST_FIRST:
if (!message_ply_is_open(&r->u.plylist.ply_reader)){
@ -374,6 +375,7 @@ ROWS:
END:
r->u.plylist.phase = LIST_END;
FALLTHROUGH;
/* fall through */
case LIST_END:
{
@ -399,6 +401,7 @@ END:
if (!strbuf_overrun(b))
r->u.plylist.phase = LIST_DONE;
FALLTHROUGH;
/* fall through */
case LIST_DONE:
return 0;
}
@ -604,6 +607,7 @@ static int restful_meshmb_feedlist_json_content_chunk(struct http_request *hr, s
return 1;
case LIST_ROWS: FALLTHROUGH;
/* fall through */
case LIST_FIRST:
{
struct enum_state state={
@ -618,11 +622,13 @@ static int restful_meshmb_feedlist_json_content_chunk(struct http_request *hr, s
}
r->u.meshmb_feeds.phase = LIST_END;
FALLTHROUGH;
/* fall through */
case LIST_END:
strbuf_puts(b, "\n]\n}\n");
if (!strbuf_overrun(b))
r->u.plylist.phase = LIST_DONE;
FALLTHROUGH;
/* fall through */
case LIST_DONE:
return 0;
}

View File

@ -1497,6 +1497,7 @@ static void file_interface_init(const struct config_network_interface *ifconfig)
broadcast.inet.sin_addr.s_addr=ifconfig->dummy_address.s_addr | ~ifconfig->dummy_netmask.s_addr;
FALLTHROUGH;
/* fall through */
case SOCK_STREAM:
if (!form_dummy_file_path(file_path, sizeof file_path, ifconfig->file))
return; // ignore if path is too long

View File

@ -1400,6 +1400,7 @@ struct rhizome_bundle_result rhizome_fill_manifest(rhizome_manifest *m, const ch
return rhizome_bundle_result_static(RHIZOME_BUNDLE_STATUS_ERROR, "Could not bind manifest to an ID");
}
FALLTHROUGH; // to set the BK field...
/* fall through */
case NEW_BUNDLE_ID:
assert(m->has_id);
// If the manifest has no author but does have a 'sender' field, then use the

View File

@ -703,6 +703,7 @@ int _sqlite_vbind(struct __sourceloc __whence, int log_level, sqlite_retry_state
if (retry && _sqlite_retry(__whence, retry, #FUNC "()")) \
continue; \
FALLTHROUGH; \
/* fall through */ \
default: \
LOGF(log_level, #FUNC "(%d) failed, %s: %s", index, sqlite3_errmsg(rhizome_database.db), sqlite3_sql(statement)); \
sqlite3_finalize(statement); \

View File

@ -586,6 +586,7 @@ static int insert_make_manifest(httpd_request *r)
default:
WHYF("rhizome_manifest_parse() returned %d", n);
FALLTHROUGH;
/* fall through */
case -1:
r->bundle_result = rhizome_bundle_result_static(RHIZOME_BUNDLE_STATUS_ERROR, "Internal error while parsing manifest");
break;

View File

@ -431,6 +431,7 @@ static void sync_send_peer(struct subscriber *peer, struct rhizome_sync_keys *sy
alloca_sync_key(&msg->key),
rhizome_bundle_status_message_nonnull(status));
FALLTHROUGH;
/* fall through */
case RHIZOME_BUNDLE_STATUS_NEW:
// TODO we don't have this bundle anymore!
ob_rewind(payload);

View File

@ -105,6 +105,7 @@ static int restful_route_list_json_content_chunk(struct http_request *hr, strbuf
case LIST_ROWS:
strbuf_putc(b, ',');
FALLTHROUGH;
/* fall through */
case LIST_FIRST:
r->u.subscriberlist.phase = LIST_ROWS;
struct subscriber **subscriberp = subscriber_iterator_get_current(&r->u.subscriberlist.it);

View File

@ -80,6 +80,7 @@ strbuf strbuf_uuid(strbuf sb, const serval_uuid_t *uuid)
case 4: case 6: case 8: case 10:
strbuf_putc(sb, '-');
FALLTHROUGH;
/* fall through */
default:
strbuf_putc(sb, hexdigit_lower[uuid->u.binary[i] >> 4]);
strbuf_putc(sb, hexdigit_lower[uuid->u.binary[i] & 0xf]);

View File

@ -25023,6 +25023,7 @@ SQLITE_PRIVATE void sqlite3VXPrintf(
flag_longlong = sizeof(char*)==sizeof(i64);
flag_long = sizeof(char*)==sizeof(long int);
/* Fall through into the next case */
/* fall through */
case etORDINAL:
case etRADIX:
if( infop->flags & FLAG_SIGNED ){
@ -70920,8 +70921,9 @@ static void resolveP2Values(Vdbe *p, int *pMaxFuncArgs){
switch( pOp->opcode ){
case OP_Transaction: {
if( pOp->p2!=0 ) p->readOnly = 0;
/* fall thru */
/* fall through */
}
/* fall through */
case OP_AutoCommit:
case OP_Savepoint: {
p->bIsReader = 1;
@ -78083,6 +78085,7 @@ case OP_HaltIfNull: { /* in3 */
** every program. So a jump past the last instruction of the program
** is the same as executing Halt.
*/
/* fall through */
case OP_Halt: {
VdbeFrame *pFrame;
int pcx;
@ -78233,6 +78236,7 @@ case OP_String8: { /* same as TK_STRING, out2 */
**
** if( P3!=0 and reg[P3]==P5 ) reg[P2] := CAST(reg[P2] as BLOB)
*/
/* fall through */
case OP_String: { /* out2 */
assert( pOp->p4.z!=0 );
pOut = out2Prerelease(p, pOp);
@ -78789,6 +78793,7 @@ case OP_Function0: {
pOp->opcode = OP_Function;
/* Fall through into OP_Function */
}
/* fall through */
case OP_Function: {
int i;
sqlite3_context *pCtx;
@ -81954,6 +81959,7 @@ case OP_Sort: { /* jump */
** from the beginning toward the end. In other words, the cursor is
** configured to use Next, not Prev.
*/
/* fall through */
case OP_Rewind: { /* jump */
VdbeCursor *pC;
BtCursor *pCrsr;
@ -83172,6 +83178,7 @@ case OP_AggStep0: {
pOp->opcode = OP_AggStep;
/* Fall through into OP_AggStep */
}
/* fall through */
case OP_AggStep: {
int i;
sqlite3_context *pCtx;
@ -92183,6 +92190,7 @@ SQLITE_PRIVATE int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target)
}
/* Otherwise, fall thru into the TK_COLUMN case */
}
/* fall through */
case TK_COLUMN: {
int iTab = pExpr->iTable;
if( iTab<0 ){
@ -106384,6 +106392,7 @@ static Trigger *fkActionTrigger(
pStep->op = TK_DELETE;
break;
}
/* fall through */
default:
pStep->op = TK_UPDATE;
}
@ -107871,6 +107880,7 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks(
onError = OE_Abort;
/* Fall thru into the next case */
}
/* fall through */
case OE_Rollback:
case OE_Abort:
case OE_Fail: {
@ -135877,6 +135887,7 @@ SQLITE_PRIVATE int sqlite3GetToken(const unsigned char *z, int *tokenType){
/* If the next character is a digit, this is a floating point
** number that begins with ".". Fall thru into the next case */
}
/* fall through */
case CC_DIGIT: {
testcase( z[0]=='0' ); testcase( z[0]=='1' ); testcase( z[0]=='2' );
testcase( z[0]=='3' ); testcase( z[0]=='4' ); testcase( z[0]=='5' );
@ -135981,6 +135992,7 @@ SQLITE_PRIVATE int sqlite3GetToken(const unsigned char *z, int *tokenType){
/* If it is not a BLOB literal, then it must be an ID, since no
** SQL keywords start with the letter 'x'. Fall through */
}
/* fall through */
case CC_ID: {
i = 1;
break;

View File

@ -507,6 +507,7 @@ strbuf strbuf_append_sockaddr(strbuf sb, const struct sockaddr *addr, socklen_t
}
FALLTHROUGH;
}
/* fall through */
default: {
strbuf_append_socket_domain(sb, addr->sa_family);
size_t len = (size_t)addrlen > sizeof addr->sa_family ? addrlen - sizeof addr->sa_family : 0;