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: case 1:
*dst++ = symbols[64]; *dst++ = symbols[64];
FALLTHROUGH; FALLTHROUGH;
/* fall through */
case 2: case 2:
*dst++ = symbols[64]; *dst++ = symbols[64];
} }

View File

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

View File

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

2
lang.h
View File

@ -81,7 +81,7 @@ typedef char bool_t;
# define FALLTHROUGH __attribute__((__fallthrough__)) # define FALLTHROUGH __attribute__((__fallthrough__))
#else #else
# define __ATTRIBUTE_fallthrough # define __ATTRIBUTE_fallthrough
# define FALLTHROUGH # define FALLTHROUGH /* fall through */
#endif #endif
#endif // __SERVAL_DNA__LANG_H #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_tail(m, 0);
rhizome_manifest_set_filesize(m, 0); rhizome_manifest_set_filesize(m, 0);
FALLTHROUGH; FALLTHROUGH;
/* fall through */
case RHIZOME_BUNDLE_STATUS_SAME: case RHIZOME_BUNDLE_STATUS_SAME:
{ {
enum rhizome_payload_status pstatus = rhizome_write_open_journal(&feeds->ack_writer, m, 0, RHIZOME_SIZE_UNSET); 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; break;
} }
FALLTHROUGH; FALLTHROUGH;
/* fall through */
case RHIZOME_BUNDLE_STATUS_BUSY: case RHIZOME_BUNDLE_STATUS_BUSY:
rhizome_bundle_result_free(&result); rhizome_bundle_result_free(&result);
rhizome_manifest_free(m); rhizome_manifest_free(m);

View File

@ -342,6 +342,7 @@ static int restful_meshmb_list_json_content_chunk(struct http_request *hr, strbu
ROWS: ROWS:
case LIST_ROWS: FALLTHROUGH; case LIST_ROWS: FALLTHROUGH;
/* fall through */
case LIST_FIRST: case LIST_FIRST:
if (!message_ply_is_open(&r->u.plylist.ply_reader)){ if (!message_ply_is_open(&r->u.plylist.ply_reader)){
@ -374,6 +375,7 @@ ROWS:
END: END:
r->u.plylist.phase = LIST_END; r->u.plylist.phase = LIST_END;
FALLTHROUGH; FALLTHROUGH;
/* fall through */
case LIST_END: case LIST_END:
{ {
@ -399,6 +401,7 @@ END:
if (!strbuf_overrun(b)) if (!strbuf_overrun(b))
r->u.plylist.phase = LIST_DONE; r->u.plylist.phase = LIST_DONE;
FALLTHROUGH; FALLTHROUGH;
/* fall through */
case LIST_DONE: case LIST_DONE:
return 0; return 0;
} }
@ -604,6 +607,7 @@ static int restful_meshmb_feedlist_json_content_chunk(struct http_request *hr, s
return 1; return 1;
case LIST_ROWS: FALLTHROUGH; case LIST_ROWS: FALLTHROUGH;
/* fall through */
case LIST_FIRST: case LIST_FIRST:
{ {
struct enum_state state={ 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; r->u.meshmb_feeds.phase = LIST_END;
FALLTHROUGH; FALLTHROUGH;
/* fall through */
case LIST_END: case LIST_END:
strbuf_puts(b, "\n]\n}\n"); strbuf_puts(b, "\n]\n}\n");
if (!strbuf_overrun(b)) if (!strbuf_overrun(b))
r->u.plylist.phase = LIST_DONE; r->u.plylist.phase = LIST_DONE;
FALLTHROUGH; FALLTHROUGH;
/* fall through */
case LIST_DONE: case LIST_DONE:
return 0; 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; broadcast.inet.sin_addr.s_addr=ifconfig->dummy_address.s_addr | ~ifconfig->dummy_netmask.s_addr;
FALLTHROUGH; FALLTHROUGH;
/* fall through */
case SOCK_STREAM: case SOCK_STREAM:
if (!form_dummy_file_path(file_path, sizeof file_path, ifconfig->file)) if (!form_dummy_file_path(file_path, sizeof file_path, ifconfig->file))
return; // ignore if path is too long 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"); return rhizome_bundle_result_static(RHIZOME_BUNDLE_STATUS_ERROR, "Could not bind manifest to an ID");
} }
FALLTHROUGH; // to set the BK field... FALLTHROUGH; // to set the BK field...
/* fall through */
case NEW_BUNDLE_ID: case NEW_BUNDLE_ID:
assert(m->has_id); assert(m->has_id);
// If the manifest has no author but does have a 'sender' field, then use the // 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 "()")) \ if (retry && _sqlite_retry(__whence, retry, #FUNC "()")) \
continue; \ continue; \
FALLTHROUGH; \ FALLTHROUGH; \
/* fall through */ \
default: \ default: \
LOGF(log_level, #FUNC "(%d) failed, %s: %s", index, sqlite3_errmsg(rhizome_database.db), sqlite3_sql(statement)); \ LOGF(log_level, #FUNC "(%d) failed, %s: %s", index, sqlite3_errmsg(rhizome_database.db), sqlite3_sql(statement)); \
sqlite3_finalize(statement); \ sqlite3_finalize(statement); \

View File

@ -586,6 +586,7 @@ static int insert_make_manifest(httpd_request *r)
default: default:
WHYF("rhizome_manifest_parse() returned %d", n); WHYF("rhizome_manifest_parse() returned %d", n);
FALLTHROUGH; FALLTHROUGH;
/* fall through */
case -1: case -1:
r->bundle_result = rhizome_bundle_result_static(RHIZOME_BUNDLE_STATUS_ERROR, "Internal error while parsing manifest"); r->bundle_result = rhizome_bundle_result_static(RHIZOME_BUNDLE_STATUS_ERROR, "Internal error while parsing manifest");
break; 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), alloca_sync_key(&msg->key),
rhizome_bundle_status_message_nonnull(status)); rhizome_bundle_status_message_nonnull(status));
FALLTHROUGH; FALLTHROUGH;
/* fall through */
case RHIZOME_BUNDLE_STATUS_NEW: case RHIZOME_BUNDLE_STATUS_NEW:
// TODO we don't have this bundle anymore! // TODO we don't have this bundle anymore!
ob_rewind(payload); 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: case LIST_ROWS:
strbuf_putc(b, ','); strbuf_putc(b, ',');
FALLTHROUGH; FALLTHROUGH;
/* fall through */
case LIST_FIRST: case LIST_FIRST:
r->u.subscriberlist.phase = LIST_ROWS; r->u.subscriberlist.phase = LIST_ROWS;
struct subscriber **subscriberp = subscriber_iterator_get_current(&r->u.subscriberlist.it); 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: case 4: case 6: case 8: case 10:
strbuf_putc(sb, '-'); strbuf_putc(sb, '-');
FALLTHROUGH; FALLTHROUGH;
/* fall through */
default: default:
strbuf_putc(sb, hexdigit_lower[uuid->u.binary[i] >> 4]); strbuf_putc(sb, hexdigit_lower[uuid->u.binary[i] >> 4]);
strbuf_putc(sb, hexdigit_lower[uuid->u.binary[i] & 0xf]); 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_longlong = sizeof(char*)==sizeof(i64);
flag_long = sizeof(char*)==sizeof(long int); flag_long = sizeof(char*)==sizeof(long int);
/* Fall through into the next case */ /* Fall through into the next case */
/* fall through */
case etORDINAL: case etORDINAL:
case etRADIX: case etRADIX:
if( infop->flags & FLAG_SIGNED ){ if( infop->flags & FLAG_SIGNED ){
@ -70920,8 +70921,9 @@ static void resolveP2Values(Vdbe *p, int *pMaxFuncArgs){
switch( pOp->opcode ){ switch( pOp->opcode ){
case OP_Transaction: { case OP_Transaction: {
if( pOp->p2!=0 ) p->readOnly = 0; if( pOp->p2!=0 ) p->readOnly = 0;
/* fall thru */ /* fall through */
} }
/* fall through */
case OP_AutoCommit: case OP_AutoCommit:
case OP_Savepoint: { case OP_Savepoint: {
p->bIsReader = 1; p->bIsReader = 1;
@ -78083,6 +78085,7 @@ case OP_HaltIfNull: { /* in3 */
** every program. So a jump past the last instruction of the program ** every program. So a jump past the last instruction of the program
** is the same as executing Halt. ** is the same as executing Halt.
*/ */
/* fall through */
case OP_Halt: { case OP_Halt: {
VdbeFrame *pFrame; VdbeFrame *pFrame;
int pcx; 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) ** if( P3!=0 and reg[P3]==P5 ) reg[P2] := CAST(reg[P2] as BLOB)
*/ */
/* fall through */
case OP_String: { /* out2 */ case OP_String: { /* out2 */
assert( pOp->p4.z!=0 ); assert( pOp->p4.z!=0 );
pOut = out2Prerelease(p, pOp); pOut = out2Prerelease(p, pOp);
@ -78789,6 +78793,7 @@ case OP_Function0: {
pOp->opcode = OP_Function; pOp->opcode = OP_Function;
/* Fall through into OP_Function */ /* Fall through into OP_Function */
} }
/* fall through */
case OP_Function: { case OP_Function: {
int i; int i;
sqlite3_context *pCtx; sqlite3_context *pCtx;
@ -81954,6 +81959,7 @@ case OP_Sort: { /* jump */
** from the beginning toward the end. In other words, the cursor is ** from the beginning toward the end. In other words, the cursor is
** configured to use Next, not Prev. ** configured to use Next, not Prev.
*/ */
/* fall through */
case OP_Rewind: { /* jump */ case OP_Rewind: { /* jump */
VdbeCursor *pC; VdbeCursor *pC;
BtCursor *pCrsr; BtCursor *pCrsr;
@ -83172,6 +83178,7 @@ case OP_AggStep0: {
pOp->opcode = OP_AggStep; pOp->opcode = OP_AggStep;
/* Fall through into OP_AggStep */ /* Fall through into OP_AggStep */
} }
/* fall through */
case OP_AggStep: { case OP_AggStep: {
int i; int i;
sqlite3_context *pCtx; 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 */ /* Otherwise, fall thru into the TK_COLUMN case */
} }
/* fall through */
case TK_COLUMN: { case TK_COLUMN: {
int iTab = pExpr->iTable; int iTab = pExpr->iTable;
if( iTab<0 ){ if( iTab<0 ){
@ -106384,6 +106392,7 @@ static Trigger *fkActionTrigger(
pStep->op = TK_DELETE; pStep->op = TK_DELETE;
break; break;
} }
/* fall through */
default: default:
pStep->op = TK_UPDATE; pStep->op = TK_UPDATE;
} }
@ -107871,6 +107880,7 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks(
onError = OE_Abort; onError = OE_Abort;
/* Fall thru into the next case */ /* Fall thru into the next case */
} }
/* fall through */
case OE_Rollback: case OE_Rollback:
case OE_Abort: case OE_Abort:
case OE_Fail: { 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 /* If the next character is a digit, this is a floating point
** number that begins with ".". Fall thru into the next case */ ** number that begins with ".". Fall thru into the next case */
} }
/* fall through */
case CC_DIGIT: { case CC_DIGIT: {
testcase( z[0]=='0' ); testcase( z[0]=='1' ); testcase( z[0]=='2' ); testcase( z[0]=='0' ); testcase( z[0]=='1' ); testcase( z[0]=='2' );
testcase( z[0]=='3' ); testcase( z[0]=='4' ); testcase( z[0]=='5' ); 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 /* If it is not a BLOB literal, then it must be an ID, since no
** SQL keywords start with the letter 'x'. Fall through */ ** SQL keywords start with the letter 'x'. Fall through */
} }
/* fall through */
case CC_ID: { case CC_ID: {
i = 1; i = 1;
break; break;

View File

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