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; _nextReturn = 0;
_dataFetchedState = DATA_FETCH_ONGOING; _dataFetchedState = DATA_FETCH_ONGOING;
} }
// intentionally falls through [[fallthrough]];
case DATA_FETCH_ONGOING: { case DATA_FETCH_ONGOING: {
TRI_ASSERT(_nextReturn < _rowIndexes.size()); TRI_ASSERT(_nextReturn < _rowIndexes.size());
TRI_ASSERT(_aqlItemMatrix != nullptr); TRI_ASSERT(_aqlItemMatrix != nullptr);
@ -258,4 +258,4 @@ std::pair<ExecutionState, ShadowAqlItemRow> AllRowsFetcher::fetchShadowRow(size_
} }
return {state, row}; return {state, row};
} }

View File

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

View File

@ -295,7 +295,7 @@ AqlValue timeAqlValue(ExpressionContext* expressionContext,
year_month_day ymd{floor<days>(tp)}; year_month_day ymd{floor<days>(tp)};
auto day_time = make_time(tp - sys_days(ymd)); auto day_time = make_time(tp - sys_days(ymd));
auto y = static_cast<int>(ymd.year()); auto y = static_cast<int>(ymd.year());
// quick sanity check here for dates outside the allowed range // quick sanity check here for dates outside the allowed range
if (y < 0 || y > 9999) { if (y < 0 || y > 9999) {
@ -439,7 +439,7 @@ AqlValue addOrSubtractUnitFromTimestamp(ExpressionContext* expressionContext,
break; // We are done break; // We are done
} }
durationUnits *= 12; durationUnits *= 12;
// intentionally falls through [[fallthrough]];
case MONTH: case MONTH:
durationUnits = std::modf(durationUnits, &intPart); durationUnits = std::modf(durationUnits, &intPart);
if (isSubtract) { if (isSubtract) {
@ -451,7 +451,7 @@ AqlValue addOrSubtractUnitFromTimestamp(ExpressionContext* expressionContext,
break; // We are done break; // We are done
} }
durationUnits *= 30; // 1 Month ~= 30 Days durationUnits *= 30; // 1 Month ~= 30 Days
// intentionally falls through [[fallthrough]];
// After this fall through the date may actually a bit off // After this fall through the date may actually a bit off
case DAY: case DAY:
// From here on we do not need leap-day handling // From here on we do not need leap-day handling
@ -499,19 +499,19 @@ AqlValue addOrSubtractUnitFromTimestamp(ExpressionContext* expressionContext,
AqlValue addOrSubtractIsoDurationFromTimestamp(ExpressionContext* expressionContext, AqlValue addOrSubtractIsoDurationFromTimestamp(ExpressionContext* expressionContext,
tp_sys_clock_ms const& tp, tp_sys_clock_ms const& tp,
arangodb::velocypack::StringRef duration, arangodb::velocypack::StringRef duration,
char const* AFN, bool isSubtract) { char const* AFN, bool isSubtract) {
year_month_day ymd{floor<days>(tp)}; year_month_day ymd{floor<days>(tp)};
auto day_time = make_time(tp - sys_days(ymd)); auto day_time = make_time(tp - sys_days(ymd));
std::match_results<char const*> durationParts; std::match_results<char const*> durationParts;
if (!basics::regexIsoDuration(duration, durationParts)) { if (!basics::regexIsoDuration(duration, durationParts)) {
::registerWarning(expressionContext, AFN, TRI_ERROR_QUERY_INVALID_DATE_VALUE); ::registerWarning(expressionContext, AFN, TRI_ERROR_QUERY_INVALID_DATE_VALUE);
return AqlValue(AqlValueHintNull()); return AqlValue(AqlValueHintNull());
} }
char const* begin; char const* begin;
begin = duration.data() + durationParts.position(2); begin = duration.data() + durationParts.position(2);
int number = NumberUtils::atoi_unchecked<int>(begin, begin + durationParts.length(2)); int number = NumberUtils::atoi_unchecked<int>(begin, begin + durationParts.length(2));
if (isSubtract) { if (isSubtract) {
@ -2498,8 +2498,8 @@ void rtrimInternal(int32_t& startOffset, int32_t& endOffset, icu::UnicodeString&
if (unicodeStr.length() == 0) { if (unicodeStr.length() == 0) {
return; return;
} }
for (int32_t codePos = unicodeStr.moveIndex32(endOffset, -1); for (int32_t codePos = unicodeStr.moveIndex32(endOffset, -1);
startOffset <= codePos; startOffset <= codePos;
codePos = unicodeStr.moveIndex32(codePos, -1)) { codePos = unicodeStr.moveIndex32(codePos, -1)) {
bool found = false; bool found = false;
@ -3648,7 +3648,7 @@ AqlValue Functions::DateCompare(ExpressionContext* expressionContext,
if (ymd1.year() != ymd2.year()) { if (ymd1.year() != ymd2.year()) {
return AqlValue(AqlValueHintBool(false)); return AqlValue(AqlValueHintBool(false));
} }
// intentionally falls through [[fallthrough]];
case MONTH: case MONTH:
if (rangeEnd > MONTH) { if (rangeEnd > MONTH) {
break; break;
@ -3656,7 +3656,7 @@ AqlValue Functions::DateCompare(ExpressionContext* expressionContext,
if (ymd1.month() != ymd2.month()) { if (ymd1.month() != ymd2.month()) {
return AqlValue(AqlValueHintBool(false)); return AqlValue(AqlValueHintBool(false));
} }
// intentionally falls through [[fallthrough]];
case DAY: case DAY:
if (rangeEnd > DAY) { if (rangeEnd > DAY) {
break; break;
@ -3664,7 +3664,7 @@ AqlValue Functions::DateCompare(ExpressionContext* expressionContext,
if (ymd1.day() != ymd2.day()) { if (ymd1.day() != ymd2.day()) {
return AqlValue(AqlValueHintBool(false)); return AqlValue(AqlValueHintBool(false));
} }
// intentionally falls through [[fallthrough]];
case HOUR: case HOUR:
if (rangeEnd > HOUR) { if (rangeEnd > HOUR) {
break; break;
@ -3672,7 +3672,7 @@ AqlValue Functions::DateCompare(ExpressionContext* expressionContext,
if (time1.hours() != time2.hours()) { if (time1.hours() != time2.hours()) {
return AqlValue(AqlValueHintBool(false)); return AqlValue(AqlValueHintBool(false));
} }
// intentionally falls through [[fallthrough]];
case MINUTE: case MINUTE:
if (rangeEnd > MINUTE) { if (rangeEnd > MINUTE) {
break; break;
@ -3680,7 +3680,7 @@ AqlValue Functions::DateCompare(ExpressionContext* expressionContext,
if (time1.minutes() != time2.minutes()) { if (time1.minutes() != time2.minutes()) {
return AqlValue(AqlValueHintBool(false)); return AqlValue(AqlValueHintBool(false));
} }
// intentionally falls through [[fallthrough]];
case SECOND: case SECOND:
if (rangeEnd > SECOND) { if (rangeEnd > SECOND) {
break; break;
@ -3688,7 +3688,7 @@ AqlValue Functions::DateCompare(ExpressionContext* expressionContext,
if (time1.seconds() != time2.seconds()) { if (time1.seconds() != time2.seconds()) {
return AqlValue(AqlValueHintBool(false)); return AqlValue(AqlValueHintBool(false));
} }
// intentionally falls through [[fallthrough]];
case MILLI: case MILLI:
if (rangeEnd > MILLI) { if (rangeEnd > MILLI) {
break; break;
@ -3730,15 +3730,15 @@ AqlValue Functions::DateRound(ExpressionContext* expressionContext,
::registerInvalidArgumentWarning(expressionContext, AFN); ::registerInvalidArgumentWarning(expressionContext, AFN);
return AqlValue(AqlValueHintNull()); return AqlValue(AqlValueHintNull());
} }
int64_t const m = durationUnit.toInt64(); int64_t const m = durationUnit.toInt64();
if (m <= 0) { if (m <= 0) {
::registerInvalidArgumentWarning(expressionContext, AFN); ::registerInvalidArgumentWarning(expressionContext, AFN);
return AqlValue(AqlValueHintNull()); return AqlValue(AqlValueHintNull());
} }
velocypack::StringRef s = durationType.slice().stringRef(); velocypack::StringRef s = durationType.slice().stringRef();
int64_t factor = 1; int64_t factor = 1;
if (s == "milliseconds" || s == "millisecond" || s == "f") { if (s == "milliseconds" || s == "millisecond" || s == "f") {
factor = 1; factor = 1;
@ -3755,8 +3755,8 @@ AqlValue Functions::DateRound(ExpressionContext* expressionContext,
return AqlValue(AqlValueHintNull()); return AqlValue(AqlValueHintNull());
} }
int64_t const multiplier = factor * m; int64_t const multiplier = factor * m;
duration<int64_t, std::milli> time = tp.time_since_epoch(); duration<int64_t, std::milli> time = tp.time_since_epoch();
int64_t t = time.count(); int64_t t = time.count();
// integer division! // integer division!
@ -4186,7 +4186,7 @@ AqlValue Functions::Sleep(ExpressionContext* expressionContext,
} }
auto& server = application_features::ApplicationServer::server(); auto& server = application_features::ApplicationServer::server();
double const sleepValue = value.toDouble(); double const sleepValue = value.toDouble();
auto now = std::chrono::steady_clock::now(); auto now = std::chrono::steady_clock::now();
auto const endTime = now + std::chrono::milliseconds(static_cast<int64_t>(sleepValue * 1000.0)); auto const endTime = now + std::chrono::milliseconds(static_cast<int64_t>(sleepValue * 1000.0));
@ -4443,7 +4443,7 @@ AqlValue Functions::Unique(ExpressionContext* expressionContext, transaction::Me
std::unordered_set<VPackSlice, arangodb::basics::VelocyPackHelper::VPackHash, arangodb::basics::VelocyPackHelper::VPackEqual> std::unordered_set<VPackSlice, arangodb::basics::VelocyPackHelper::VPackHash, arangodb::basics::VelocyPackHelper::VPackEqual>
values(512, arangodb::basics::VelocyPackHelper::VPackHash(), values(512, arangodb::basics::VelocyPackHelper::VPackHash(),
arangodb::basics::VelocyPackHelper::VPackEqual(options)); arangodb::basics::VelocyPackHelper::VPackEqual(options));
transaction::BuilderLeaser builder(trx); transaction::BuilderLeaser builder(trx);
builder->openArray(); builder->openArray();
@ -4458,7 +4458,7 @@ AqlValue Functions::Unique(ExpressionContext* expressionContext, transaction::Me
builder->add(s); builder->add(s);
} }
} }
builder->close(); builder->close();
return AqlValue(builder.get()); return AqlValue(builder.get());
} }
@ -4845,7 +4845,7 @@ AqlValue Functions::GeoDistance(ExpressionContext* expressionContext,
::registerWarning(expressionContext, "GEO_DISTANCE", res); ::registerWarning(expressionContext, "GEO_DISTANCE", res);
return AqlValue(AqlValueHintNull()); return AqlValue(AqlValueHintNull());
} }
if (parameters.size() > 2 && parameters[2].isString()) { if (parameters.size() > 2 && parameters[2].isString()) {
VPackValueLength len; VPackValueLength len;
const char* ptr = parameters[2].slice().getStringUnchecked(len); const char* ptr = parameters[2].slice().getStringUnchecked(len);
@ -4911,17 +4911,17 @@ AqlValue Functions::GeoArea(ExpressionContext* expressionContext,
VPackFunctionParameters const& parameters) { VPackFunctionParameters const& parameters) {
AqlValue p1 = extractFunctionParameterValue(parameters, 0); AqlValue p1 = extractFunctionParameterValue(parameters, 0);
AqlValue p2 = extractFunctionParameterValue(parameters, 1); AqlValue p2 = extractFunctionParameterValue(parameters, 1);
AqlValueMaterializer mat(trx); AqlValueMaterializer mat(trx);
geo::ShapeContainer shape; geo::ShapeContainer shape;
Result res = geo::geojson::parseRegion(mat.slice(p1, true), shape); Result res = geo::geojson::parseRegion(mat.slice(p1, true), shape);
if (res.fail()) { if (res.fail()) {
::registerWarning(expressionContext, "GEO_AREA", res); ::registerWarning(expressionContext, "GEO_AREA", res);
return AqlValue(AqlValueHintNull()); return AqlValue(AqlValueHintNull());
} }
auto detEllipsoid = [](AqlValue const& p) { auto detEllipsoid = [](AqlValue const& p) {
if (p.isString()) { if (p.isString()) {
VPackValueLength len; VPackValueLength len;
@ -7038,7 +7038,7 @@ AqlValue Functions::DecodeRev(ExpressionContext* expressionContext,
VPackValueLength l; VPackValueLength l;
char const* p = rev.slice().getString(l); char const* p = rev.slice().getString(l);
uint64_t revInt = arangodb::basics::HybridLogicalClock::decodeTimeStamp(p, l); uint64_t revInt = arangodb::basics::HybridLogicalClock::decodeTimeStamp(p, l);
if (revInt == 0 || revInt == UINT64_MAX) { if (revInt == 0 || revInt == UINT64_MAX) {
::registerInvalidArgumentWarning(expressionContext, "DECODE_REV"); ::registerInvalidArgumentWarning(expressionContext, "DECODE_REV");
return AqlValue(AqlValueHintNull()); return AqlValue(AqlValueHintNull());
@ -7050,7 +7050,7 @@ AqlValue Functions::DecodeRev(ExpressionContext* expressionContext,
uint64_t millis = timeMilli % 1000; uint64_t millis = timeMilli % 1000;
struct tm date; struct tm date;
TRI_gmtime(timeSeconds, &date); TRI_gmtime(timeSeconds, &date);
char buffer[32]; char buffer[32];
strftime(buffer, 32, "%Y-%m-%dT%H:%M:%S.000Z", &date); strftime(buffer, 32, "%Y-%m-%dT%H:%M:%S.000Z", &date);
// fill millisecond part not covered by strftime // fill millisecond part not covered by strftime

View File

@ -980,7 +980,7 @@ void arangodb::aql::sortInValuesRule(Optimizer* opt, std::unique_ptr<ExecutionPl
auto outVar = ast->variables()->createTemporaryVariable(); auto outVar = ast->variables()->createTemporaryVariable();
auto expression = std::make_unique<Expression>(plan.get(), ast, sorted); auto expression = std::make_unique<Expression>(plan.get(), ast, sorted);
ExecutionNode* calculationNode = ExecutionNode* calculationNode =
new CalculationNode(plan.get(), plan->nextId(), std::move(expression), outVar); new CalculationNode(plan.get(), plan->nextId(), std::move(expression), outVar);
plan->registerNode(calculationNode); plan->registerNode(calculationNode);
@ -1752,7 +1752,7 @@ void arangodb::aql::moveCalculationsDownRule(Optimizer* opt,
} }
lastNode = current; lastNode = current;
} else if (currentType == EN::INDEX || currentType == EN::ENUMERATE_COLLECTION || } else if (currentType == EN::INDEX || currentType == EN::ENUMERATE_COLLECTION ||
currentType == EN::ENUMERATE_IRESEARCH_VIEW || currentType == EN::ENUMERATE_IRESEARCH_VIEW ||
currentType == EN::ENUMERATE_LIST || currentType == EN::TRAVERSAL || currentType == EN::ENUMERATE_LIST || currentType == EN::TRAVERSAL ||
@ -4564,9 +4564,9 @@ void arangodb::aql::distributeSortToClusterRule(Optimizer* opt,
break; break;
} }
// late-materialization should be set only after sort nodes are distributed // late-materialization should be set only after sort nodes are distributed
// in cluster as it accounts this disctribution. So we should not encounter this // in cluster as it accounts this disctribution. So we should not encounter this
// kind of nodes for now // kind of nodes for now
case EN::MATERIALIZE: case EN::MATERIALIZE:
case EN::SUBQUERY_START: case EN::SUBQUERY_START:
case EN::SUBQUERY_END: case EN::SUBQUERY_END:
case EN::DISTRIBUTE_CONSUMER: case EN::DISTRIBUTE_CONSUMER:
@ -5538,7 +5538,7 @@ struct RemoveRedundantOr {
} }
// if hasRedundantConditionWalker(lhs) and // if hasRedundantConditionWalker(lhs) and
// hasRedundantConditionWalker(rhs), then one of the conditions in the OR // 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 || } else if (type == NODE_TYPE_REFERENCE || type == NODE_TYPE_ATTRIBUTE_ACCESS ||
type == NODE_TYPE_INDEXED_ACCESS) { type == NODE_TYPE_INDEXED_ACCESS) {
// get a string representation of the node for comparisons // get a string representation of the node for comparisons
@ -7183,7 +7183,7 @@ void arangodb::aql::moveFiltersIntoEnumerateRule(Optimizer* opt, std::unique_ptr
} }
Variable const* outVariable = en->outVariable(); Variable const* outVariable = en->outVariable();
if (!n->isVarUsedLater(outVariable)) { if (!n->isVarUsedLater(outVariable)) {
// e.g. FOR doc IN collection RETURN 1 // e.g. FOR doc IN collection RETURN 1
continue; continue;
@ -7197,14 +7197,14 @@ void arangodb::aql::moveFiltersIntoEnumerateRule(Optimizer* opt, std::unique_ptr
if (current->getType() != EN::FILTER && current->getType() != EN::CALCULATION) { if (current->getType() != EN::FILTER && current->getType() != EN::CALCULATION) {
break; break;
} }
if (current->getType() == EN::FILTER) { if (current->getType() == EN::FILTER) {
if (calculations.empty()) { if (calculations.empty()) {
break; break;
} }
auto filterNode = ExecutionNode::castTo<FilterNode*>(current); auto filterNode = ExecutionNode::castTo<FilterNode*>(current);
Variable const* inVariable = filterNode->inVariable(); Variable const* inVariable = filterNode->inVariable();
auto it = calculations.find(inVariable); auto it = calculations.find(inVariable);
if (it == calculations.end()) { if (it == calculations.end()) {
break; break;
@ -7217,7 +7217,7 @@ void arangodb::aql::moveFiltersIntoEnumerateRule(Optimizer* opt, std::unique_ptr
// node already has a filter, now AND-merge it with what we found! // node already has a filter, now AND-merge it with what we found!
AstNode* merged = plan->getAst()->createNodeBinaryOperator( AstNode* merged = plan->getAst()->createNodeBinaryOperator(
NODE_TYPE_OPERATOR_BINARY_AND, existingFilter->node(), expr->node()); NODE_TYPE_OPERATOR_BINARY_AND, existingFilter->node(), expr->node());
en->setFilter(std::make_unique<Expression>(plan.get(), plan->getAst(), merged)); en->setFilter(std::make_unique<Expression>(plan.get(), plan->getAst(), merged));
} else { } else {
// node did not yet have a filter // node did not yet have a filter
@ -7248,11 +7248,11 @@ void arangodb::aql::moveFiltersIntoEnumerateRule(Optimizer* opt, std::unique_ptr
found.clear(); found.clear();
Ast::getReferencedVariables(expr->node(), found); Ast::getReferencedVariables(expr->node(), found);
if (found.size() == 1 && if (found.size() == 1 &&
found.find(outVariable) != found.end()) { found.find(outVariable) != found.end()) {
calculations.emplace(calculationNode->outVariable(), calculationNode); calculations.emplace(calculationNode->outVariable(), calculationNode);
} }
} }
current = current->getFirstParent(); current = current->getFirstParent();
} }

View File

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

View File

@ -201,7 +201,7 @@ CommTask::Flow CommTask::prepareExecution(GeneralRequest& req) {
break; // continue with auth check break; // continue with auth check
} }
} }
// intentionally falls through [[fallthrough]];
case ServerState::Mode::TRYAGAIN: { case ServerState::Mode::TRYAGAIN: {
if (!::startsWith(path, "/_admin/shutdown") && if (!::startsWith(path, "/_admin/shutdown") &&
!::startsWith(path, "/_admin/cluster/health") && !::startsWith(path, "/_admin/cluster/health") &&
@ -305,7 +305,7 @@ void CommTask::executeRequest(std::unique_ptr<GeneralRequest> request,
bool found; bool found;
// check for an async request (before the handler steals the request) // check for an async request (before the handler steals the request)
std::string const& asyncExec = request->header(StaticStrings::Async, found); std::string const& asyncExec = request->header(StaticStrings::Async, found);
// store the message id for error handling // store the message id for error handling
uint64_t messageId = 0UL; uint64_t messageId = 0UL;
if (request) { if (request) {
@ -476,7 +476,7 @@ void CommTask::addErrorResponse(rest::ResponseCode code, rest::ContentType respT
bool CommTask::handleRequestSync(std::shared_ptr<RestHandler> handler) { bool CommTask::handleRequestSync(std::shared_ptr<RestHandler> handler) {
RequestStatistics::SET_QUEUE_START(handler->statistics(), SchedulerFeature::SCHEDULER->queueStatistics()._queued); RequestStatistics::SET_QUEUE_START(handler->statistics(), SchedulerFeature::SCHEDULER->queueStatistics()._queued);
RequestLane lane = handler->getRequestLane(); RequestLane lane = handler->getRequestLane();
ContentType respType = handler->request()->contentTypeResponse(); ContentType respType = handler->request()->contentTypeResponse();
uint64_t mid = handler->messageId(); uint64_t mid = handler->messageId();

View File

@ -85,11 +85,11 @@ int HttpCommTask<T>::on_message_began(llhttp_t* p) {
self->_lastHeaderWasValue = false; self->_lastHeaderWasValue = false;
self->_shouldKeepAlive = false; self->_shouldKeepAlive = false;
self->_messageDone = false; self->_messageDone = false;
// acquire a new statistics entry for the request // acquire a new statistics entry for the request
RequestStatistics* stat = self->acquireStatistics(1UL); RequestStatistics* stat = self->acquireStatistics(1UL);
RequestStatistics::SET_READ_START(stat, TRI_microtime()); RequestStatistics::SET_READ_START(stat, TRI_microtime());
return HPE_OK; return HPE_OK;
} }
@ -103,10 +103,10 @@ int HttpCommTask<T>::on_url(llhttp_t* p, const char* at, size_t len) {
rest::ContentType::UNSET, 1, VPackBuffer<uint8_t>()); rest::ContentType::UNSET, 1, VPackBuffer<uint8_t>());
return HPE_USER; return HPE_USER;
} }
RequestStatistics* stat = self->statistics(1UL); RequestStatistics* stat = self->statistics(1UL);
RequestStatistics::SET_REQUEST_TYPE(stat, self->_request->requestType()); RequestStatistics::SET_REQUEST_TYPE(stat, self->_request->requestType());
return HPE_OK; return HPE_OK;
} }
@ -201,12 +201,12 @@ int HttpCommTask<T>::on_body(llhttp_t* p, const char* at, size_t len) {
template <SocketType T> template <SocketType T>
int HttpCommTask<T>::on_message_complete(llhttp_t* p) { int HttpCommTask<T>::on_message_complete(llhttp_t* p) {
HttpCommTask<T>* self = static_cast<HttpCommTask<T>*>(p->data); HttpCommTask<T>* self = static_cast<HttpCommTask<T>*>(p->data);
RequestStatistics* stat = self->statistics(1UL); RequestStatistics* stat = self->statistics(1UL);
RequestStatistics::SET_READ_END(stat); RequestStatistics::SET_READ_END(stat);
RequestStatistics::ADD_RECEIVED_BYTES(stat, self->_request->body().size()); RequestStatistics::ADD_RECEIVED_BYTES(stat, self->_request->body().size());
self->_messageDone = true; self->_messageDone = true;
return HPE_PAUSED; return HPE_PAUSED;
} }
@ -279,11 +279,11 @@ bool HttpCommTask<T>::readCallback(asio_ns::error_code ec) {
err = HPE_INVALID_EOF_STATE; err = HPE_INVALID_EOF_STATE;
} }
} else { // Inspect the received data } else { // Inspect the received data
size_t parsedBytes = 0; size_t parsedBytes = 0;
for (auto const& buffer : this->_protocol->buffer.data()) { for (auto const& buffer : this->_protocol->buffer.data()) {
const char* data = reinterpret_cast<const char*>(buffer.data()); const char* data = reinterpret_cast<const char*>(buffer.data());
err = llhttp_execute(&_parser, data, buffer.size()); err = llhttp_execute(&_parser, data, buffer.size());
if (err != HPE_OK) { if (err != HPE_OK) {
parsedBytes += llhttp_get_error_pos(&_parser) - data; parsedBytes += llhttp_get_error_pos(&_parser) - data;
@ -291,18 +291,18 @@ bool HttpCommTask<T>::readCallback(asio_ns::error_code ec) {
} }
parsedBytes += buffer.size(); parsedBytes += buffer.size();
} }
TRI_ASSERT(parsedBytes < std::numeric_limits<size_t>::max()); TRI_ASSERT(parsedBytes < std::numeric_limits<size_t>::max());
// Remove consumed data from receive buffer. // Remove consumed data from receive buffer.
this->_protocol->buffer.consume(parsedBytes); this->_protocol->buffer.consume(parsedBytes);
if (err == HPE_PAUSED_UPGRADE) { if (err == HPE_PAUSED_UPGRADE) {
this->addSimpleResponse(rest::ResponseCode::NOT_IMPLEMENTED, this->addSimpleResponse(rest::ResponseCode::NOT_IMPLEMENTED,
rest::ContentType::UNSET, 1, VPackBuffer<uint8_t>()); rest::ContentType::UNSET, 1, VPackBuffer<uint8_t>());
return false; // stop read loop return false; // stop read loop
} }
} }
if (_messageDone) { if (_messageDone) {
TRI_ASSERT(err == HPE_PAUSED); TRI_ASSERT(err == HPE_PAUSED);
_messageDone = false; _messageDone = false;
@ -339,10 +339,10 @@ void HttpCommTask<T>::checkVSTPrefix() {
return; return;
} }
thisPtr->_protocol->buffer.commit(nread); thisPtr->_protocol->buffer.commit(nread);
auto bg = asio_ns::buffers_begin(thisPtr->_protocol->buffer.data()); auto bg = asio_ns::buffers_begin(thisPtr->_protocol->buffer.data());
if (std::equal(::vst10, ::vst10 + 11, bg, bg + 11)) { if (std::equal(::vst10, ::vst10 + 11, bg, bg + 11)) {
thisPtr->_protocol->buffer.consume(11); // remove VST/1.0 prefix thisPtr->_protocol->buffer.consume(11); // remove VST/1.0 prefix
auto commTask = auto commTask =
std::make_unique<VstCommTask<T>>(thisPtr->_server, thisPtr->_connectionInfo, std::make_unique<VstCommTask<T>>(thisPtr->_server, thisPtr->_connectionInfo,
@ -350,9 +350,9 @@ void HttpCommTask<T>::checkVSTPrefix() {
fuerte::vst::VST1_0); fuerte::vst::VST1_0);
thisPtr->_server.registerTask(std::move(commTask)); thisPtr->_server.registerTask(std::move(commTask));
return; // vst 1.0 return; // vst 1.0
} else if (std::equal(::vst11, ::vst11 + 11, bg, bg + 11)) { } else if (std::equal(::vst11, ::vst11 + 11, bg, bg + 11)) {
thisPtr->_protocol->buffer.consume(11); // remove VST/1.1 prefix thisPtr->_protocol->buffer.consume(11); // remove VST/1.1 prefix
auto commTask = auto commTask =
std::make_unique<VstCommTask<T>>(thisPtr->_server, thisPtr->_connectionInfo, std::make_unique<VstCommTask<T>>(thisPtr->_server, thisPtr->_connectionInfo,
@ -361,7 +361,7 @@ void HttpCommTask<T>::checkVSTPrefix() {
thisPtr->_server.registerTask(std::move(commTask)); thisPtr->_server.registerTask(std::move(commTask));
return; // vst 1.1 return; // vst 1.1
} }
thisPtr->asyncReadSome(); // continue reading thisPtr->asyncReadSome(); // continue reading
}; };
auto buffs = this->_protocol->buffer.prepare(GeneralCommTask<T>::ReadBlockSize); auto buffs = this->_protocol->buffer.prepare(GeneralCommTask<T>::ReadBlockSize);
@ -378,13 +378,13 @@ bool HttpCommTask<T>::checkHttpUpgrade() {
template <SocketType T> template <SocketType T>
void HttpCommTask<T>::processRequest() { void HttpCommTask<T>::processRequest() {
TRI_ASSERT(_request); TRI_ASSERT(_request);
// ensure there is a null byte termination. RestHandlers use // ensure there is a null byte termination. RestHandlers use
// C functions like strchr that except a C string as input // C functions like strchr that except a C string as input
_request->body().push_back('\0'); _request->body().push_back('\0');
_request->body().resetTo(_request->body().size() - 1); _request->body().resetTo(_request->body().size() - 1);
this->_protocol->timer.cancel(); this->_protocol->timer.cancel();
{ {
LOG_TOPIC("6e770", DEBUG, Logger::REQUESTS) LOG_TOPIC("6e770", DEBUG, Logger::REQUESTS)
<< "\"http-request-begin\",\"" << (void*)this << "\",\"" << "\"http-request-begin\",\"" << (void*)this << "\",\""
@ -452,12 +452,12 @@ bool allowCredentials(std::string const& origin) {
if (origin.empty()) { if (origin.empty()) {
return allowCredentials; return allowCredentials;
} // else handle origin headers } // else handle origin headers
// if the request asks to allow credentials, we'll check against the // if the request asks to allow credentials, we'll check against the
// configured whitelist of origins // configured whitelist of origins
std::vector<std::string> const& accessControlAllowOrigins = std::vector<std::string> const& accessControlAllowOrigins =
GeneralServerFeature::accessControlAllowOrigins(); GeneralServerFeature::accessControlAllowOrigins();
if (!accessControlAllowOrigins.empty()) { if (!accessControlAllowOrigins.empty()) {
if (accessControlAllowOrigins[0] == "*") { if (accessControlAllowOrigins[0] == "*") {
// special case: allow everything // special case: allow everything
@ -642,20 +642,20 @@ void HttpCommTask<T>::sendResponse(std::unique_ptr<GeneralResponse> baseRes,
// access-control-allow-origin header now // access-control-allow-origin header now
LOG_TOPIC("ae603", DEBUG, arangodb::Logger::REQUESTS) LOG_TOPIC("ae603", DEBUG, arangodb::Logger::REQUESTS)
<< "handling CORS response"; << "handling CORS response";
// send back original value of "Origin" header // send back original value of "Origin" header
response.setHeaderNCIfNotSet(StaticStrings::AccessControlAllowOrigin, _origin); response.setHeaderNCIfNotSet(StaticStrings::AccessControlAllowOrigin, _origin);
// send back "Access-Control-Allow-Credentials" header // send back "Access-Control-Allow-Credentials" header
response.setHeaderNCIfNotSet(StaticStrings::AccessControlAllowCredentials, response.setHeaderNCIfNotSet(StaticStrings::AccessControlAllowCredentials,
(::allowCredentials(_origin) ? "true" : "false")); (::allowCredentials(_origin) ? "true" : "false"));
// use "IfNotSet" here because we should not override HTTP headers set // use "IfNotSet" here because we should not override HTTP headers set
// by Foxx applications // by Foxx applications
response.setHeaderNCIfNotSet(StaticStrings::AccessControlExposeHeaders, response.setHeaderNCIfNotSet(StaticStrings::AccessControlExposeHeaders,
StaticStrings::ExposedCorsHeaders); StaticStrings::ExposedCorsHeaders);
} }
if (!ServerState::instance()->isDBServer()) { if (!ServerState::instance()->isDBServer()) {
// DB server is not user-facing, and does not need to set this header // DB server is not user-facing, and does not need to set this header
// use "IfNotSet" to not overwrite an existing response header // use "IfNotSet" to not overwrite an existing response header
@ -721,7 +721,7 @@ void HttpCommTask<T>::sendResponse(std::unique_ptr<GeneralResponse> baseRes,
if (!seenServerHeader && !HttpResponse::HIDE_PRODUCT_HEADER) { if (!seenServerHeader && !HttpResponse::HIDE_PRODUCT_HEADER) {
header->append(TRI_CHAR_LENGTH_PAIR("Server: ArangoDB\r\n")); header->append(TRI_CHAR_LENGTH_PAIR("Server: ArangoDB\r\n"));
} }
// turn on the keepAlive timer // turn on the keepAlive timer
double secs = GeneralServerFeature::keepAliveTimeout(); double secs = GeneralServerFeature::keepAliveTimeout();
if (_shouldKeepAlive && secs > 0) { if (_shouldKeepAlive && secs > 0) {
@ -737,7 +737,7 @@ void HttpCommTask<T>::sendResponse(std::unique_ptr<GeneralResponse> baseRes,
<< "keep alive timeout, closing stream!"; << "keep alive timeout, closing stream!";
s->close(); s->close();
}); });
header->append(TRI_CHAR_LENGTH_PAIR("Connection: Keep-Alive\r\n")); header->append(TRI_CHAR_LENGTH_PAIR("Connection: Keep-Alive\r\n"));
header->append(TRI_CHAR_LENGTH_PAIR("Keep-Alive: timeout=")); header->append(TRI_CHAR_LENGTH_PAIR("Keep-Alive: timeout="));
header->append(std::to_string(static_cast<int64_t>(secs))); header->append(std::to_string(static_cast<int64_t>(secs)));
@ -745,7 +745,7 @@ void HttpCommTask<T>::sendResponse(std::unique_ptr<GeneralResponse> baseRes,
} else { } else {
header->append(TRI_CHAR_LENGTH_PAIR("Connection: Close\r\n")); header->append(TRI_CHAR_LENGTH_PAIR("Connection: Close\r\n"));
} }
// add "Content-Type" header // add "Content-Type" header
switch (response.contentType()) { switch (response.contentType()) {
case ContentType::UNSET: case ContentType::UNSET:
@ -778,12 +778,12 @@ void HttpCommTask<T>::sendResponse(std::unique_ptr<GeneralResponse> baseRes,
header->append(it); header->append(it);
header->append("\r\n", 2); header->append("\r\n", 2);
} }
size_t len = response.bodySize(); size_t len = response.bodySize();
header->append(TRI_CHAR_LENGTH_PAIR("Content-Length: ")); header->append(TRI_CHAR_LENGTH_PAIR("Content-Length: "));
header->append(std::to_string(len)); header->append(std::to_string(len));
header->append("\r\n\r\n", 4); header->append("\r\n\r\n", 4);
std::unique_ptr<basics::StringBuffer> body = response.stealBody(); std::unique_ptr<basics::StringBuffer> body = response.stealBody();
// append write buffer and statistics // append write buffer and statistics
double const totalTime = RequestStatistics::ELAPSED_SINCE_READ_START(stat); double const totalTime = RequestStatistics::ELAPSED_SINCE_READ_START(stat);
@ -793,21 +793,21 @@ void HttpCommTask<T>::sendResponse(std::unique_ptr<GeneralResponse> baseRes,
<< "\"http-request-end\",\"" << (void*)this << "\",\"" << this->_connectionInfo.clientAddress << "\"http-request-end\",\"" << (void*)this << "\",\"" << this->_connectionInfo.clientAddress
<< "\",\"" << GeneralRequest::translateMethod(::llhttpToRequestType(&_parser)) << "\",\"" << "\",\"" << GeneralRequest::translateMethod(::llhttpToRequestType(&_parser)) << "\",\""
<< static_cast<int>(response.responseCode()) << "\"," << Logger::FIXED(totalTime, 6); << static_cast<int>(response.responseCode()) << "\"," << Logger::FIXED(totalTime, 6);
std::array<asio_ns::const_buffer, 2> buffers; std::array<asio_ns::const_buffer, 2> buffers;
buffers[0] = asio_ns::buffer(header->data(), header->size()); buffers[0] = asio_ns::buffer(header->data(), header->size());
if (HTTP_HEAD != _parser.method) { if (HTTP_HEAD != _parser.method) {
buffers[1] = asio_ns::buffer(body->data(), body->size()); buffers[1] = asio_ns::buffer(body->data(), body->size());
TRI_ASSERT(len == body->size()); TRI_ASSERT(len == body->size());
} }
// FIXME measure performance w/o sync write // FIXME measure performance w/o sync write
auto cb = [self = CommTask::shared_from_this(), auto cb = [self = CommTask::shared_from_this(),
h = std::move(header), h = std::move(header),
b = std::move(body)](asio_ns::error_code ec, b = std::move(body)](asio_ns::error_code ec,
size_t nwrite) { size_t nwrite) {
auto* thisPtr = static_cast<HttpCommTask<T>*>(self.get()); auto* thisPtr = static_cast<HttpCommTask<T>*>(self.get());
llhttp_errno_t err = llhttp_get_errno(&thisPtr->_parser); llhttp_errno_t err = llhttp_get_errno(&thisPtr->_parser);
if (ec || !thisPtr->_shouldKeepAlive || err != HPE_PAUSED) { if (ec || !thisPtr->_shouldKeepAlive || err != HPE_PAUSED) {
if (ec) { if (ec) {

View File

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

View File

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

View File

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

View File

@ -1902,8 +1902,8 @@ void RestReplicationHandler::handleCommandRestoreView() {
if (view) { if (view) {
if (!overwrite) { if (!overwrite) {
generateError(GeneralResponse::responseCode(TRI_ERROR_ARANGO_DUPLICATE_NAME), generateError(GeneralResponse::responseCode(TRI_ERROR_ARANGO_DUPLICATE_NAME),
TRI_ERROR_ARANGO_DUPLICATE_NAME, TRI_ERROR_ARANGO_DUPLICATE_NAME,
std::string("unable to restore view '") + nameSlice.copyString() + ": " + std::string("unable to restore view '") + nameSlice.copyString() + ": " +
TRI_errno_string(TRI_ERROR_ARANGO_DUPLICATE_NAME)); TRI_errno_string(TRI_ERROR_ARANGO_DUPLICATE_NAME));
return; return;
} }

View File

@ -1005,7 +1005,7 @@ static void JS_GetResponsibleShardVocbaseCol(v8::FunctionCallbackInfo<v8::Value>
if (res != TRI_ERROR_NO_ERROR) { if (res != TRI_ERROR_NO_ERROR) {
TRI_V8_THROW_EXCEPTION(res); TRI_V8_THROW_EXCEPTION(res);
} }
} }
if (!builder.slice().isObject()) { if (!builder.slice().isObject()) {
TRI_V8_THROW_EXCEPTION_USAGE("getResponsibleShard(<object>)"); TRI_V8_THROW_EXCEPTION_USAGE("getResponsibleShard(<object>)");
} }

View File

@ -179,7 +179,7 @@ Result executeTransactionJS(v8::Isolate* isolate, v8::Handle<v8::Value> const& a
std::vector<std::string> exclusiveCollections; std::vector<std::string> exclusiveCollections;
if (TRI_HasProperty(context, isolate, collections, "allowImplicit")) { if (TRI_HasProperty(context, isolate, collections, "allowImplicit")) {
trxOptions.allowImplicitCollections = TRI_ObjectToBoolean(isolate, trxOptions.allowImplicitCollections = TRI_ObjectToBoolean(isolate,
collections->Get(TRI_V8_ASCII_STRING(isolate, "allowImplicit"))); collections->Get(TRI_V8_ASCII_STRING(isolate, "allowImplicit")));
} }
@ -203,7 +203,7 @@ Result executeTransactionJS(v8::Isolate* isolate, v8::Handle<v8::Value> const& a
collections.emplace_back(TRI_ObjectToString(isolate, collection)); collections.emplace_back(TRI_ObjectToString(isolate, collection));
} }
} else if (obj->Get(TRI_V8_ASCII_STRING(isolate, attributeName))->IsString()) { } else if (obj->Get(TRI_V8_ASCII_STRING(isolate, attributeName))->IsString()) {
collections.emplace_back(TRI_ObjectToString(isolate, collections.emplace_back(TRI_ObjectToString(isolate,
obj->Get(TRI_V8_ASCII_STRING(isolate, attributeName)))); obj->Get(TRI_V8_ASCII_STRING(isolate, attributeName))));
} else { } else {
collectionError += collectionError +=
@ -278,7 +278,7 @@ Result executeTransactionJS(v8::Isolate* isolate, v8::Handle<v8::Value> const& a
// Invoke Function constructor to create function with the given body and the // Invoke Function constructor to create function with the given body and the
// arguments // arguments
std::string body = TRI_ObjectToString(isolate, std::string body = TRI_ObjectToString(isolate,
TRI_GetProperty(context, isolate, object, "action")); TRI_GetProperty(context, isolate, object, "action"));
body = "return (" + body + ")(params);"; body = "return (" + body + ")(params);";
v8::Handle<v8::Value> args[2] = {TRI_V8_ASCII_STRING(isolate, "params"), v8::Handle<v8::Value> args[2] = {TRI_V8_ASCII_STRING(isolate, "params"),
@ -322,9 +322,9 @@ Result executeTransactionJS(v8::Isolate* isolate, v8::Handle<v8::Value> const& a
auto trx = std::make_unique<transaction::Methods>(ctx, readCollections, writeCollections, auto trx = std::make_unique<transaction::Methods>(ctx, readCollections, writeCollections,
exclusiveCollections, trxOptions); exclusiveCollections, trxOptions);
trx->addHint(transaction::Hints::Hint::GLOBAL_MANAGED); trx->addHint(transaction::Hints::Hint::GLOBAL_MANAGED);
rv = trx->begin(); rv = trx->begin();
if (rv.fail()) { if (rv.fail()) {
return rv; return rv;
} }
@ -357,7 +357,7 @@ Result executeTransactionJS(v8::Isolate* isolate, v8::Handle<v8::Value> const& a
} catch (...) { } catch (...) {
rv.reset(TRI_ERROR_INTERNAL, "caught unknown exception during transaction"); rv.reset(TRI_ERROR_INTERNAL, "caught unknown exception during transaction");
} }
rv = trx->finish(rv); rv = trx->finish(rv);
// if we do not remove unused V8Cursors, V8Context might not reset global // if we do not remove unused V8Cursors, V8Context might not reset global

View File

@ -855,7 +855,7 @@ std::string urlEncode(char const* src, size_t const len) {
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
char const* end = src + len; char const* end = src + len;
// cppcheck-suppress unsignedPositive // cppcheck-suppress unsignedPositive
if (len >= (SIZE_MAX - 1) / 3) { if (len >= (SIZE_MAX - 1) / 3) {
THROW_ARANGO_EXCEPTION(TRI_ERROR_OUT_OF_MEMORY); THROW_ARANGO_EXCEPTION(TRI_ERROR_OUT_OF_MEMORY);
@ -1434,61 +1434,61 @@ uint64_t uint64_trusted(char const* value, size_t length) {
switch (length) { switch (length) {
case 20: case 20:
result += (value[length - 20] - '0') * 10000000000000000000ULL; result += (value[length - 20] - '0') * 10000000000000000000ULL;
// intentionally falls through [[fallthrough]];
case 19: case 19:
result += (value[length - 19] - '0') * 1000000000000000000ULL; result += (value[length - 19] - '0') * 1000000000000000000ULL;
// intentionally falls through [[fallthrough]];
case 18: case 18:
result += (value[length - 18] - '0') * 100000000000000000ULL; result += (value[length - 18] - '0') * 100000000000000000ULL;
// intentionally falls through [[fallthrough]];
case 17: case 17:
result += (value[length - 17] - '0') * 10000000000000000ULL; result += (value[length - 17] - '0') * 10000000000000000ULL;
// intentionally falls through [[fallthrough]];
case 16: case 16:
result += (value[length - 16] - '0') * 1000000000000000ULL; result += (value[length - 16] - '0') * 1000000000000000ULL;
// intentionally falls through [[fallthrough]];
case 15: case 15:
result += (value[length - 15] - '0') * 100000000000000ULL; result += (value[length - 15] - '0') * 100000000000000ULL;
// intentionally falls through [[fallthrough]];
case 14: case 14:
result += (value[length - 14] - '0') * 10000000000000ULL; result += (value[length - 14] - '0') * 10000000000000ULL;
// intentionally falls through [[fallthrough]];
case 13: case 13:
result += (value[length - 13] - '0') * 1000000000000ULL; result += (value[length - 13] - '0') * 1000000000000ULL;
// intentionally falls through [[fallthrough]];
case 12: case 12:
result += (value[length - 12] - '0') * 100000000000ULL; result += (value[length - 12] - '0') * 100000000000ULL;
// intentionally falls through [[fallthrough]];
case 11: case 11:
result += (value[length - 11] - '0') * 10000000000ULL; result += (value[length - 11] - '0') * 10000000000ULL;
// intentionally falls through [[fallthrough]];
case 10: case 10:
result += (value[length - 10] - '0') * 1000000000ULL; result += (value[length - 10] - '0') * 1000000000ULL;
// intentionally falls through [[fallthrough]];
case 9: case 9:
result += (value[length - 9] - '0') * 100000000ULL; result += (value[length - 9] - '0') * 100000000ULL;
// intentionally falls through [[fallthrough]];
case 8: case 8:
result += (value[length - 8] - '0') * 10000000ULL; result += (value[length - 8] - '0') * 10000000ULL;
// intentionally falls through [[fallthrough]];
case 7: case 7:
result += (value[length - 7] - '0') * 1000000ULL; result += (value[length - 7] - '0') * 1000000ULL;
// intentionally falls through [[fallthrough]];
case 6: case 6:
result += (value[length - 6] - '0') * 100000ULL; result += (value[length - 6] - '0') * 100000ULL;
// intentionally falls through [[fallthrough]];
case 5: case 5:
result += (value[length - 5] - '0') * 10000ULL; result += (value[length - 5] - '0') * 10000ULL;
// intentionally falls through [[fallthrough]];
case 4: case 4:
result += (value[length - 4] - '0') * 1000ULL; result += (value[length - 4] - '0') * 1000ULL;
// intentionally falls through [[fallthrough]];
case 3: case 3:
result += (value[length - 3] - '0') * 100ULL; result += (value[length - 3] - '0') * 100ULL;
// intentionally falls through [[fallthrough]];
case 2: case 2:
result += (value[length - 2] - '0') * 10ULL; result += (value[length - 2] - '0') * 10ULL;
// intentionally falls through [[fallthrough]];
case 1: case 1:
result += (value[length - 1] - '0'); 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) { switch (len) {
case 8: case 8:
v ^= (uint64_t)pos[7] << 56; v ^= (uint64_t)pos[7] << 56;
// intentionally falls through [[fallthrough]];
case 7: case 7:
v ^= (uint64_t)pos[6] << 48; v ^= (uint64_t)pos[6] << 48;
// intentionally falls through [[fallthrough]];
case 6: case 6:
v ^= (uint64_t)pos[5] << 40; v ^= (uint64_t)pos[5] << 40;
// intentionally falls through [[fallthrough]];
case 5: case 5:
v ^= (uint64_t)pos[4] << 32; v ^= (uint64_t)pos[4] << 32;
// intentionally falls through [[fallthrough]];
case 4: case 4:
v ^= (uint64_t)pos[3] << 24; v ^= (uint64_t)pos[3] << 24;
// intentionally falls through [[fallthrough]];
case 3: case 3:
v ^= (uint64_t)pos[2] << 16; v ^= (uint64_t)pos[2] << 16;
// intentionally falls through [[fallthrough]];
case 2: case 2:
v ^= (uint64_t)pos[1] << 8; v ^= (uint64_t)pos[1] << 8;
// intentionally falls through [[fallthrough]];
case 1: case 1:
v ^= (uint64_t)pos[0]; v ^= (uint64_t)pos[0];
h ^= fasthash_mix(v); h ^= fasthash_mix(v);
@ -95,22 +95,22 @@ uint64_t fasthash64(const void* buf, size_t len, uint64_t seed) {
switch (len & 7) { switch (len & 7) {
case 7: case 7:
v ^= (uint64_t)pos2[6] << 48; v ^= (uint64_t)pos2[6] << 48;
// intentionally falls through [[fallthrough]];
case 6: case 6:
v ^= (uint64_t)pos2[5] << 40; v ^= (uint64_t)pos2[5] << 40;
// intentionally falls through [[fallthrough]];
case 5: case 5:
v ^= (uint64_t)pos2[4] << 32; v ^= (uint64_t)pos2[4] << 32;
// intentionally falls through [[fallthrough]];
case 4: case 4:
v ^= (uint64_t)pos2[3] << 24; v ^= (uint64_t)pos2[3] << 24;
// intentionally falls through [[fallthrough]];
case 3: case 3:
v ^= (uint64_t)pos2[2] << 16; v ^= (uint64_t)pos2[2] << 16;
// intentionally falls through [[fallthrough]];
case 2: case 2:
v ^= (uint64_t)pos2[1] << 8; v ^= (uint64_t)pos2[1] << 8;
// intentionally falls through [[fallthrough]];
case 1: case 1:
v ^= (uint64_t)pos2[0]; v ^= (uint64_t)pos2[0];
h ^= fasthash_mix(v); h ^= fasthash_mix(v);