The following issues were found

src/mongo/db/storage/record_store_test_updaterecord.cpp
1 issues
syntax error
Error

Line: 46

              using std::unique_ptr;

// Insert a record and try to update it.
TEST(RecordStoreTestHarness, UpdateRecord) {
    const auto harnessHelper(newRecordStoreHarnessHelper());
    unique_ptr<RecordStore> rs(harnessHelper->newNonCappedRecordStore());

    {
        ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());

            

Reported by Cppcheck.

src/mongo/db/storage/record_store_test_updatewithdamages.cpp
1 issues
syntax error
Error

Line: 50

              using std::unique_ptr;

// Insert a record and try to perform an in-place update on it.
TEST(RecordStoreTestHarness, UpdateWithDamages) {
    const auto harnessHelper(newRecordStoreHarnessHelper());
    unique_ptr<RecordStore> rs(harnessHelper->newNonCappedRecordStore());

    if (!rs->updateWithDamagesSupported())
        return;

            

Reported by Cppcheck.

src/mongo/db/storage/recovery_unit_test_harness.cpp
1 issues
syntax error
Error

Line: 87

                  int* _count;
};

TEST_F(RecoveryUnitTestHarness, CommitUnitOfWork) {
    Lock::GlobalLock globalLk(opCtx.get(), MODE_IX);
    const auto rs = harnessHelper->createRecordStore(opCtx.get(), "table1");
    opCtx->lockState()->beginWriteUnitOfWork();
    ru->beginUnitOfWork(opCtx.get());
    StatusWith<RecordId> s = rs->insertRecord(opCtx.get(), "data", 4, Timestamp());

            

Reported by Cppcheck.

src/mongo/db/storage/sorted_data_interface_test_bulkbuilder.cpp
1 issues
syntax error
Error

Line: 71

              /*
 * Add a KeyString using a bulk builder.
 */
TEST(SortedDataInterface, BuilderAddKeyString) {
    const auto harnessHelper(newSortedDataInterfaceHarnessHelper());
    const std::unique_ptr<SortedDataInterface> sorted(
        harnessHelper->newSortedDataInterface(/*unique=*/false, /*partial=*/false));

    KeyString::Builder keyString1(sorted->getKeyStringVersion(), key1, sorted->getOrdering(), loc1);

            

Reported by Cppcheck.

src/mongo/db/storage/sorted_data_interface_test_cursor.cpp
1 issues
syntax error
Error

Line: 65

              }

// Verify that a reverse cursor is positioned at EOF when the index is empty.
TEST(SortedDataInterface, CursorIsEOFWhenEmptyReversed) {
    const auto harnessHelper(newSortedDataInterfaceHarnessHelper());
    const std::unique_ptr<SortedDataInterface> sorted(
        harnessHelper->newSortedDataInterface(/*unique=*/false, /*partial=*/false));

    {

            

Reported by Cppcheck.

src/mongo/db/storage/sorted_data_interface_test_cursor_advanceto.cpp
1 issues
syntax error
Error

Line: 112

              // advanceTo() is called on a duplicate key, the cursor is
// positioned at the first occurrence of that key in descending
// order by RecordId (last occurrence in index order).
TEST(SortedDataInterface, AdvanceToReversed) {
    const auto harnessHelper(newSortedDataInterfaceHarnessHelper());
    const std::unique_ptr<SortedDataInterface> sorted(
        harnessHelper->newSortedDataInterface(/*unique=*/false, /*partial=*/false));

    {

            

Reported by Cppcheck.

src/mongo/db/storage/sorted_data_interface_test_cursor_end_position.cpp
1 issues
syntax error
Error

Line: 72

                  ASSERT_EQ(cursor->next(), boost::none);
    ASSERT_EQ(cursor->next(), boost::none);  // don't resurrect.
}
TEST(SortedDataInterface, SetEndPosition_Next_Forward_Unique_Inclusive) {
    testSetEndPosition_Next_Forward(true, true);
}
TEST(SortedDataInterface, SetEndPosition_Next_Forward_Unique_Exclusive) {
    testSetEndPosition_Next_Forward(true, false);
}

            

Reported by Cppcheck.

src/mongo/db/storage/sorted_data_interface_test_cursor_locate.cpp
1 issues
syntax error
Error

Line: 75

              
// Insert a key and try to locate it using a reverse cursor
// by specifying its exact key and RecordId.
TEST(SortedDataInterface, LocateReversed) {
    const auto harnessHelper(newSortedDataInterfaceHarnessHelper());
    const std::unique_ptr<SortedDataInterface> sorted(
        harnessHelper->newSortedDataInterface(/*unique=*/false, /*partial=*/false));

    {

            

Reported by Cppcheck.

src/mongo/db/storage/sorted_data_interface_test_cursor_saverestore.cpp
1 issues
syntax error
Error

Line: 93

              // Insert multiple keys and try to iterate through all of them
// using a reverse cursor while calling savePosition() and
// restorePosition() in succession.
TEST(SortedDataInterface, SaveAndRestorePositionWhileIterateCursorReversed) {
    const auto harnessHelper(newSortedDataInterfaceHarnessHelper());
    const std::unique_ptr<SortedDataInterface> sorted(
        harnessHelper->newSortedDataInterface(/*unique=*/false, /*partial=*/false));

    {

            

Reported by Cppcheck.

src/mongo/db/storage/sorted_data_interface_test_cursor_seek_exact.cpp
1 issues
syntax error
Error

Line: 65

                  ASSERT_EQ(cursor->next(), IndexKeyEntry(forward ? key3 : key1, loc1));
    ASSERT_EQ(cursor->next(), boost::none);
}
TEST(SortedDataInterface, SeekExact_Hit_Unique_Forward) {
    testSeekExact_Hit(true, true);
}
TEST(SortedDataInterface, SeekExact_Hit_Unique_Reverse) {
    testSeekExact_Hit(true, false);
}

            

Reported by Cppcheck.