Commit 150da2b0 authored by Kenton Varda's avatar Kenton Varda

Adjust fallthrough comments to satisfy GCC7's -Wimplicit-fallthrough.

If we were using C++17, we could use [[fallthrough]] instead... but we are not.
parent b299dcd7
...@@ -520,8 +520,7 @@ kj::Maybe<Compiler::Node::Content&> Compiler::Node::getContent(Content::State mi ...@@ -520,8 +520,7 @@ kj::Maybe<Compiler::Node::Content&> Compiler::Node::getContent(Content::State mi
} }
content.advanceState(Content::EXPANDED); content.advanceState(Content::EXPANDED);
// no break } // fallthrough
}
case Content::EXPANDED: { case Content::EXPANDED: {
if (minimumState <= Content::EXPANDED) break; if (minimumState <= Content::EXPANDED) break;
...@@ -584,8 +583,7 @@ kj::Maybe<Compiler::Node::Content&> Compiler::Node::getContent(Content::State mi ...@@ -584,8 +583,7 @@ kj::Maybe<Compiler::Node::Content&> Compiler::Node::getContent(Content::State mi
})); }));
content.advanceState(Content::BOOTSTRAP); content.advanceState(Content::BOOTSTRAP);
// no break } // fallthrough
}
case Content::BOOTSTRAP: { case Content::BOOTSTRAP: {
if (minimumState <= Content::BOOTSTRAP) break; if (minimumState <= Content::BOOTSTRAP) break;
...@@ -597,8 +595,7 @@ kj::Maybe<Compiler::Node::Content&> Compiler::Node::getContent(Content::State mi ...@@ -597,8 +595,7 @@ kj::Maybe<Compiler::Node::Content&> Compiler::Node::getContent(Content::State mi
content.sourceInfo = kj::mv(nodeSet.sourceInfo); content.sourceInfo = kj::mv(nodeSet.sourceInfo);
content.advanceState(Content::FINISHED); content.advanceState(Content::FINISHED);
// no break } // fallthrough
}
case Content::FINISHED: case Content::FINISHED:
break; break;
......
...@@ -997,7 +997,7 @@ bool NodeTranslator::BrandedDecl::compileAsType( ...@@ -997,7 +997,7 @@ bool NodeTranslator::BrandedDecl::compileAsType(
addError(errorReporter, addError(errorReporter,
"As of Cap'n Proto 0.4, 'Object' has been renamed to 'AnyPointer'. Sorry for the " "As of Cap'n Proto 0.4, 'Object' has been renamed to 'AnyPointer'. Sorry for the "
"inconvenience, and thanks for being an early adopter. :)"); "inconvenience, and thanks for being an early adopter. :)");
// no break // fallthrough
case Declaration::BUILTIN_ANY_POINTER: case Declaration::BUILTIN_ANY_POINTER:
target.initAnyPointer().initUnconstrained().setAnyKind(); target.initAnyPointer().initUnconstrained().setAnyKind();
return true; return true;
...@@ -2741,8 +2741,7 @@ kj::Maybe<Orphan<DynamicValue>> ValueTranslator::compileValue(Expression::Reader ...@@ -2741,8 +2741,7 @@ kj::Maybe<Orphan<DynamicValue>> ValueTranslator::compileValue(Expression::Reader
return kj::mv(result); return kj::mv(result);
} }
// No break -- value is positive, so we can just go on to the uint case below. } // fallthrough -- value is positive, so we can just go on to the uint case below.
}
case DynamicValue::UINT: { case DynamicValue::UINT: {
uint64_t maxValue = 0; uint64_t maxValue = 0;
......
...@@ -740,6 +740,7 @@ DynamicValue::Builder DynamicStruct::Builder::init(StructSchema::Field field, ui ...@@ -740,6 +740,7 @@ DynamicValue::Builder DynamicStruct::Builder::init(StructSchema::Field field, ui
(uint)type.which()); (uint)type.which());
break; break;
} }
KJ_UNREACHABLE;
} }
case schema::Field::GROUP: case schema::Field::GROUP:
......
...@@ -728,6 +728,7 @@ int base64_encode_block(const char* plaintext_in, int length_in, ...@@ -728,6 +728,7 @@ int base64_encode_block(const char* plaintext_in, int length_in,
result = (fragment & 0x0fc) >> 2; result = (fragment & 0x0fc) >> 2;
*codechar++ = base64_encode_value(result); *codechar++ = base64_encode_value(result);
result = (fragment & 0x003) << 4; result = (fragment & 0x003) << 4;
// fallthrough
case step_B: case step_B:
if (plainchar == plaintextend) { if (plainchar == plaintextend) {
state_in->result = result; state_in->result = result;
...@@ -738,6 +739,7 @@ int base64_encode_block(const char* plaintext_in, int length_in, ...@@ -738,6 +739,7 @@ int base64_encode_block(const char* plaintext_in, int length_in,
result |= (fragment & 0x0f0) >> 4; result |= (fragment & 0x0f0) >> 4;
*codechar++ = base64_encode_value(result); *codechar++ = base64_encode_value(result);
result = (fragment & 0x00f) << 2; result = (fragment & 0x00f) << 2;
// fallthrough
case step_C: case step_C:
if (plainchar == plaintextend) { if (plainchar == plaintextend) {
state_in->result = result; state_in->result = result;
...@@ -907,6 +909,7 @@ int base64_decode_block(const char* code_in, const int length_in, ...@@ -907,6 +909,7 @@ int base64_decode_block(const char* code_in, const int length_in,
ERROR_IF(fragment < -1); ERROR_IF(fragment < -1);
} while (fragment < 0); } while (fragment < 0);
*plainchar = (fragment & 0x03f) << 2; *plainchar = (fragment & 0x03f) << 2;
// fallthrough
case step_b: case step_b:
do { do {
if (codechar == code_in+length_in) { if (codechar == code_in+length_in) {
...@@ -924,6 +927,7 @@ int base64_decode_block(const char* code_in, const int length_in, ...@@ -924,6 +927,7 @@ int base64_decode_block(const char* code_in, const int length_in,
} while (fragment < 0); } while (fragment < 0);
*plainchar++ |= (fragment & 0x030) >> 4; *plainchar++ |= (fragment & 0x030) >> 4;
*plainchar = (fragment & 0x00f) << 4; *plainchar = (fragment & 0x00f) << 4;
// fallthrough
case step_c: case step_c:
do { do {
if (codechar == code_in+length_in) { if (codechar == code_in+length_in) {
...@@ -943,6 +947,7 @@ int base64_decode_block(const char* code_in, const int length_in, ...@@ -943,6 +947,7 @@ int base64_decode_block(const char* code_in, const int length_in,
ERROR_IF(state_in->nPaddingBytesSeen > 0); ERROR_IF(state_in->nPaddingBytesSeen > 0);
*plainchar++ |= (fragment & 0x03c) >> 2; *plainchar++ |= (fragment & 0x03c) >> 2;
*plainchar = (fragment & 0x003) << 6; *plainchar = (fragment & 0x003) << 6;
// fallthrough
case step_d: case step_d:
do { do {
if (codechar == code_in+length_in) { if (codechar == code_in+length_in) {
......
...@@ -936,6 +936,7 @@ public: ...@@ -936,6 +936,7 @@ public:
// Retry, but make sure we don't try to create the parent again. // Retry, but make sure we don't try to create the parent again.
return tryReplaceNode(path, mode - WriteMode::CREATE_PARENT, kj::mv(tryCreate)); return tryReplaceNode(path, mode - WriteMode::CREATE_PARENT, kj::mv(tryCreate));
} }
// fallthrough
default: default:
KJ_FAIL_SYSCALL("create(path)", error, path) { return false; } KJ_FAIL_SYSCALL("create(path)", error, path) { return false; }
} else { } else {
......
...@@ -47,8 +47,10 @@ uint HashCoder::operator*(ArrayPtr<const byte> s) const { ...@@ -47,8 +47,10 @@ uint HashCoder::operator*(ArrayPtr<const byte> s) const {
switch (len) { switch (len) {
case 3: case 3:
h ^= data[2] << 16; h ^= data[2] << 16;
// fallthrough
case 2: case 2:
h ^= data[1] << 8; h ^= data[1] << 8;
// fallthrough
case 1: case 1:
h ^= data[0]; h ^= data[0];
h *= m; h *= m;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment