Skip to content
This repository was archived by the owner on Dec 8, 2021. It is now read-only.

Commit b573896

Browse files
authored
cleanup: fix clang-tidy-9 warnings (#1409)
The clang-tidy build is still using clang-8.0, we want to use clang-9.0, this changes fix a few warnings. In most cases I preferred to use the recommended fix over silencing the warning.
1 parent 685d0b7 commit b573896

12 files changed

+43
-42
lines changed

google/cloud/spanner/benchmarks/single_row_throughput_benchmark.cc

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ class InsertOrUpdateExperiment : public Experiment {
295295
auto start = std::chrono::steady_clock::now();
296296
for (auto& t : tasks) {
297297
t = std::async(std::launch::async, &InsertOrUpdateExperiment::RunTask,
298-
this, config, client, locked_random_key, error_sink);
298+
config, client, locked_random_key, error_sink);
299299
}
300300
int insert_count = 0;
301301
for (auto& t : tasks) {
@@ -308,9 +308,9 @@ class InsertOrUpdateExperiment : public Experiment {
308308
std::chrono::duration_cast<std::chrono::microseconds>(elapsed)}});
309309
}
310310

311-
int RunTask(Config const& config, spanner::Client client,
312-
RandomKeyGenerator const& key_generator,
313-
ErrorSink const& error_sink) {
311+
static int RunTask(Config const& config, spanner::Client client,
312+
RandomKeyGenerator const& key_generator,
313+
ErrorSink const& error_sink) {
314314
int count = 0;
315315
std::string value(1024, 'A');
316316
std::vector<google::cloud::Status> errors;
@@ -387,7 +387,7 @@ class ReadExperiment : public Experiment {
387387
std::vector<std::future<int>> tasks(thread_count);
388388
auto start = std::chrono::steady_clock::now();
389389
for (auto& t : tasks) {
390-
t = std::async(std::launch::async, &ReadExperiment::RunTask, this, config,
390+
t = std::async(std::launch::async, &ReadExperiment::RunTask, config,
391391
client, locked_random_key, error_sink);
392392
}
393393
int total_count = 0;
@@ -401,9 +401,9 @@ class ReadExperiment : public Experiment {
401401
std::chrono::duration_cast<std::chrono::microseconds>(elapsed)}});
402402
}
403403

404-
int RunTask(Config const& config, spanner::Client client,
405-
RandomKeyGenerator const& key_generator,
406-
ErrorSink const& error_sink) {
404+
static int RunTask(Config const& config, spanner::Client client,
405+
RandomKeyGenerator const& key_generator,
406+
ErrorSink const& error_sink) {
407407
int count = 0;
408408
std::string value(1024, 'A');
409409
std::vector<google::cloud::Status> errors;
@@ -484,8 +484,8 @@ class UpdateDmlExperiment : public Experiment {
484484
std::vector<std::future<int>> tasks(thread_count);
485485
auto start = std::chrono::steady_clock::now();
486486
for (auto& t : tasks) {
487-
t = std::async(std::launch::async, &UpdateDmlExperiment::RunTask, this,
488-
config, client, locked_random_key, error_sink);
487+
t = std::async(std::launch::async, &UpdateDmlExperiment::RunTask, config,
488+
client, locked_random_key, error_sink);
489489
}
490490
int insert_count = 0;
491491
for (auto& t : tasks) {
@@ -498,9 +498,9 @@ class UpdateDmlExperiment : public Experiment {
498498
std::chrono::duration_cast<std::chrono::microseconds>(elapsed)}});
499499
}
500500

501-
int RunTask(Config const& config, spanner::Client client,
502-
RandomKeyGenerator const& key_generator,
503-
ErrorSink const& error_sink) {
501+
static int RunTask(Config const& config, spanner::Client client,
502+
RandomKeyGenerator const& key_generator,
503+
ErrorSink const& error_sink) {
504504
int count = 0;
505505
std::string value(1024, 'A');
506506
std::vector<google::cloud::Status> errors;
@@ -585,8 +585,8 @@ class SelectExperiment : public Experiment {
585585
std::vector<std::future<int>> tasks(thread_count);
586586
auto start = std::chrono::steady_clock::now();
587587
for (auto& t : tasks) {
588-
t = std::async(std::launch::async, &SelectExperiment::RunTask, this,
589-
config, client, locked_random_key, error_sink);
588+
t = std::async(std::launch::async, &SelectExperiment::RunTask, config,
589+
client, locked_random_key, error_sink);
590590
}
591591
int total_count = 0;
592592
for (auto& t : tasks) {
@@ -599,9 +599,9 @@ class SelectExperiment : public Experiment {
599599
std::chrono::duration_cast<std::chrono::microseconds>(elapsed)}});
600600
}
601601

602-
int RunTask(Config const& config, spanner::Client client,
603-
RandomKeyGenerator const& key_generator,
604-
ErrorSink const& error_sink) {
602+
static int RunTask(Config const& config, spanner::Client client,
603+
RandomKeyGenerator const& key_generator,
604+
ErrorSink const& error_sink) {
605605
int count = 0;
606606
std::string value(1024, 'A');
607607
std::vector<google::cloud::Status> errors;

google/cloud/spanner/integration_tests/client_integration_test.cc

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class ClientIntegrationTest : public ::testing::Test {
4949
EXPECT_STATUS_OK(commit_result);
5050
}
5151

52-
void InsertTwoSingers() {
52+
static void InsertTwoSingers() {
5353
auto commit_result = client_->Commit(Mutations{
5454
InsertMutationBuilder("Singers", {"SingerId", "FirstName", "LastName"})
5555
.EmplaceRow(1, "test-fname-1", "test-lname-1")
@@ -428,15 +428,15 @@ void CheckReadWithOptions(
428428
}
429429

430430
/// @test Test Read() with bounded staleness set by a timestamp.
431-
TEST_F(ClientIntegrationTest, Read_BoundedStaleness_Timestamp) {
431+
TEST_F(ClientIntegrationTest, ReadBoundedStalenessTimestamp) {
432432
CheckReadWithOptions(*client_, [](CommitResult const& result) {
433433
return Transaction::SingleUseOptions(
434434
/*min_read_timestamp=*/result.commit_timestamp);
435435
});
436436
}
437437

438438
/// @test Test Read() with bounded staleness set by duration.
439-
TEST_F(ClientIntegrationTest, Read_BoundedStaleness_Duration) {
439+
TEST_F(ClientIntegrationTest, ReadBoundedStalenessDuration) {
440440
CheckReadWithOptions(*client_, [](CommitResult const&) {
441441
// We want a duration sufficiently recent to include the latest commit.
442442
return Transaction::SingleUseOptions(
@@ -445,22 +445,22 @@ TEST_F(ClientIntegrationTest, Read_BoundedStaleness_Duration) {
445445
}
446446

447447
/// @test Test Read() with exact staleness set to "all previous transactions".
448-
TEST_F(ClientIntegrationTest, Read_ExactStaleness_Latest) {
448+
TEST_F(ClientIntegrationTest, ReadExactStalenessLatest) {
449449
CheckReadWithOptions(*client_, [](CommitResult const&) {
450450
return Transaction::SingleUseOptions(Transaction::ReadOnlyOptions());
451451
});
452452
}
453453

454454
/// @test Test Read() with exact staleness set by a timestamp.
455-
TEST_F(ClientIntegrationTest, Read_ExactStaleness_Timestamp) {
455+
TEST_F(ClientIntegrationTest, ReadExactStalenessTimestamp) {
456456
CheckReadWithOptions(*client_, [](CommitResult const& result) {
457457
return Transaction::SingleUseOptions(Transaction::ReadOnlyOptions(
458458
/*read_timestamp=*/result.commit_timestamp));
459459
});
460460
}
461461

462462
/// @test Test Read() with exact staleness set by duration.
463-
TEST_F(ClientIntegrationTest, Read_ExactStaleness_Duration) {
463+
TEST_F(ClientIntegrationTest, ReadExactStalenessDuration) {
464464
CheckReadWithOptions(*client_, [](CommitResult const&) {
465465
return Transaction::SingleUseOptions(Transaction::ReadOnlyOptions(
466466
/*exact_staleness=*/std::chrono::nanoseconds(0)));
@@ -511,7 +511,7 @@ void CheckExecuteQueryWithSingleUseOptions(
511511
}
512512

513513
/// @test Test ExecuteQuery() with bounded staleness set by a timestamp.
514-
TEST_F(ClientIntegrationTest, ExecuteQuery_BoundedStaleness_Timestamp) {
514+
TEST_F(ClientIntegrationTest, ExecuteQueryBoundedStalenessTimestamp) {
515515
CheckExecuteQueryWithSingleUseOptions(
516516
*client_, [](CommitResult const& result) {
517517
return Transaction::SingleUseOptions(
@@ -520,7 +520,7 @@ TEST_F(ClientIntegrationTest, ExecuteQuery_BoundedStaleness_Timestamp) {
520520
}
521521

522522
/// @test Test ExecuteQuery() with bounded staleness set by duration.
523-
TEST_F(ClientIntegrationTest, ExecuteQuery_BoundedStaleness_Duration) {
523+
TEST_F(ClientIntegrationTest, ExecuteQueryBoundedStalenessDuration) {
524524
CheckExecuteQueryWithSingleUseOptions(*client_, [](CommitResult const&) {
525525
// We want a duration sufficiently recent to include the latest commit.
526526
return Transaction::SingleUseOptions(
@@ -530,14 +530,14 @@ TEST_F(ClientIntegrationTest, ExecuteQuery_BoundedStaleness_Duration) {
530530

531531
/// @test Test ExecuteQuery() with exact staleness set to "all previous
532532
/// transactions".
533-
TEST_F(ClientIntegrationTest, ExecuteQuery_ExactStaleness_Latest) {
533+
TEST_F(ClientIntegrationTest, ExecuteQueryExactStalenessLatest) {
534534
CheckExecuteQueryWithSingleUseOptions(*client_, [](CommitResult const&) {
535535
return Transaction::SingleUseOptions(Transaction::ReadOnlyOptions());
536536
});
537537
}
538538

539539
/// @test Test ExecuteQuery() with exact staleness set by a timestamp.
540-
TEST_F(ClientIntegrationTest, ExecuteQuery_ExactStaleness_Timestamp) {
540+
TEST_F(ClientIntegrationTest, ExecuteQueryExactStalenessTimestamp) {
541541
CheckExecuteQueryWithSingleUseOptions(
542542
*client_, [](CommitResult const& result) {
543543
return Transaction::SingleUseOptions(Transaction::ReadOnlyOptions(
@@ -546,7 +546,7 @@ TEST_F(ClientIntegrationTest, ExecuteQuery_ExactStaleness_Timestamp) {
546546
}
547547

548548
/// @test Test ExecuteQuery() with exact staleness set by duration.
549-
TEST_F(ClientIntegrationTest, ExecuteQuery_ExactStaleness_Duration) {
549+
TEST_F(ClientIntegrationTest, ExecuteQueryExactStalenessDuration) {
550550
CheckExecuteQueryWithSingleUseOptions(*client_, [](CommitResult const&) {
551551
return Transaction::SingleUseOptions(Transaction::ReadOnlyOptions(
552552
/*exact_staleness=*/std::chrono::nanoseconds(0)));

google/cloud/spanner/internal/connection_impl_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,7 +1266,7 @@ TEST(ConnectionImplTest, ExecutePartitionedDmlDeleteTooManyTransientFailures) {
12661266
}
12671267

12681268
TEST(ConnectionImplTest,
1269-
ExecutePartitionedDmlDelete_BeginTransactionPermanentFailure) {
1269+
ExecutePartitionedDmlDeleteBeginTransactionPermanentFailure) {
12701270
auto mock = std::make_shared<spanner_testing::MockSpannerStub>();
12711271
auto db = Database("dummy_project", "dummy_instance", "dummy_database_id");
12721272
auto conn = MakeConnection(db, {mock});
@@ -1287,7 +1287,7 @@ TEST(ConnectionImplTest,
12871287
}
12881288

12891289
TEST(ConnectionImplTest,
1290-
ExecutePartitionedDmlDelete_BeginTransactionTooManyTransientFailures) {
1290+
ExecutePartitionedDmlDeleteBeginTransactionTooManyTransientFailures) {
12911291
auto mock = std::make_shared<spanner_testing::MockSpannerStub>();
12921292
auto db = Database("dummy_project", "dummy_instance", "dummy_database_id");
12931293
auto conn = MakeLimitedRetryConnection(db, mock);

google/cloud/spanner/internal/database_admin_logging_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class DatabaseAdminLoggingTest : public ::testing::Test {
4545
logger_id_ = 0;
4646
}
4747

48-
Status TransientError() {
48+
static Status TransientError() {
4949
return Status(StatusCode::kUnavailable, "try-again");
5050
}
5151

google/cloud/spanner/internal/database_admin_metadata_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class DatabaseAdminMetadataTest : public ::testing::Test {
3939

4040
void TearDown() override {}
4141

42-
Status TransientError() {
42+
static Status TransientError() {
4343
return Status(StatusCode::kUnavailable, "try-again");
4444
}
4545

google/cloud/spanner/internal/instance_admin_logging_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class InstanceAdminLoggingTest : public ::testing::Test {
4545
logger_id_ = 0;
4646
}
4747

48-
Status TransientError() {
48+
static Status TransientError() {
4949
return Status(StatusCode::kUnavailable, "try-again");
5050
}
5151

google/cloud/spanner/internal/instance_admin_metadata_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class InstanceAdminMetadataTest : public ::testing::Test {
3939

4040
void TearDown() override {}
4141

42-
Status TransientError() {
42+
static Status TransientError() {
4343
return Status(StatusCode::kUnavailable, "try-again");
4444
}
4545

google/cloud/spanner/internal/logging_spanner_stub_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class LoggingSpannerStubTest : public ::testing::Test {
4545
logger_id_ = 0;
4646
}
4747

48-
Status TransientError() {
48+
static Status TransientError() {
4949
return Status(StatusCode::kUnavailable, "try-again");
5050
}
5151

google/cloud/spanner/internal/metadata_spanner_stub_test.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,16 @@ class MetadataSpannerStubTest : public ::testing::Test {
4444

4545
void TearDown() override {}
4646

47-
Status TransientError() {
47+
static Status TransientError() {
4848
return Status(StatusCode::kUnavailable, "try-again");
4949
}
5050

5151
template <typename T>
52-
void ExpectTransientError(StatusOr<T> const& status) {
52+
static void ExpectTransientError(StatusOr<T> const& status) {
5353
EXPECT_EQ(TransientError(), status.status());
5454
}
5555

56-
void ExpectTransientError(Status const& status) {
56+
static void ExpectTransientError(Status const& status) {
5757
EXPECT_EQ(TransientError(), status);
5858
}
5959

google/cloud/spanner/internal/time_utils_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ inline namespace SPANNER_CLIENT_NS {
2424
namespace internal {
2525
namespace {
2626

27-
TEST(time_utils, ConvertTimePointToProtoTimestamp) {
27+
TEST(TimeUtils, ConvertTimePointToProtoTimestamp) {
2828
auto const epoch = std::chrono::system_clock::from_time_t(0);
2929
auto t = epoch + std::chrono::seconds(123) + std::chrono::nanoseconds(456000);
3030
auto proto_timestamp = ConvertTimePointToProtoTimestamp(t);

0 commit comments

Comments
 (0)