diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2017-07-24 09:35:58 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2017-07-24 09:35:58 +0000 |
commit | bc58e5d7345217fa0fbfa0d9c577ee10c7bd94db (patch) | |
tree | e76c9d1daa7b18f9383200459afe40804af83dbf | |
parent | 737979601f25ace7e5444dd3c925329c5a0a8b6d (diff) |
Add [[falltrhough]] for gcc 7
17 files changed, 65 insertions, 37 deletions
diff --git a/config/src/apps/vespa-get-config/getconfig.cpp b/config/src/apps/vespa-get-config/getconfig.cpp index 23a9f513350..0e46021e901 100644 --- a/config/src/apps/vespa-get-config/getconfig.cpp +++ b/config/src/apps/vespa-get-config/getconfig.cpp @@ -164,6 +164,7 @@ GetConfig::Main() break; case 'h': retval = 0; + [[fallthrough]]; case '?': default: usage(); diff --git a/document/src/vespa/document/select/valuenodes.cpp b/document/src/vespa/document/select/valuenodes.cpp index a4afef113fb..d334f4b955e 100644 --- a/document/src/vespa/document/select/valuenodes.cpp +++ b/document/src/vespa/document/select/valuenodes.cpp @@ -999,6 +999,7 @@ ArithmeticValueNode::getValue(std::unique_ptr<Value> lval, return std::unique_ptr<Value>(new StringValue( slval.getValue() + srval.getValue())); } + [[fallthrough]]; } case SUB: case MUL: @@ -1048,6 +1049,7 @@ ArithmeticValueNode::getValue(std::unique_ptr<Value> lval, } return std::unique_ptr<Value>(new FloatValue(res)); } + [[fallthrough]]; } case MOD: { @@ -1062,6 +1064,7 @@ ArithmeticValueNode::getValue(std::unique_ptr<Value> lval, throw vespalib::IllegalArgumentException("Division by zero"); } } + [[fallthrough]]; } } return std::unique_ptr<Value>(new InvalidValue); @@ -1086,6 +1089,7 @@ ArithmeticValueNode::traceValue(std::unique_ptr<Value> lval, << "' -> '" << *result << "'.\n"; return result; } + [[fallthrough]]; } case SUB: case MUL: @@ -1131,6 +1135,7 @@ ArithmeticValueNode::traceValue(std::unique_ptr<Value> lval, << "\n"; return result; } + [[fallthrough]]; } case MOD: { @@ -1146,6 +1151,7 @@ ArithmeticValueNode::traceValue(std::unique_ptr<Value> lval, << "\n"; return result; } + [[fallthrough]]; } } out << "Failed to do operation " << getOperatorName() diff --git a/fastlib/src/vespa/fastlib/util/base64.cpp b/fastlib/src/vespa/fastlib/util/base64.cpp index 279da94b2fa..8b9ac45e698 100644 --- a/fastlib/src/vespa/fastlib/util/base64.cpp +++ b/fastlib/src/vespa/fastlib/util/base64.cpp @@ -90,6 +90,7 @@ Fast_Base64::Decode(const char *source, unsigned int length, char *destination) if (symbol != '=' || i == length) return -1; symbol = source[++i]; + [[fallthrough]]; case 3: for (; i < length; ++i) { symbol = source[i]; if (symbol == '\0') diff --git a/fbench/src/filterfile/filterfile.cpp b/fbench/src/filterfile/filterfile.cpp index a9c05c9ba42..1f467d127e0 100644 --- a/fbench/src/filterfile/filterfile.cpp +++ b/fbench/src/filterfile/filterfile.cpp @@ -133,7 +133,8 @@ main(int argc, char** argv) break; case 1: buf[outIdx++] = line[idx]; - case 2: // FALLTHROUGH + [[fallthrough]]; + case 2: if (line[idx++] == '&') state = 0; break; diff --git a/filedistribution/src/apps/status/status-filedistribution.cpp b/filedistribution/src/apps/status/status-filedistribution.cpp index 3cd29f154fd..f51454d438b 100644 --- a/filedistribution/src/apps/status/status-filedistribution.cpp +++ b/filedistribution/src/apps/status/status-filedistribution.cpp @@ -78,6 +78,7 @@ int printStatus(const std::string& zkservers) break; case HostStatus::inProgress: hasStarted = true; + [[fallthrough]]; case HostStatus::notStarted: notFinishedHosts[host] = hostStatus; break; diff --git a/fsa/src/vespa/fsa/segmenter.cpp b/fsa/src/vespa/fsa/segmenter.cpp index fdeba5c2bd7..3bcb3f1b489 100644 --- a/fsa/src/vespa/fsa/segmenter.cpp +++ b/fsa/src/vespa/fsa/segmenter.cpp @@ -77,12 +77,16 @@ void Segmenter::Segments::buildSegmentation(Segmenter::SegmentationMethod method switch(method){ case SEGMENTATION_WEIGHTED_BIAS100: bias+=50; + [[fallthrough]]; case SEGMENTATION_WEIGHTED_BIAS50: bias+=30; + [[fallthrough]]; case SEGMENTATION_WEIGHTED_BIAS20: bias+=10; + [[fallthrough]]; case SEGMENTATION_WEIGHTED_BIAS10: bias+=10; + [[fallthrough]]; case SEGMENTATION_WEIGHTED: bestid=-1; for(i=n_txt;i>=0;i--){ diff --git a/searchlib/src/vespa/searchlib/common/sortresults.cpp b/searchlib/src/vespa/searchlib/common/sortresults.cpp index ebca7249db7..0514ba5ebc1 100644 --- a/searchlib/src/vespa/searchlib/common/sortresults.cpp +++ b/searchlib/src/vespa/searchlib/common/sortresults.cpp @@ -461,14 +461,18 @@ public: default: case 4: r |= _data[a._idx + a._pos + 3] << 0; + [[fallthrough]]; case 3: r |= _data[a._idx + a._pos + 2] << 8; + [[fallthrough]]; case 2: r |= _data[a._idx + a._pos + 1] << 16; + [[fallthrough]]; case 1: r |= _data[a._idx + a._pos + 0] << 24; + [[fallthrough]]; case 0: - ; + [[fallthrough]]; } a._pos += std::min(4u, left); return r; diff --git a/searchlib/src/vespa/searchlib/predicate/predicate_hash.h b/searchlib/src/vespa/searchlib/predicate/predicate_hash.h index af675807afd..7645a041cad 100644 --- a/searchlib/src/vespa/searchlib/predicate/predicate_hash.h +++ b/searchlib/src/vespa/searchlib/predicate/predicate_hash.h @@ -75,30 +75,30 @@ struct PredicateHash { // handle the last 23 bytes c += origLen; switch(len) { // all the case statements fall through - case 23: c+=((0xffLL & aKey[offset+22])<<56); - case 22: c+=((0xffLL & aKey[offset+21])<<48); - case 21: c+=((0xffLL & aKey[offset+20])<<40); - case 20: c+=((0xffLL & aKey[offset+19])<<32); - case 19: c+=((0xffLL & aKey[offset+18])<<24); - case 18: c+=((0xffLL & aKey[offset+17])<<16); - case 17: c+=((0xffLL & aKey[offset+16])<<8); + case 23: c+=((0xffLL & aKey[offset+22])<<56); [[fallthrough]]; + case 22: c+=((0xffLL & aKey[offset+21])<<48); [[fallthrough]]; + case 21: c+=((0xffLL & aKey[offset+20])<<40); [[fallthrough]]; + case 20: c+=((0xffLL & aKey[offset+19])<<32); [[fallthrough]]; + case 19: c+=((0xffLL & aKey[offset+18])<<24); [[fallthrough]]; + case 18: c+=((0xffLL & aKey[offset+17])<<16); [[fallthrough]]; + case 17: c+=((0xffLL & aKey[offset+16])<<8); [[fallthrough]]; // the first byte of c is reserved for the length - case 16: b+=((0xffLL & aKey[offset+15])<<56); - case 15: b+=((0xffLL & aKey[offset+14])<<48); - case 14: b+=((0xffLL & aKey[offset+13])<<40); - case 13: b+=((0xffLL & aKey[offset+12])<<32); - case 12: b+=((0xffLL & aKey[offset+11])<<24); - case 11: b+=((0xffLL & aKey[offset+10])<<16); - case 10: b+=((0xffLL & aKey[offset+ 9])<<8); - case 9: b+=( 0xffLL & aKey[offset+ 8]); - case 8: a+=((0xffLL & aKey[offset+ 7])<<56); - case 7: a+=((0xffLL & aKey[offset+ 6])<<48); - case 6: a+=((0xffLL & aKey[offset+ 5])<<40); - case 5: a+=((0xffLL & aKey[offset+ 4])<<32); - case 4: a+=((0xffLL & aKey[offset+ 3])<<24); - case 3: a+=((0xffLL & aKey[offset+ 2])<<16); - case 2: a+=((0xffLL & aKey[offset+ 1])<<8); - case 1: a+=( 0xffLL & aKey[offset+ 0]); + case 16: b+=((0xffLL & aKey[offset+15])<<56); [[fallthrough]]; + case 15: b+=((0xffLL & aKey[offset+14])<<48); [[fallthrough]]; + case 14: b+=((0xffLL & aKey[offset+13])<<40); [[fallthrough]]; + case 13: b+=((0xffLL & aKey[offset+12])<<32); [[fallthrough]]; + case 12: b+=((0xffLL & aKey[offset+11])<<24); [[fallthrough]]; + case 11: b+=((0xffLL & aKey[offset+10])<<16); [[fallthrough]]; + case 10: b+=((0xffLL & aKey[offset+ 9])<<8); [[fallthrough]]; + case 9: b+=( 0xffLL & aKey[offset+ 8]); [[fallthrough]]; + case 8: a+=((0xffLL & aKey[offset+ 7])<<56); [[fallthrough]]; + case 7: a+=((0xffLL & aKey[offset+ 6])<<48); [[fallthrough]]; + case 6: a+=((0xffLL & aKey[offset+ 5])<<40); [[fallthrough]]; + case 5: a+=((0xffLL & aKey[offset+ 4])<<32); [[fallthrough]]; + case 4: a+=((0xffLL & aKey[offset+ 3])<<24); [[fallthrough]]; + case 3: a+=((0xffLL & aKey[offset+ 2])<<16); [[fallthrough]]; + case 2: a+=((0xffLL & aKey[offset+ 1])<<8); [[fallthrough]]; + case 1: a+=( 0xffLL & aKey[offset+ 0]); [[fallthrough]]; // case 0: nothing left to add } diff --git a/searchsummary/src/vespa/searchsummary/docsummary/attributedfw.cpp b/searchsummary/src/vespa/searchsummary/docsummary/attributedfw.cpp index fb1ab360532..fe766bb2889 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/attributedfw.cpp +++ b/searchsummary/src/vespa/searchsummary/docsummary/attributedfw.cpp @@ -49,6 +49,7 @@ ResType inferType(const IAttributeVector & vec) { switch (t) { case BasicType::TENSOR: retval = RES_TENSOR; + [[fallthrough]]; default: retval = RES_STRING; } diff --git a/staging_vespalib/src/vespa/vespalib/util/jsonwriter.cpp b/staging_vespalib/src/vespa/vespalib/util/jsonwriter.cpp index a80f8b9164d..ebeda4f1b8b 100644 --- a/staging_vespalib/src/vespa/vespalib/util/jsonwriter.cpp +++ b/staging_vespalib/src/vespa/vespalib/util/jsonwriter.cpp @@ -56,8 +56,10 @@ JSONWriter::quote(const char * str, size_t len) case '\"': case '\\': v[j++] = '\\'; + [[fallthrough]]; default: v[j++] = str[i]; + break; } } v[j++] = '\"'; diff --git a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp index e42434c0e9c..5defe2c5ae8 100644 --- a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp +++ b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp @@ -868,6 +868,7 @@ FileStorHandlerImpl::remapMessage( } // Follow onto next to move queue or fail } + [[fallthrough]]; case api::MessageType::SPLITBUCKET_ID: // Move to correct queue if op == MOVE // Fail with bucket not found if op is JOIN @@ -954,6 +955,7 @@ FileStorHandlerImpl::remapMessage( break; case GetIterCommand::ID: bucket = static_cast<GetIterCommand&>(msg).getBucketId(); + [[fallthrough]]; case RepairBucketCommand::ID: if (bucket.getRawId() == 0) { bucket = static_cast<RepairBucketCommand&>(msg) diff --git a/vdslib/src/vespa/vdslib/state/diskstate.cpp b/vdslib/src/vespa/vdslib/state/diskstate.cpp index 8ceef59a58e..39ebe1e0ca0 100644 --- a/vdslib/src/vespa/vdslib/state/diskstate.cpp +++ b/vdslib/src/vespa/vdslib/state/diskstate.cpp @@ -64,6 +64,7 @@ DiskState::DiskState(const vespalib::stringref & serialized) "must be a positive floating point number", VESPA_STRLOC); } + [[fallthrough]]; case 'm': if (key.size() > 1) break; _description = document::StringUtil::unescape(value); diff --git a/vespalib/src/vespa/vespalib/data/slime/json_format.cpp b/vespalib/src/vespa/vespalib/data/slime/json_format.cpp index 856f9f654c2..88b99725302 100644 --- a/vespalib/src/vespa/vespalib/data/slime/json_format.cpp +++ b/vespalib/src/vespa/vespalib/data/slime/json_format.cpp @@ -426,6 +426,7 @@ JsonDecoder::decodeNumber(Inserter &inserter) switch (c) { case '+': case '-': case '.': case 'e': case 'E': isLong = false; + [[fallthrough]]; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': value.push_back(c); diff --git a/vespalib/src/vespa/vespalib/util/bobhash.h b/vespalib/src/vespa/vespalib/util/bobhash.h index 332e5b88cea..6c92896e538 100644 --- a/vespalib/src/vespa/vespalib/util/bobhash.h +++ b/vespalib/src/vespa/vespalib/util/bobhash.h @@ -135,18 +135,18 @@ public: c += length; switch(len) /* all the case statements fall through */ { - case 11: c += (static_cast<uint32_t>(k[10]) << 24); - case 10: c += (static_cast<uint32_t>(k[9]) << 16); - case 9 : c += (static_cast<uint32_t>(k[8]) << 8); + case 11: c += (static_cast<uint32_t>(k[10]) << 24); [[fallthrough]]; + case 10: c += (static_cast<uint32_t>(k[9]) << 16); [[fallthrough]]; + case 9 : c += (static_cast<uint32_t>(k[8]) << 8); [[fallthrough]]; /* the first byte of c is reserved for the length */ - case 8 : b += (static_cast<uint32_t>(k[7]) << 24); - case 7 : b += (static_cast<uint32_t>(k[6]) << 16); - case 6 : b += (static_cast<uint32_t>(k[5]) << 8); - case 5 : b += k[4]; - case 4 : a += (static_cast<uint32_t>(k[3]) << 24); - case 3 : a += (static_cast<uint32_t>(k[2]) << 16); - case 2 : a += (static_cast<uint32_t>(k[1]) << 8); - case 1 : a += k[0]; + case 8 : b += (static_cast<uint32_t>(k[7]) << 24); [[fallthrough]]; + case 7 : b += (static_cast<uint32_t>(k[6]) << 16); [[fallthrough]]; + case 6 : b += (static_cast<uint32_t>(k[5]) << 8); [[fallthrough]]; + case 5 : b += k[4]; [[fallthrough]]; + case 4 : a += (static_cast<uint32_t>(k[3]) << 24); [[fallthrough]]; + case 3 : a += (static_cast<uint32_t>(k[2]) << 16); [[fallthrough]]; + case 2 : a += (static_cast<uint32_t>(k[1]) << 8); [[fallthrough]]; + case 1 : a += k[0]; [[fallthrough]]; /* case 0: nothing left to add */ } bobhash_mix(a,b,c); diff --git a/vespalog/src/logctl/logctl.cpp b/vespalog/src/logctl/logctl.cpp index b45b2995d4f..a0963b43c34 100644 --- a/vespalog/src/logctl/logctl.cpp +++ b/vespalog/src/logctl/logctl.cpp @@ -116,9 +116,10 @@ main(int argc, char **argv) break; case 'r': doResetLevels = true; + [[fallthrough]]; case 'c': shouldCreateFile = true; - // fallthrough + [[fallthrough]]; case 'n': shouldCreateEntry = true; break; diff --git a/vsm/src/vespa/vsm/vsm/docsumfilter.cpp b/vsm/src/vespa/vsm/vsm/docsumfilter.cpp index 47d609eab1e..9e37a13ee00 100644 --- a/vsm/src/vespa/vsm/vsm/docsumfilter.cpp +++ b/vsm/src/vespa/vsm/vsm/docsumfilter.cpp @@ -200,6 +200,7 @@ DocsumFilter::getFieldValue(const DocsumFieldSpec::FieldIdentifier & fieldId, return _cachedValue.get(); } } + [[fallthrough]]; default: return fv; } diff --git a/vsm/src/vespa/vsm/vsm/fieldsearchspec.cpp b/vsm/src/vespa/vsm/vsm/fieldsearchspec.cpp index b17e0bfedca..f6ad9117abb 100644 --- a/vsm/src/vespa/vsm/vsm/fieldsearchspec.cpp +++ b/vsm/src/vespa/vsm/vsm/fieldsearchspec.cpp @@ -46,6 +46,7 @@ FieldSearchSpec::FieldSearchSpec(const FieldIdT & fid, const vespalib::string & switch(searchDef) { default: LOG(warning, "Unknown searchdef = %d. Defaulting to AUTOUTF8", searchDef); + [[fallthrough]]; case VsmfieldsConfig::Fieldspec::AUTOUTF8: case VsmfieldsConfig::Fieldspec::NONE: case VsmfieldsConfig::Fieldspec::SSE2UTF8: |