1
0
Fork 0

use C++17 [[fallthrough]] (#10280)

This commit is contained in:
Jan Christoph Uhde 2019-10-19 18:14:26 +02:00 committed by Jan
parent 0b133082ae
commit ea20f7aeb2
15 changed files with 160 additions and 160 deletions

View File

@ -83,7 +83,7 @@ std::pair<ExecutionState, InputAqlItemRow> AllRowsFetcher::fetchRow(size_t atMos
_nextReturn = 0;
_dataFetchedState = DATA_FETCH_ONGOING;
}
// intentionally falls through
[[fallthrough]];
case DATA_FETCH_ONGOING: {
TRI_ASSERT(_nextReturn < _rowIndexes.size());
TRI_ASSERT(_aqlItemMatrix != nullptr);

View File

@ -241,11 +241,11 @@ AqlValue AqlValue::at(int64_t position, bool& mustDestroy, bool doCopy) const {
switch (type()) {
case VPACK_SLICE_POINTER:
doCopy = false;
// intentionally falls through
[[fallthrough]];
case VPACK_INLINE:
// intentionally falls through
[[fallthrough]];
case VPACK_MANAGED_SLICE:
// intentionally falls through
[[fallthrough]];
case VPACK_MANAGED_BUFFER: {
VPackSlice s(slice());
if (s.isArray()) {
@ -318,11 +318,11 @@ AqlValue AqlValue::at(int64_t position, size_t n, bool& mustDestroy, bool doCopy
switch (type()) {
case VPACK_SLICE_POINTER:
doCopy = false;
// intentionally falls through
[[fallthrough]];
case VPACK_INLINE:
// intentionally falls through
[[fallthrough]];
case VPACK_MANAGED_SLICE:
// intentionally falls through
[[fallthrough]];
case VPACK_MANAGED_BUFFER: {
VPackSlice s(slice());
if (s.isArray()) {
@ -392,11 +392,11 @@ AqlValue AqlValue::getKeyAttribute(bool& mustDestroy, bool doCopy) const {
switch (type()) {
case VPACK_SLICE_POINTER:
doCopy = false;
// intentionally falls through
[[fallthrough]];
case VPACK_INLINE:
// intentionally falls through
[[fallthrough]];
case VPACK_MANAGED_SLICE:
// intentionally falls through
[[fallthrough]];
case VPACK_MANAGED_BUFFER: {
VPackSlice s(slice());
if (s.isObject()) {
@ -431,11 +431,11 @@ AqlValue AqlValue::getIdAttribute(CollectionNameResolver const& resolver,
switch (type()) {
case VPACK_SLICE_POINTER:
doCopy = false;
// intentionally falls through
[[fallthrough]];
case VPACK_INLINE:
// intentionally falls through
[[fallthrough]];
case VPACK_MANAGED_SLICE:
// intentionally falls through
[[fallthrough]];
case VPACK_MANAGED_BUFFER: {
VPackSlice s(slice());
if (s.isObject()) {
@ -474,11 +474,11 @@ AqlValue AqlValue::getFromAttribute(bool& mustDestroy, bool doCopy) const {
switch (type()) {
case VPACK_SLICE_POINTER:
doCopy = false;
// intentionally falls through
[[fallthrough]];
case VPACK_INLINE:
// intentionally falls through
[[fallthrough]];
case VPACK_MANAGED_SLICE:
// intentionally falls through
[[fallthrough]];
case VPACK_MANAGED_BUFFER: {
VPackSlice s(slice());
if (s.isObject()) {
@ -512,11 +512,11 @@ AqlValue AqlValue::getToAttribute(bool& mustDestroy, bool doCopy) const {
switch (type()) {
case VPACK_SLICE_POINTER:
doCopy = false;
// intentionally falls through
[[fallthrough]];
case VPACK_INLINE:
// intentionally falls through
[[fallthrough]];
case VPACK_MANAGED_SLICE:
// intentionally falls through
[[fallthrough]];
case VPACK_MANAGED_BUFFER: {
VPackSlice s(slice());
if (s.isObject()) {
@ -551,11 +551,11 @@ AqlValue AqlValue::get(CollectionNameResolver const& resolver,
switch (type()) {
case VPACK_SLICE_POINTER:
doCopy = false;
// intentionally falls through
[[fallthrough]];
case VPACK_INLINE:
// intentionally falls through
[[fallthrough]];
case VPACK_MANAGED_SLICE:
// intentionally falls through
[[fallthrough]];
case VPACK_MANAGED_BUFFER: {
VPackSlice s(slice());
if (s.isObject()) {
@ -596,11 +596,11 @@ AqlValue AqlValue::get(CollectionNameResolver const& resolver,
switch (type()) {
case VPACK_SLICE_POINTER:
doCopy = false;
// intentionally falls through
[[fallthrough]];
case VPACK_INLINE:
// intentionally falls through
[[fallthrough]];
case VPACK_MANAGED_SLICE:
// intentionally falls through
[[fallthrough]];
case VPACK_MANAGED_BUFFER: {
VPackSlice s(slice());
if (s.isObject()) {
@ -645,11 +645,11 @@ AqlValue AqlValue::get(CollectionNameResolver const& resolver,
switch (type()) {
case VPACK_SLICE_POINTER:
doCopy = false;
// intentionally falls through
[[fallthrough]];
case VPACK_INLINE:
// intentionally falls through
[[fallthrough]];
case VPACK_MANAGED_SLICE:
// intentionally falls through
[[fallthrough]];
case VPACK_MANAGED_BUFFER: {
VPackSlice s(slice());
if (s.isObject()) {
@ -939,7 +939,7 @@ void AqlValue::toVelocyPack(transaction::Methods* trx, arangodb::velocypack::Bui
if (!resolveExternals && isManagedDocument()) {
builder.addExternal(_data.pointer);
break;
} // intentionally falls through
} [[fallthrough]];
case VPACK_INLINE:
case VPACK_MANAGED_SLICE:
case VPACK_MANAGED_BUFFER: {

View File

@ -439,7 +439,7 @@ AqlValue addOrSubtractUnitFromTimestamp(ExpressionContext* expressionContext,
break; // We are done
}
durationUnits *= 12;
// intentionally falls through
[[fallthrough]];
case MONTH:
durationUnits = std::modf(durationUnits, &intPart);
if (isSubtract) {
@ -451,7 +451,7 @@ AqlValue addOrSubtractUnitFromTimestamp(ExpressionContext* expressionContext,
break; // We are done
}
durationUnits *= 30; // 1 Month ~= 30 Days
// intentionally falls through
[[fallthrough]];
// After this fall through the date may actually a bit off
case DAY:
// From here on we do not need leap-day handling
@ -3648,7 +3648,7 @@ AqlValue Functions::DateCompare(ExpressionContext* expressionContext,
if (ymd1.year() != ymd2.year()) {
return AqlValue(AqlValueHintBool(false));
}
// intentionally falls through
[[fallthrough]];
case MONTH:
if (rangeEnd > MONTH) {
break;
@ -3656,7 +3656,7 @@ AqlValue Functions::DateCompare(ExpressionContext* expressionContext,
if (ymd1.month() != ymd2.month()) {
return AqlValue(AqlValueHintBool(false));
}
// intentionally falls through
[[fallthrough]];
case DAY:
if (rangeEnd > DAY) {
break;
@ -3664,7 +3664,7 @@ AqlValue Functions::DateCompare(ExpressionContext* expressionContext,
if (ymd1.day() != ymd2.day()) {
return AqlValue(AqlValueHintBool(false));
}
// intentionally falls through
[[fallthrough]];
case HOUR:
if (rangeEnd > HOUR) {
break;
@ -3672,7 +3672,7 @@ AqlValue Functions::DateCompare(ExpressionContext* expressionContext,
if (time1.hours() != time2.hours()) {
return AqlValue(AqlValueHintBool(false));
}
// intentionally falls through
[[fallthrough]];
case MINUTE:
if (rangeEnd > MINUTE) {
break;
@ -3680,7 +3680,7 @@ AqlValue Functions::DateCompare(ExpressionContext* expressionContext,
if (time1.minutes() != time2.minutes()) {
return AqlValue(AqlValueHintBool(false));
}
// intentionally falls through
[[fallthrough]];
case SECOND:
if (rangeEnd > SECOND) {
break;
@ -3688,7 +3688,7 @@ AqlValue Functions::DateCompare(ExpressionContext* expressionContext,
if (time1.seconds() != time2.seconds()) {
return AqlValue(AqlValueHintBool(false));
}
// intentionally falls through
[[fallthrough]];
case MILLI:
if (rangeEnd > MILLI) {
break;

View File

@ -5538,7 +5538,7 @@ struct RemoveRedundantOr {
}
// if hasRedundantConditionWalker(lhs) and
// hasRedundantConditionWalker(rhs), then one of the conditions in the OR
// statement is of the form x == x intentionally falls through
// statement is of the form x == x intentionally falls through if
} else if (type == NODE_TYPE_REFERENCE || type == NODE_TYPE_ATTRIBUTE_ACCESS ||
type == NODE_TYPE_INDEXED_ACCESS) {
// get a string representation of the node for comparisons

View File

@ -634,7 +634,7 @@ ExecutionState Query::execute(QueryRegistry* registry, QueryResult& queryResult)
_resultBuilder->openArray();
_executionPhase = ExecutionPhase::EXECUTE;
}
// intentionally falls through
[[fallthrough]];
case ExecutionPhase::EXECUTE: {
TRI_ASSERT(_resultBuilder != nullptr);
TRI_ASSERT(_resultBuilder->isOpenArray());
@ -713,7 +713,7 @@ ExecutionState Query::execute(QueryRegistry* registry, QueryResult& queryResult)
_executionPhase = ExecutionPhase::FINALIZE;
}
// intentionally falls through
[[fallthrough]];
case ExecutionPhase::FINALIZE: {
// will set warnings, stats, profile and cleanup plan and engine
return finalize(queryResult);

View File

@ -201,7 +201,7 @@ CommTask::Flow CommTask::prepareExecution(GeneralRequest& req) {
break; // continue with auth check
}
}
// intentionally falls through
[[fallthrough]];
case ServerState::Mode::TRYAGAIN: {
if (!::startsWith(path, "/_admin/shutdown") &&
!::startsWith(path, "/_admin/cluster/health") &&

View File

@ -181,7 +181,7 @@ inline bool canHandleValue(std::string const& key, VPackSlice const& value,
return true;
case VPackValueType::Custom:
TRI_ASSERT(key == arangodb::StaticStrings::IdString);
// intentionally falls through
[[fallthrough]];
case VPackValueType::String:
return !context._analyzers.empty();
default:
@ -556,7 +556,7 @@ bool FieldIterator::setAttributeValue(IResearchLinkMeta const& context) {
return true;
case VPackValueType::Custom:
TRI_ASSERT(nameBuffer() == arangodb::StaticStrings::IdString);
// intentionally falls through
[[fallthrough]];
case VPackValueType::String:
resetAnalyzers(context); // reset string analyzers
return setStringValue(value, *_begin);

View File

@ -2837,7 +2837,7 @@ LocalDocumentId MMFilesCollection::reuseOrCreateLocalDocumentId(OperationOptions
if (marker->hasLocalDocumentId()) {
return marker->getLocalDocumentId();
}
// falls through intentionally
// intentionally falls through
}
// new operation, no recovery -> generate a new LocalDocumentId

View File

@ -172,7 +172,7 @@ MMFilesSkiplistLookupBuilder::MMFilesSkiplistLookupBuilder(
} else {
_includeUpper = false;
}
// intentionally falls through
[[fallthrough]];
case arangodb::aql::NODE_TYPE_OPERATOR_BINARY_LE:
if (isReverseOrder) {
value->toVelocyPackValue(*(_lowerBuilder.get()));
@ -186,7 +186,7 @@ MMFilesSkiplistLookupBuilder::MMFilesSkiplistLookupBuilder(
} else {
_includeLower = false;
}
// intentionally falls through
[[fallthrough]];
case arangodb::aql::NODE_TYPE_OPERATOR_BINARY_GE:
if (isReverseOrder) {
value->toVelocyPackValue(*(_upperBuilder.get()));
@ -317,7 +317,7 @@ MMFilesSkiplistInLookupBuilder::MMFilesSkiplistInLookupBuilder(
} else {
_includeUpper = false;
}
// intentionally falls through
[[fallthrough]];
case arangodb::aql::NODE_TYPE_OPERATOR_BINARY_LE:
if (isReverseOrder) {
TRI_ASSERT(lower == nullptr);
@ -333,7 +333,7 @@ MMFilesSkiplistInLookupBuilder::MMFilesSkiplistInLookupBuilder(
} else {
_includeLower = false;
}
// intentionally falls through
[[fallthrough]];
case arangodb::aql::NODE_TYPE_OPERATOR_BINARY_GE:
if (isReverseOrder) {
TRI_ASSERT(upper == nullptr);
@ -1115,7 +1115,7 @@ bool MMFilesSkiplistIndex::findMatchingConditions(
if (first->getMember(1)->isArray()) {
usesIn = true;
}
// intentionally falls through
[[fallthrough]];
case arangodb::aql::NODE_TYPE_OPERATOR_BINARY_EQ:
TRI_ASSERT(conditions.size() == 1);
break;

View File

@ -1434,61 +1434,61 @@ uint64_t uint64_trusted(char const* value, size_t length) {
switch (length) {
case 20:
result += (value[length - 20] - '0') * 10000000000000000000ULL;
// intentionally falls through
[[fallthrough]];
case 19:
result += (value[length - 19] - '0') * 1000000000000000000ULL;
// intentionally falls through
[[fallthrough]];
case 18:
result += (value[length - 18] - '0') * 100000000000000000ULL;
// intentionally falls through
[[fallthrough]];
case 17:
result += (value[length - 17] - '0') * 10000000000000000ULL;
// intentionally falls through
[[fallthrough]];
case 16:
result += (value[length - 16] - '0') * 1000000000000000ULL;
// intentionally falls through
[[fallthrough]];
case 15:
result += (value[length - 15] - '0') * 100000000000000ULL;
// intentionally falls through
[[fallthrough]];
case 14:
result += (value[length - 14] - '0') * 10000000000000ULL;
// intentionally falls through
[[fallthrough]];
case 13:
result += (value[length - 13] - '0') * 1000000000000ULL;
// intentionally falls through
[[fallthrough]];
case 12:
result += (value[length - 12] - '0') * 100000000000ULL;
// intentionally falls through
[[fallthrough]];
case 11:
result += (value[length - 11] - '0') * 10000000000ULL;
// intentionally falls through
[[fallthrough]];
case 10:
result += (value[length - 10] - '0') * 1000000000ULL;
// intentionally falls through
[[fallthrough]];
case 9:
result += (value[length - 9] - '0') * 100000000ULL;
// intentionally falls through
[[fallthrough]];
case 8:
result += (value[length - 8] - '0') * 10000000ULL;
// intentionally falls through
[[fallthrough]];
case 7:
result += (value[length - 7] - '0') * 1000000ULL;
// intentionally falls through
[[fallthrough]];
case 6:
result += (value[length - 6] - '0') * 100000ULL;
// intentionally falls through
[[fallthrough]];
case 5:
result += (value[length - 5] - '0') * 10000ULL;
// intentionally falls through
[[fallthrough]];
case 4:
result += (value[length - 4] - '0') * 1000ULL;
// intentionally falls through
[[fallthrough]];
case 3:
result += (value[length - 3] - '0') * 100ULL;
// intentionally falls through
[[fallthrough]];
case 2:
result += (value[length - 2] - '0') * 10ULL;
// intentionally falls through
[[fallthrough]];
case 1:
result += (value[length - 1] - '0');
}

View File

@ -44,25 +44,25 @@ uint64_t fasthash64(const void* buf, size_t len, uint64_t seed) {
switch (len) {
case 8:
v ^= (uint64_t)pos[7] << 56;
// intentionally falls through
[[fallthrough]];
case 7:
v ^= (uint64_t)pos[6] << 48;
// intentionally falls through
[[fallthrough]];
case 6:
v ^= (uint64_t)pos[5] << 40;
// intentionally falls through
[[fallthrough]];
case 5:
v ^= (uint64_t)pos[4] << 32;
// intentionally falls through
[[fallthrough]];
case 4:
v ^= (uint64_t)pos[3] << 24;
// intentionally falls through
[[fallthrough]];
case 3:
v ^= (uint64_t)pos[2] << 16;
// intentionally falls through
[[fallthrough]];
case 2:
v ^= (uint64_t)pos[1] << 8;
// intentionally falls through
[[fallthrough]];
case 1:
v ^= (uint64_t)pos[0];
h ^= fasthash_mix(v);
@ -95,22 +95,22 @@ uint64_t fasthash64(const void* buf, size_t len, uint64_t seed) {
switch (len & 7) {
case 7:
v ^= (uint64_t)pos2[6] << 48;
// intentionally falls through
[[fallthrough]];
case 6:
v ^= (uint64_t)pos2[5] << 40;
// intentionally falls through
[[fallthrough]];
case 5:
v ^= (uint64_t)pos2[4] << 32;
// intentionally falls through
[[fallthrough]];
case 4:
v ^= (uint64_t)pos2[3] << 24;
// intentionally falls through
[[fallthrough]];
case 3:
v ^= (uint64_t)pos2[2] << 16;
// intentionally falls through
[[fallthrough]];
case 2:
v ^= (uint64_t)pos2[1] << 8;
// intentionally falls through
[[fallthrough]];
case 1:
v ^= (uint64_t)pos2[0];
h ^= fasthash_mix(v);