diff --git a/core/src/detail/hash.h b/core/src/detail/hash.h index 0198554d..58694de3 100644 --- a/core/src/detail/hash.h +++ b/core/src/detail/hash.h @@ -11,7 +11,7 @@ namespace detail { /// It's the boundary condition of this serial functions. /// /// \param seed Not effect. -inline void hash_combine(std::size_t *seed) {} +inline void hash_combine(std::size_t */*seed*/) {} /// \brief Combine the given hash value with another obeject. /// diff --git a/core/tests/family_test.cc b/core/tests/family_test.cc index f26b16e1..455ad627 100644 --- a/core/tests/family_test.cc +++ b/core/tests/family_test.cc @@ -20,8 +20,8 @@ TEST(FamilyTest, labels) { {{const_label.name, const_label.value}}}; family.Add({{dynamic_label.name, dynamic_label.value}}); auto collected = family.Collect(); - ASSERT_GE(collected.size(), 1); - ASSERT_GE(collected.at(0).metric.size(), 1); + ASSERT_GE(collected.size(), 1U); + ASSERT_GE(collected.at(0).metric.size(), 1U); EXPECT_THAT(collected.at(0).metric.at(0).label, ::testing::ElementsAre(const_label, dynamic_label)); } @@ -31,8 +31,8 @@ TEST(FamilyTest, counter_value) { auto& counter = family.Add({}); counter.Increment(); auto collected = family.Collect(); - ASSERT_GE(collected.size(), 1); - ASSERT_GE(collected[0].metric.size(), 1); + ASSERT_GE(collected.size(), 1U); + ASSERT_GE(collected[0].metric.size(), 1U); EXPECT_EQ(1, collected[0].metric.at(0).counter.value); } @@ -42,8 +42,8 @@ TEST(FamilyTest, remove) { family.Add({{"name", "counter2"}}); family.Remove(&counter1); auto collected = family.Collect(); - ASSERT_GE(collected.size(), 1); - EXPECT_EQ(collected[0].metric.size(), 1); + ASSERT_GE(collected.size(), 1U); + EXPECT_EQ(collected[0].metric.size(), 1U); } TEST(FamilyTest, Histogram) { @@ -52,9 +52,9 @@ TEST(FamilyTest, Histogram) { Histogram::BucketBoundaries{0, 1, 2}); histogram1.Observe(0); auto collected = family.Collect(); - ASSERT_EQ(collected.size(), 1); - ASSERT_GE(collected[0].metric.size(), 1); - EXPECT_EQ(1, collected[0].metric.at(0).histogram.sample_count); + ASSERT_EQ(collected.size(), 1U); + ASSERT_GE(collected[0].metric.size(), 1U); + EXPECT_EQ(1U, collected[0].metric.at(0).histogram.sample_count); } TEST(FamilyTest, add_twice) { diff --git a/core/tests/histogram_test.cc b/core/tests/histogram_test.cc index 1ef26bd2..60aa75fb 100644 --- a/core/tests/histogram_test.cc +++ b/core/tests/histogram_test.cc @@ -11,7 +11,7 @@ TEST(HistogramTest, initialize_with_zero) { Histogram histogram{{}}; auto metric = histogram.Collect(); auto h = metric.histogram; - EXPECT_EQ(h.sample_count, 0); + EXPECT_EQ(h.sample_count, 0U); EXPECT_EQ(h.sample_sum, 0); } @@ -21,7 +21,7 @@ TEST(HistogramTest, sample_count) { histogram.Observe(200); auto metric = histogram.Collect(); auto h = metric.histogram; - EXPECT_EQ(h.sample_count, 2); + EXPECT_EQ(h.sample_count, 2U); } TEST(HistogramTest, sample_sum) { @@ -38,7 +38,7 @@ TEST(HistogramTest, bucket_size) { Histogram histogram{{1, 2}}; auto metric = histogram.Collect(); auto h = metric.histogram; - EXPECT_EQ(h.bucket.size(), 3); + EXPECT_EQ(h.bucket.size(), 3U); } TEST(HistogramTest, bucket_bounds) { @@ -58,8 +58,8 @@ TEST(HistogramTest, bucket_counts_not_reset_by_collection) { histogram.Observe(1.5); auto metric = histogram.Collect(); auto h = metric.histogram; - ASSERT_EQ(h.bucket.size(), 3); - EXPECT_EQ(h.bucket.at(1).cumulative_count, 2); + ASSERT_EQ(h.bucket.size(), 3U); + EXPECT_EQ(h.bucket.at(1).cumulative_count, 2U); } TEST(HistogramTest, cumulative_bucket_count) { @@ -73,10 +73,10 @@ TEST(HistogramTest, cumulative_bucket_count) { histogram.Observe(3); auto metric = histogram.Collect(); auto h = metric.histogram; - ASSERT_EQ(h.bucket.size(), 3); - EXPECT_EQ(h.bucket.at(0).cumulative_count, 3); - EXPECT_EQ(h.bucket.at(1).cumulative_count, 6); - EXPECT_EQ(h.bucket.at(2).cumulative_count, 7); + ASSERT_EQ(h.bucket.size(), 3U); + EXPECT_EQ(h.bucket.at(0).cumulative_count, 3U); + EXPECT_EQ(h.bucket.at(1).cumulative_count, 6U); + EXPECT_EQ(h.bucket.at(2).cumulative_count, 7U); } } // namespace diff --git a/core/tests/registry_test.cc b/core/tests/registry_test.cc index ee0b7d50..6c6ecc68 100644 --- a/core/tests/registry_test.cc +++ b/core/tests/registry_test.cc @@ -16,13 +16,13 @@ TEST(RegistryTest, collect_single_metric_family) { counter_family.Add({{"name", "counter1"}}); counter_family.Add({{"name", "counter2"}}); auto collected = registry.Collect(); - ASSERT_EQ(collected.size(), 1); + ASSERT_EQ(collected.size(), 1U); EXPECT_EQ(collected[0].name, "test"); EXPECT_EQ(collected[0].help, "a test"); - ASSERT_EQ(collected[0].metric.size(), 2); - ASSERT_EQ(collected[0].metric.at(0).label.size(), 1); + ASSERT_EQ(collected[0].metric.size(), 2U); + ASSERT_EQ(collected[0].metric.at(0).label.size(), 1U); EXPECT_EQ(collected[0].metric.at(0).label.at(0).name, "name"); - ASSERT_EQ(collected[0].metric.at(1).label.size(), 1); + ASSERT_EQ(collected[0].metric.at(1).label.size(), 1U); EXPECT_EQ(collected[0].metric.at(1).label.at(0).name, "name"); } @@ -34,7 +34,7 @@ TEST(RegistryTest, build_histogram_family) { Histogram::BucketBoundaries{0, 1, 2}); histogram.Observe(1.1); auto collected = registry.Collect(); - ASSERT_EQ(collected.size(), 1); + ASSERT_EQ(collected.size(), 1U); } } // namespace diff --git a/core/tests/summary_test.cc b/core/tests/summary_test.cc index 44133794..243a4dee 100644 --- a/core/tests/summary_test.cc +++ b/core/tests/summary_test.cc @@ -12,7 +12,7 @@ TEST(SummaryTest, initialize_with_zero) { Summary summary{Summary::Quantiles{}}; auto metric = summary.Collect(); auto s = metric.summary; - EXPECT_EQ(s.sample_count, 0); + EXPECT_EQ(s.sample_count, 0U); EXPECT_EQ(s.sample_sum, 0); } @@ -22,7 +22,7 @@ TEST(SummaryTest, sample_count) { summary.Observe(200); auto metric = summary.Collect(); auto s = metric.summary; - EXPECT_EQ(s.sample_count, 2); + EXPECT_EQ(s.sample_count, 2U); } TEST(SummaryTest, sample_sum) { @@ -39,14 +39,14 @@ TEST(SummaryTest, quantile_size) { Summary summary{Summary::Quantiles{{0.5, 0.05}, {0.90, 0.01}}}; auto metric = summary.Collect(); auto s = metric.summary; - EXPECT_EQ(s.quantile.size(), 2); + EXPECT_EQ(s.quantile.size(), 2U); } TEST(SummaryTest, quantile_bounds) { Summary summary{Summary::Quantiles{{0.5, 0.05}, {0.90, 0.01}, {0.99, 0.001}}}; auto metric = summary.Collect(); auto s = metric.summary; - ASSERT_EQ(s.quantile.size(), 3); + ASSERT_EQ(s.quantile.size(), 3U); EXPECT_DOUBLE_EQ(s.quantile.at(0).quantile, 0.5); EXPECT_DOUBLE_EQ(s.quantile.at(1).quantile, 0.9); EXPECT_DOUBLE_EQ(s.quantile.at(2).quantile, 0.99); @@ -60,7 +60,7 @@ TEST(SummaryTest, quantile_values) { auto metric = summary.Collect(); auto s = metric.summary; - ASSERT_EQ(s.quantile.size(), 3); + ASSERT_EQ(s.quantile.size(), 3U); EXPECT_NEAR(s.quantile.at(0).value, 0.5 * SAMPLES, 0.05 * SAMPLES); EXPECT_NEAR(s.quantile.at(1).value, 0.9 * SAMPLES, 0.01 * SAMPLES); @@ -75,7 +75,7 @@ TEST(SummaryTest, max_age) { static const auto test_value = [&summary](double ref) { auto metric = summary.Collect(); auto s = metric.summary; - ASSERT_EQ(s.quantile.size(), 1); + ASSERT_EQ(s.quantile.size(), 1U); if (std::isnan(ref)) EXPECT_TRUE(std::isnan(s.quantile.at(0).value)); diff --git a/pull/src/handler.cc b/pull/src/handler.cc index a81d7787..0a2e2676 100644 --- a/pull/src/handler.cc +++ b/pull/src/handler.cc @@ -113,7 +113,7 @@ static std::size_t WriteResponse(struct mg_connection* conn, return body.size(); } -bool MetricsHandler::handleGet(CivetServer* server, +bool MetricsHandler::handleGet(CivetServer* /*server*/, struct mg_connection* conn) { auto start_time_of_request = std::chrono::steady_clock::now(); diff --git a/pull/tests/integration/sample_server.cc b/pull/tests/integration/sample_server.cc index e71091b1..998d27aa 100644 --- a/pull/tests/integration/sample_server.cc +++ b/pull/tests/integration/sample_server.cc @@ -7,7 +7,7 @@ #include #include -int main(int argc, char** argv) { +int main() { using namespace prometheus; // create an http server running on port 8080 diff --git a/push/tests/integration/sample_client.cc b/push/tests/integration/sample_client.cc index aa8442f3..5c82070a 100644 --- a/push/tests/integration/sample_client.cc +++ b/push/tests/integration/sample_client.cc @@ -23,7 +23,7 @@ static std::string GetHostName() { return hostname; } -int main(int argc, char** argv) { +int main() { using namespace prometheus; // create a push gateway