8000 use C++17 [[fallthrough]] (#10280) · arangodb/arangodb@ea20f7a · GitHub
[go: up one dir, main page]

Skip to content

Commit ea20f7a

Browse files
ObiWahnjsteemann
authored andcommitted
use C++17 [[fallthrough]] (#10280)
1 parent 0b13308 commit ea20f7a

15 files changed

+160
-160
lines changed

arangod/Aql/AllRowsFetcher.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ std::pair<ExecutionState, InputAqlItemRow> AllRowsFetcher::fetchRow(size_t atMos
8383
_nextReturn = 0;
8484
_dataFetchedState = DATA_FETCH_ONGOING;
8585
}
86-
// intentionally falls through
86+
[[fallthrough]];
8787
case DATA_FETCH_ONGOING: {
8888
TRI_ASSERT(_nextReturn < _rowIndexes.size());
8989
TRI_ASSERT(_aqlItemMatrix != nullptr);
@@ -258,4 +258,4 @@ std::pair<ExecutionState, ShadowAqlItemRow> AllRowsFetcher::fetchShadowRow(size_
258258
}
259259

260260
return {state, row};
261-
}
261+
}

arangod/Aql/AqlValue.cpp

Lines changed: 28 additions & 28 deletions
< FEE1 /tr>
Original file line numberDiff line numberDiff line change
@@ -241,11 +241,11 @@ AqlValue AqlValue::at(int64_t position, bool& mustDestroy, bool doCopy) const {
241241
switch (type()) {
242242
case VPACK_SLICE_POINTER:
243243
doCopy = false;
244-
// intentionally falls through
244+
[[fallthrough]];
245245
case VPACK_INLINE:
246-
// intentionally falls through
246+
[[fallthrough]];
247247
case VPACK_MANAGED_SLICE:
248-
// intentionally falls through
248+
[[fallthrough]];
249249
case VPACK_MANAGED_BUFFER: {
250250
VPackSlice s(slice());
251251
if (s.isArray()) {
@@ -318,11 +318,11 @@ AqlValue AqlValue::at(int64_t position, size_t n, bool& mustDestroy, bool doCopy
318318
switch (type()) {
319319
case VPACK_SLICE_POINTER:
320320
doCopy = false;
321-
// intentionally falls through
321+
[[fallthrough]];
322322
case VPACK_INLINE:
323-
// intentionally falls through
323+
[[fallthrough]];
324324
case VPACK_MANAGED_SLICE:
325-
// intentionally falls through
325+
[[fallthrough]];
326326
case VPACK_MANAGED_BUFFER: {
327327
VPackSlice s(slice());
328328
if (s.isArray()) {
@@ -392,11 +392,11 @@ AqlValue AqlValue::getKeyAttribute(bool& mustDestroy, bool doCopy) const {
392392
switch (type()) {
393393
case VPACK_SLICE_POINTER:
394394
doCopy = false;
395-
// intentionally falls through
395+
[[fallthrough]];
396396
case VPACK_INLINE:
397-
// intentionally falls through
397+
[[fallthrough]];
398398
case VPACK_MANAGED_SLICE:
399-
// intentionally falls through
399+
[[fallthrough]];
400400
case VPACK_MANAGED_BUFFER: {
401401
VPackSlice s(slice());
402402
if (s.isObject()) {
@@ -431,11 +431,11 @@ AqlValue AqlValue::getIdAttribute(CollectionNameResolver const& resolver,
431431
switch (type()) {
432432
case VPACK_SLICE_POINTER:
433433
doCopy = false;
434-
// intentionally falls through
434+
[[fallthrough]];
435435
case VPACK_INLINE:
436-
// intentionally falls through
436+
[[fallthrough]];
437437
case VPACK_MANAGED_SLICE:
438-
// intentionally falls through
438+
[[fallthrough]];
439439
case VPACK_MANAGED_BUFFER: {
440440
VPackSlice s(slice());
441441
if (s.isObject()) {
@@ -474,11 +474,11 @@ AqlValue AqlValue::getFromAttribute(bool& mustDestroy, bool doCopy) const {
474474
switch (type()) {
475475
case VPACK_SLICE_POINTER:
476476
doCopy = false;
477-
// intentionally falls through
477+
[[fallthrough]];
478478
case VPACK_INLINE:
479-
// intentionally falls through
479+
[[fallthrough]];
480480
case VPACK_MANAGED_SLICE:
481-
// intentionally falls through
481+
[[fallthrough]];
482482
case VPACK_MANAGED_BUFFER: {
483483
VPackSlice s(slice());
484484
if (s.isObject()) {
@@ -512,11 +512,11 @@ AqlValue AqlValue::getToAttribute(bool& mustDestroy, bool doCopy) const {
512512
switch (type()) {
513513
case VPACK_SLICE_POINTER:
514514
doCopy = false;
515-
// intentionally falls through
515+
[[fallthrough]];
516516
case VPACK_INLINE:
517-
// intentionally falls through
517+
[[fallthrough]];
518518
case VPACK_MANAGED_SLICE:
519-
// intentionally falls through
519+
[[fallthrough]];
520520
case VPACK_MANAGED_BUFFER: {
521521
VPackSlice s(slice());
522522
if (s.isObject()) {
@@ -551,11 +551,11 @@ AqlValue AqlValue::get(CollectionNameResolver const& resolver,
551551
switch (type()) {
552552
case VPACK_SLICE_POINTER:
553553
doCopy = false;
554-
// intentionally falls through
554+
[[fallthrough]];
555555
case VPACK_INLINE:
556-
// intentionally falls through
556+
[[fallthrough]];
557557
case VPACK_MANAGED_SLICE:
558-
// intentionally falls through
558+
[[fallthrough]];
559559
case VPACK_MANAGED_BUFFER: {
560560
VPackSlice s(slice());
561561
if (s.isObject()) {
@@ -596,11 +596,11 @@ AqlValue AqlValue::get(CollectionNameResolver const& resolver,
596596
switch (type()) {
597597
case VPACK_SLICE_POINTER:
598598
doCopy = false;
599-
// intentionally falls through
599+
[[fallthrough]];
600600
case VPACK_INLINE:
601-
// intentionally falls through
601+
[[fallthrough]];
602602
case VPACK_MANAGED_SLICE:
603-
// intentionally falls through
603+
[[fallthrough]];
604604
case VPACK_MANAGED_BUFFER: {
605605
VPackSlice s(slice());
606606
if (s.isObject()) {
@@ -645,11 +645,11 @@ AqlValue AqlValue::get(CollectionNameResolver const& resolver,
645645
switch (type()) {
646646
case VPACK_SLICE_POINTER:
647647
doCopy = false;
648-
// intentionally falls through
648+
[[fallthrough]];
649649
case VPACK_INLINE:
650-
// intentionally falls through
650+
[[fallthrough]];
651651
case VPACK_MANAGED_SLICE:
652-
// intentionally falls through
652+
[[fallthrough]];
653653
case VPACK_MANAGED_BUFFER: {
654654
VPackSlice s(slice());
655655
if (s.isObject()) {
@@ -939,7 +939,7 @@ void AqlValue::toVelocyPack(transaction::Methods* trx, arangodb::velocypack::Bui
939939
if (!resolveExternals && isManagedDocument()) {
940940
builder.addExternal(_data.pointer);
941941
break;
942-
} // intentionally falls through
942+
} [[fallthrough]];
943943
case VPACK_INLINE:
944944
case VPACK_MANAGED_SLICE:
945945
case VPACK_MANAGED_BUFFER: {

arangod/Aql/Functions.cpp

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ AqlValue timeAqlValue(ExpressionContext* expressionContext,
295295

296296
year_month_day ymd{floor<days>(tp)};
297297
auto day_time = make_time(tp - sys_days(ymd));
298-
298+
299299
auto y = static_cast<int>(ymd.year());
300300
// quick sanity check here for dates outside the allowed range
301301
if (y < 0 || y > 9999) {
@@ -439,7 +439,7 @@ AqlValue addOrSubtractUnitFromTimestamp(ExpressionContext* expressionContext,
439439
break; // We are done
440440
}
441441
durationUnits *= 12;
442-
// intentionally falls through
442+
[[fallthrough]];
443443
case MONTH:
444444
durationUnits = std::modf(durationUnits, &intPart);
445445
if (isSubtract) {
@@ -451,7 +451,7 @@ AqlValue addOrSubtractUnitFromTimestamp(ExpressionContext* expressionContext,
451451
break; // We are done
452452
}
453453
durationUnits *= 30; // 1 Month ~= 30 Days
454-
// intentionally falls through
454+
[[fallthrough]];
455455
// After this fall through the date may actually a bit off
456456
case DAY:
457457
// From here on we do not need leap-day handling
@@ -499,19 +499,19 @@ AqlValue addOrSubtractUnitFromTimestamp(ExpressionContext* expressionContext,
499499

500500
AqlValue addOrSubtractIsoDurationFromTimestamp(ExpressionContext* expressionContext,
501501
tp_sys_clock_ms const& tp,
502-
arangodb::velocypack::StringRef duration,
502+
arangodb::velocypack::StringRef duration,
503503
char const* AFN, bool isSubtract) {
504504
year_month_day ymd{floor<days>(tp)};
505505
auto day_time = make_time(tp - sys_days(ymd));
506-
506+
507507
std::match_results<char const*> durationParts;
508508
if (!basics::regexIsoDuration(duration, durationParts)) {
509509
::registerWarning(expressionContext, AFN, TRI_ERROR_QUERY_INVALID_DATE_VALUE);
510510
return AqlValue(AqlValueHintNull());
511511
}
512512

513-
char const* begin;
514-
513+
char const* begin;
514+
515515
begin = duration.data() + durationParts.position(2);
516516
int number = NumberUtils::atoi_unchecked<int>(begin, begin + durationParts.length(2));
517517
if (isSubtract) {
@@ -2498,8 +2498,8 @@ void rtrimInternal(int32_t& startOffset, int32_t& endOffset, icu::UnicodeString&
24982498
if (unicodeStr.length() == 0) {
24992499
return;
25002500
}
2501-
for (int32_t codePos = unicodeStr.moveIndex32(endOffset, -1);
2502-
startOffset <= codePos;
2501+
for (int32_t codePos = unicodeStr.moveIndex32(endOffset, -1);
2502+
startOffset <= codePos;
25032503
codePos = unicodeStr.moveIndex32(codePos, -1)) {
25042504
bool found = false;
25052505

@@ -3648,47 +3648,47 @@ AqlValue Functions::DateCompare(ExpressionContext* expressionContext,
36483648
if (ymd1.year() != ymd2.year()) {
36493649
return AqlValue(AqlValueHintBool(false));
36503650
}
3651-
// intentionally falls through
3651+
[[fallthrough]];
36523652
case MONTH:
36533653
if (rangeEnd > MONTH) {
36543654
break;
36553655
}
36563656
if (ymd1.month() != ymd2.month()) {
36573657
return AqlValue(AqlValueHintBool(false));
36583658
}
3659-
// intentionally falls through
3659+
[[fallthrough]];
36603660
case DAY:
36613661
if (rangeEnd > DAY) {
36623662
break;
36633663
}
36643664
if (ymd1.day() != ymd2.day()) {
36653665
return AqlValue(AqlValueHintBool(false));
36663666
}
3667-
// intentionally falls through
3667+
[[fallthrough]];
36683668
case HOUR:
36693669
if (rangeEnd > HOUR) {
36703670
break;
36713671
}
36723672
if (time1.hours() != time2.hours()) {
36733673
return AqlValue(AqlValueHintBool(false));
36743674
}
3675-
// intentionally falls through
3675+
[[fallthrough]];
36763676
case MINUTE:
36773677
if (rangeEnd > MINUTE) {
36783678
break;
36793679
}
36803680
if (time1.minutes() != time2.minutes()) {
36813681
return AqlValue(AqlValueHintBool(false));
36823682
}
3683-
// intentionally falls through
3683+
[[fallthrough]];
36843684
case SECOND:
36853685
if (rangeEnd > SECOND) {
36863686
break;
36873687
}
36883688
if (time1.seconds() != time2.seconds()) {
36893689
return AqlValue(AqlValueHintBool(false));
36903690
}
3691-
// intentionally falls through
3691+
[[fallthrough]];
36923692
case MILLI:
36933693
if (rangeEnd > MILLI) {
36943694
break;
@@ -3730,15 +3730,15 @@ AqlValue Functions::DateRound(ExpressionContext* expressionContext,
37303730
::registerInvalidArgumentWarning(expressionContext, AFN);
37313731
return AqlValue(AqlValueHintNull());
37323732
}
3733-
3734-
int64_t const m = durationUnit.toInt64();
3733+
3734+
int64_t const m = durationUnit.toInt64();
37353735
if (m <= 0) {
37363736
::registerInvalidArgumentWarning(expressionContext, AFN);
37373737
return AqlValue(AqlValueHintNull());
37383738
}
3739-
3739+
37403740
velocypack::StringRef s = durationType.slice().stringRef();
3741-
3741+
37423742
int64_t factor = 1;
37433743
if (s == "milliseconds" || s == "millisecond" || s == "f") {
37443744
factor = 1;
@@ -3755,8 +3755,8 @@ AqlValue Functions::DateRound(ExpressionContext* expressionContext,
37553755
return AqlValue(AqlValueHintNull());
37563756
}
37573757

3758-
int64_t const multiplier = factor * m;
3759-
3758+
int64_t const multiplier = factor * m;
3759+
37603760
duration<int64_t, std::milli> time = tp.time_since_epoch();
37613761
int64_t t = time.count();
37623762
// integer division!
@@ -4186,7 +4186,7 @@ AqlValue Functions::Sleep(ExpressionContext* expressionContext,
41864186
}
41874187

41884188
auto& server = application_features::ApplicationServer::server();
4189-
4189+
41904190
double const sleepValue = value.toDouble();
41914191
auto now = std::chrono::steady_clock::now();
41924192
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
44434443
std::unordered_set<VPackSlice, arangodb::basics::VelocyPackHelper::VPackHash, arangodb::basics::VelocyPackHelper::VPackEqual>
44444444
values(512, arangodb::basics::VelocyPackHelper::VPackHash(),
44454445
arangodb::basics::VelocyPackHelper::VPackEqual(options));
4446-
4446+
44474447
transaction::BuilderLeaser builder(trx);
44484448
builder->openArray();
44494449

@@ -4458,7 +4458,7 @@ AqlValue Functions::Unique(ExpressionContext* expressionContext, transaction::Me
44584458
builder->add(s);
44594459
}
44604460
}
4461-
4461+
44624462
builder->close();
44634463
return AqlValue(builder.get());
44644464
}
@@ -4845,7 +4845,7 @@ AqlValue Functions::GeoDistance(ExpressionContext* expressionContext,
48454845
::registerWarning(expressionContext, "GEO_DISTANCE", res);
48464846
return AqlValue(AqlValueHintNull());
48474847
}
4848-
4848+
48494849
if (parameters.size() > 2 && parameters[2].isString()) {
48504850
VPackValueLength len;
48514851
const char* ptr = parameters[2].slice().getStringUnchecked(len);
@@ -4911,17 +4911,17 @@ AqlValue Functions::GeoArea(ExpressionContext* expressionContext,
49114911
VPackFunctionParameters const& parameters) {
49124912
AqlValue p1 = extractFunctionParameterValue(parameters, 0);
49134913
AqlValue p2 = extractFunctionParameterValue(parameters, 1);
4914-
4914+
49154915
AqlValueMaterializer mat(trx);
4916-
4916+
49174917
geo::ShapeContainer shape;
49184918
Result res = geo::geojson::parseRegion(mat.slice(p1, true), shape);
4919-
4919+
49204920
if (res.fail()) {
49214921
::registerWarning(expressionContext, "GEO_AREA", res);
49224922
return AqlValue(AqlValueHintNull());
49234923
}
4924-
4924+
49254925
auto detEllipsoid = [](AqlValue const& p) {
49264926
if (p.isString()) {
49274927
VPackValueLength len;
@@ -7038,7 +7038,7 @@ AqlValue Functions::DecodeRev(ExpressionContext* expressionContext,
70387038
VPackValueLength l;
70397039
char const* p = rev.slice().getString(l);
70407040
uint64_t revInt = arangodb::basics::HybridLogicalClock::decodeTimeStamp(p, l);
7041-
7041+
70427042
if (revInt == 0 || revInt == UINT64_MAX) {
70437043
::registerInvalidArgumentWarning(expressionContext, "DECODE_REV");
70447044
return AqlValue(AqlValueHintNull());
@@ -7050,7 +7050,7 @@ AqlValue Functions::DecodeRev(ExpressionContext* expressionContext,
70507050
uint64_t millis = timeMilli % 1000;
70517051
struct tm date;
70527052
TRI_gmtime(timeSeconds, &date);
7053-
7053+
70547054
char buffer[32];
70557055
strftime(buffer, 32, "%Y-%m-%dT%H:%M:%S.000Z", &date);
70567056
// fill millisecond part not covered by strftime

0 commit comments

Comments
 (0)
0