8000 use C++17 [[fallthrough]] by ObiWahn · Pull Request #10280 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 19, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
remove the extra if as it requires -Wimplicit-fallthrough=2 or 1
  • Loading branch information
ObiWahn committed Oct 18, 2019
commit 553625ab7bf348ee787cc59d5f333b3057c09c4b
30 changes: 15 additions & 15 deletions arangod/Aql/AqlValue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ AqlValue AqlValue::at(int64_t position, bool& mustDestroy, bool doCopy) const {
return AqlValue(s.at(position).begin());
}
}
// intentionally falls through if
// intentionally falls through
break;
}
case DOCVEC: {
Expand All @@ -289,7 +289,7 @@ AqlValue AqlValue::at(int64_t position, bool& mustDestroy, bool doCopy) const {
total += it->size();
}
}
// intentionally falls through if
// intentionally falls through
break;
}
case RANGE: {
Expand All @@ -303,7 +303,7 @@ AqlValue AqlValue::at(int64_t position, bool& mustDestroy, bool doCopy) const {
// only look up the value if it is within array bounds
return AqlValue(AqlValueHintInt(_data.range->at(static_cast<size_t>(position))));
}
// intentionally falls through if
// intentionally falls through
break;
}
}
Expand Down Expand Up @@ -339,7 +339,7 @@ AqlValue AqlValue::at(int64_t position, size_t n, bool& mustDestroy, bool doCopy
return AqlValue(s.at(position).begin());
}
}
// intentionally falls through 8000 if
// intentionally falls through
break;
}
case DOCVEC: {
Expand All @@ -364,7 +364,7 @@ AqlValue AqlValue::at(int64_t position, size_t n, bool& mustDestroy, bool doCopy
total += it->size();
}
}
// intentionally falls through if
// intentionally falls through
break;
}
case RANGE: {
Expand All @@ -377,7 +377,7 @@ AqlValue AqlValue::at(int64_t position, size_t n, bool& mustDestroy, bool doCopy
// only look up the value if it is within array bounds
return AqlValue(AqlValueHintInt(_data.range->at(static_cast<size_t>(position))));
}
// intentionally falls through if
// intentionally falls through
break;
}
}
Expand Down Expand Up @@ -410,7 +410,7 @@ AqlValue AqlValue::getKeyAttribute(bool& mustDestroy, bool doCopy) const {
return AqlValue(found.begin());
}
}
// intentionally falls through if
// intentionally falls through
break;
}
case DOCVEC:
Expand Down Expand Up @@ -454,7 +454,7 @@ AqlValue AqlValue::getIdAttribute(CollectionNameResolver const& resolver,
return AqlValue(found.begin());
}
}
// intentionally falls through if
// intentionally falls through
break;
}
case DOCVEC:
Expand Down Expand Up @@ -492,7 +492,7 @@ AqlValue AqlValue::getFromAttribute(bool& mustDestroy, bool doCopy) const {
return AqlValue(found.begin());
}
}
// intentionally falls through if
// intentionally falls through
break;
}
case DOCVEC:
Expand Down Expand Up @@ -530,7 +530,7 @@ AqlValue AqlValue::getToAttribute(bool& mustDestroy, bool doCopy) const {
return AqlValue(found.begin());
}
}
// intentionally falls through if
// intentionally falls through
break;
}
case DOCVEC:
Expand Down Expand Up @@ -574,7 +574,7 @@ AqlValue AqlValue::get(CollectionNameResolver const& resolver,
return AqlValue(found.begin());
}
}
// intentionally falls through if
// intentionally falls through
break;
}
case DOCVEC:
Expand Down Expand Up @@ -619,7 +619,7 @@ AqlValue AqlValue::get(CollectionNameResolver const& resolver,
return AqlValue(found.begin());
}
}
// intentionally falls through if
// intentionally falls through
break;
}
case DOCVEC:
Expand Down Expand Up @@ -692,7 +692,7 @@ AqlValue AqlValue::get(CollectionNameResolver const& resolver,
return AqlValue(s.begin());
}
}
// intentionally falls through if
// intentionally falls through
break;
}
case DOCVEC:
Expand Down Expand Up @@ -762,7 +762,7 @@ double AqlValue::toDouble(bool& failed) const {
return at(0, mustDestroy, false).toDouble(failed);
}
}
// intentionally falls through if
// intentionally falls through
break;
}
case DOCVEC:
Expand Down Expand Up @@ -815,7 +815,7 @@ int64_t AqlValue::toInt64() const {
return at(0, mustDestroy, false).toInt64();
}
}
// intentionally falls through if
// intentionally falls through
break;
}
case DOCVEC:
Expand Down
4 changes: 2 additions & 2 deletions arangod/Aql/Ast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1794,7 +1794,7 @@ AstNode* Ast::replaceVariables(AstNode* node,
node->setData((*it).second);
}
}
// intentionally falls through if
// intentionally falls through
}

return node;
Expand Down Expand Up @@ -2925,7 +2925,7 @@ AstNode* Ast::optimizeBinaryOperatorRelational(AstNode* node) {
// and optimize ourselves...
return optimizeBinaryOperatorRelational(node);
}
// intentionally falls through if
// intentionally falls through
}

bool const rhsIsConst = rhs->isConstant();
Expand Down
10 changes: 5 additions & 5 deletions arangod/Aql/AstNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1200,7 +1200,7 @@ AstNode const* AstNode::castToBool(Ast* ast) const {
default: {
}
}
// intentionally falls through if
// intentionally falls through
} else if (type == NODE_TYPE_ARRAY) {
return ast->createNodeValueBool(true);
} else if (type == NODE_TYPE_OBJECT) {
Expand Down Expand Up @@ -1241,9 +1241,9 @@ AstNode const* AstNode::castToNumber(Ast* ast) const {
}
return ast->createNodeValueDouble(v);
}
// intentionally falls through if
// intentionally falls through
}
// intentionally falls through if
// intentionally falls through
} else if (type == NODE_TYPE_ARRAY) {
size_t const n = numMembers();
if (n == 0) {
Expand All @@ -1254,9 +1254,9 @@ AstNode const* AstNode::castToNumber(Ast* ast) const {
// convert only member to number
return member->castToNumber(ast);
}
// intentionally falls through if
// intentionally falls through
} else if (type == NODE_TYPE_OBJECT) {
// intentionally falls through if
// intentionally falls through
}

return ast->createNodeValueInt(0);
Expand Down
10 changes: 5 additions & 5 deletions arangod/Aql/OptimizerRules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4407,7 +4407,7 @@ void arangodb::aql::distributeFilternCalcToClusterRule(Optimizer* opt,
stopSearching = true;
break;
}
// intentionally falls through if
// intentionally falls through
}
#if 0
// TODO: this is already prepared to push subqueries on the DB servers.
Expand All @@ -4420,7 +4420,7 @@ void arangodb::aql::distributeFilternCalcToClusterRule(Optimizer* opt,
stopSearching = true;
break;
}
// intentionally falls through if
// intentionally falls through
}
#endif
// no special handling for filters here
Expand Down Expand Up @@ -5253,7 +5253,7 @@ struct OrSimplifier {
return true;
}
}
// intentionally falls through if
// intentionally falls through
} else if (node->type == NODE_TYPE_OPERATOR_BINARY_IN) {
auto lhs = node->getMember(0);
auto rhs = node->getMember(1);
Expand All @@ -5264,7 +5264,7 @@ struct OrSimplifier {
return true;
}
}
// intentionally falls through if
// intentionally falls through
}

return false;
Expand Down Expand Up @@ -5369,7 +5369,7 @@ struct OrSimplifier {
return ast->createNodeBinaryOperator(node->type, lhsNew, rhsNew);
}

// intentionally falls through if
// intentionally falls through
}

return const_cast<AstNode*>(node);
Expand Down
2 changes: 1 addition & 1 deletion arangod/Cluster/HeartbeatThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ void HeartbeatThread::runSingleServer() {

if (result.successful()) { // successful leadership takeover
leader = myIdBuilder.slice();
// intentionally falls through if to case 2
// intentionally falls through to case 2
} else if (result.httpCode() == TRI_ERROR_HTTP_PRECONDITION_FAILED) {
// we did not become leader, someone else is, response contains
// current value in agency
Expand Down
2 changes: 1 addition & 1 deletion arangod/GeneralServer/HttpCommTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ ResponseCode HttpCommTask<T>::handleAuthHeader(HttpRequest& req) {
return rest::ResponseCode::UNAUTHORIZED;
}

// intentionally falls through if
// intentionally falls through
} catch (arangodb::basics::Exception const& ex) {
// translate error
if (ex.code() == TRI_ERROR_USER_NOT_FOUND) {
Expand Down
2 changes: 1 addition & 1 deletion arangod/MMFiles/MMFilesCleanupThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ void MMFilesCleanupThread::cleanupCollection(arangodb::LogicalCollection* collec
if (!unloadChecked && !isInShutdown) {
return false;
}
// intentionally falls through if
// intentionally falls through
} else {
// retry in next iteration
unloadChecked = false;
Expand Down
4 changes: 2 additions & 2 deletions arangod/MMFiles/MMFilesCollection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2540,7 +2540,7 @@ int MMFilesCollection::lockRead(bool useDeadlockDetector,
LOG_TOPIC("29637", TRACE, arangodb::Logger::ENGINES)
<< "waiting for read-lock on collection '"
<< _logicalCollection.name() << "'";
// intentionally falls through if
// intentionally falls through
} else if (++iterations >= 5) {
// periodically check for deadlocks
TRI_ASSERT(wasBlocked);
Expand Down Expand Up @@ -2837,7 +2837,7 @@ LocalDocumentId MMFilesCollection::reuseOrCreateLocalDocumentId(OperationOptions
if (marker->hasLocalDocumentId()) {
return marker->getLocalDocumentId();
}
// intentionally falls through if
// intentionally falls through
}

// new operation, no recovery -> generate a new LocalDocumentId
Expand Down
2 changes: 1 addition & 1 deletion arangod/MMFiles/MMFilesDatafile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ int MMFilesDatafile::reserveElement(uint32_t size, MMFilesMarker** position,
return TRI_ERROR_ARANGO_DOCUMENT_TOO_LARGE;
}

// intentionally falls through if
// intentionally falls through
}

// add the marker, leave enough room for the footer
Expand Down
2 changes: 1 addition & 1 deletion arangod/MMFiles/MMFilesWalSlots.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ int MMFilesWalSlots::closeLogfile(MMFilesWalSlot::TickType& lastCommittedTick, b
// new one
_logfile = nullptr;

// intentionally falls through if
// intentionally falls through
}

TRI_IF_FAILURE("LogfileManagerGetWriteableLogfile") {
Expand Down
2 changes: 1 addition & 1 deletion arangod/RestHandler/RestReplicationHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,7 @@ Result RestReplicationHandler::processRestoreCollection(VPackSlice const& collec
std::string("unable to drop collection '") + name +
"': " + res.errorMessage());
}
// intentionally falls through if
// intentionally falls through
} else {
return Result(TRI_ERROR_ARANGO_DUPLICATE_NAME,
std::string("unable to create collection '") + name +
Expand Down
4 changes: 2 additions & 2 deletions arangod/V8Server/v8-collection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2112,7 +2112,7 @@ static void JS_StatusVocbaseCol(v8::FunctionCallbackInfo<v8::Value> const& args)
TRI_V8_RETURN(v8::Number::New(isolate, (int)TRI_VOC_COL_STATUS_DELETED));
}
}
// intentionally falls through if
// intentionally falls through

auto status = collection->status();

Expand Down Expand Up @@ -2196,7 +2196,7 @@ static void JS_TypeVocbaseCol(v8::FunctionCallbackInfo<v8::Value> const& args) {
TRI_V8_RETURN(v8::Number::New(isolate, (int)(collection->type())));
}
}
// intentionally falls through if
// intentionally falls through

auto type = collection->type();

Expand Down
2 changes: 1 addition & 1 deletion arangod/V8Server/v8-user-structures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ static int ObjectToJson(v8::Isolate* isolate, TRI_json_t* result,
}
}

// intentionally falls through if
// intentionally falls through
}

int hashval = o->GetIdentityHash();
Expand Down
2 changes: 1 addition & 1 deletion arangod/V8Server/v8-vocbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,7 @@ static void JS_QueriesPropertiesAql(v8::FunctionCallbackInfo<v8::Value> const& a
obj->Get(TRI_V8_ASCII_STRING(isolate, "maxQueryStringLength")))));
}

// intentionally falls through if
// intentionally falls through
}

// return current settings
Expand Down
2 changes: 1 addition & 1 deletion arangod/VocBase/Methods/Transactions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ Result executeTransactionJS(v8::Isolate* isolate, v8::Handle<v8::Value> const& a
std::string(" There is no array in '") + attributeName + "'";
return false;
}
// intentionally falls through if
// intentionally falls through
}
return true;
};
Expand Down
10000
2 changes: 1 addition & 1 deletion lib/Basics/Utf8Helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ char* TRI_normalize_utf16_to_NFC(uint16_t const* utf16, size_t inLength, size_t*
mustFree = true;
continue;
}
// intentionally falls through if
// intentionally falls through
}

if (mustFree) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Basics/tri-strings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ char* TRI_UnescapeUtf8String(char const* in, size_t inLength, size_t* outLength,
TRI_Free(buffer);
buffer = utf8_nfc;
}
// intentionally falls through if
// intentionally falls through
}

return buffer;
Expand Down
4 changes: 2 additions & 2 deletions lib/V8/v8-buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1569,7 +1569,7 @@ static void MapGetIndexedBuffer(uint32_t idx,
TRI_V8_RETURN(v8::Handle<v8::Value>());
}
self = TRI_GetObject(context, parent);
// intentionally falls through if
// intentionally falls through
}
}

Expand Down Expand Up @@ -1603,7 +1603,7 @@ static void MapSetIndexedBuffer(uint32_t idx, v8::Local<v8::Value> value,
TRI_V8_RETURN(v8::Handle<v8::Value>());
}
self = TRI_GetObject(context, parent);
// intentionally falls through if
// intentionally falls through
}
}

Expand Down
Loading
0