From 1f6e100c44a1b3e7ac029e1f8d102df87e7c3bf6 Mon Sep 17 00:00:00 2001 From: Lalit Date: Tue, 3 Jan 2023 07:13:43 -0800 Subject: [PATCH 01/12] enforce virtual desct --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b17b207ae..77e8340b42 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -445,6 +445,7 @@ if(OTELCPP_MAINTAINER_MODE) add_compile_options(/wd4267) # Enforced warnings + add_compileoptions(/we4265) elseif() message(FATAL_ERROR "Building with unknown compiler in maintainer mode.") endif() From 639b80e7488fca1a0fc77c344d571f31386f39a8 Mon Sep 17 00:00:00 2001 From: Lalit Date: Tue, 3 Jan 2023 10:45:51 -0800 Subject: [PATCH 02/12] fix --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 77e8340b42..97e1d7f556 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -445,7 +445,7 @@ if(OTELCPP_MAINTAINER_MODE) add_compile_options(/wd4267) # Enforced warnings - add_compileoptions(/we4265) + add_compile_options(/we4265) elseif() message(FATAL_ERROR "Building with unknown compiler in maintainer mode.") endif() From f2b1b47289a7a61ea516bac4f78de7f7e675d582 Mon Sep 17 00:00:00 2001 From: Lalit Date: Tue, 3 Jan 2023 11:28:59 -0800 Subject: [PATCH 03/12] Fix --- ci/do_ci.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/do_ci.ps1 b/ci/do_ci.ps1 index 4ca64c0924..5761bfc151 100644 --- a/ci/do_ci.ps1 +++ b/ci/do_ci.ps1 @@ -52,6 +52,7 @@ switch ($action) { cd "$BUILD_DIR" cmake $SRC_DIR ` -DOTELCPP_MAINTAINER_MODE=ON ` + -DWITH_ETW=ON ` -DVCPKG_TARGET_TRIPLET=x64-windows ` "-DCMAKE_TOOLCHAIN_FILE=$VCPKG_DIR/scripts/buildsystems/vcpkg.cmake" $exit = $LASTEXITCODE From 35eeb6dd43608f5c077375355f868e1893597e1f Mon Sep 17 00:00:00 2001 From: Lalit Date: Tue, 3 Jan 2023 12:21:37 -0800 Subject: [PATCH 04/12] fix --- ci/do_ci.ps1 | 1 - 1 file changed, 1 deletion(-) diff --git a/ci/do_ci.ps1 b/ci/do_ci.ps1 index 5761bfc151..4ca64c0924 100644 --- a/ci/do_ci.ps1 +++ b/ci/do_ci.ps1 @@ -52,7 +52,6 @@ switch ($action) { cd "$BUILD_DIR" cmake $SRC_DIR ` -DOTELCPP_MAINTAINER_MODE=ON ` - -DWITH_ETW=ON ` -DVCPKG_TARGET_TRIPLET=x64-windows ` "-DCMAKE_TOOLCHAIN_FILE=$VCPKG_DIR/scripts/buildsystems/vcpkg.cmake" $exit = $LASTEXITCODE From 5f891445aded79ebc025fad299e418d97cdb7456 Mon Sep 17 00:00:00 2001 From: Lalit Date: Tue, 3 Jan 2023 15:16:42 -0800 Subject: [PATCH 05/12] fix --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 97e1d7f556..d7d26b74c9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -446,6 +446,8 @@ if(OTELCPP_MAINTAINER_MODE) # Enforced warnings add_compile_options(/we4265) + add_compile_options(/we5204) + elseif() message(FATAL_ERROR "Building with unknown compiler in maintainer mode.") endif() From 4b81923cad75461ac1293c612034c836b420b59e Mon Sep 17 00:00:00 2001 From: Lalit Date: Tue, 3 Jan 2023 15:45:35 -0800 Subject: [PATCH 06/12] fix --- CMakeLists.txt | 6 ++++-- .../include/opentelemetry/exporters/etw/etw_tail_sampler.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d7d26b74c9..9c010e6eea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -445,8 +445,10 @@ if(OTELCPP_MAINTAINER_MODE) add_compile_options(/wd4267) # Enforced warnings - add_compile_options(/we4265) - add_compile_options(/we5204) + add_compile_options(/we4265) # 'class': class has virtual functions, but + # destructor is not virtual + add_compile_options(/we5204) # A class with virtual functions has + # non-virtual trivial destructor. elseif() message(FATAL_ERROR "Building with unknown compiler in maintainer mode.") diff --git a/exporters/etw/include/opentelemetry/exporters/etw/etw_tail_sampler.h b/exporters/etw/include/opentelemetry/exporters/etw/etw_tail_sampler.h index c4d0a2edd7..c7fa7ec0cf 100644 --- a/exporters/etw/include/opentelemetry/exporters/etw/etw_tail_sampler.h +++ b/exporters/etw/include/opentelemetry/exporters/etw/etw_tail_sampler.h @@ -21,6 +21,7 @@ class TailSampler // Span::GetContext() virtual opentelemetry::sdk::trace::SamplingResult ShouldSample( const opentelemetry::trace::Span &span) noexcept = 0; + virtual ~TailSampler() = default; }; class AlwaysOnTailSampler : public TailSampler From a235d4f8e43b20a1b4fb444ccc894066aba42752 Mon Sep 17 00:00:00 2001 From: Lalit Date: Tue, 3 Jan 2023 16:44:17 -0800 Subject: [PATCH 07/12] fix --- sdk/src/metrics/export/periodic_exporting_metric_reader.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/sdk/src/metrics/export/periodic_exporting_metric_reader.cc b/sdk/src/metrics/export/periodic_exporting_metric_reader.cc index 4220509b74..9316049fd8 100644 --- a/sdk/src/metrics/export/periodic_exporting_metric_reader.cc +++ b/sdk/src/metrics/export/periodic_exporting_metric_reader.cc @@ -1,6 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +#pragma warning(disable : 5204) #include "opentelemetry/sdk/metrics/export/periodic_exporting_metric_reader.h" #include "opentelemetry/sdk/common/global_log_handler.h" #include "opentelemetry/sdk/metrics/push_metric_exporter.h" From 1d11519ed23d67e9e05466e989427b6ebd751aa7 Mon Sep 17 00:00:00 2001 From: Lalit Kumar Bhasin Date: Tue, 3 Jan 2023 22:15:20 -0800 Subject: [PATCH 08/12] fix --- api/test/nostd/span_test.cc | 4 ++-- examples/http/client.cc | 2 +- examples/http/server.cc | 2 +- .../ext/http/client/curl/http_operation_curl.h | 4 ++++ sdk/src/metrics/export/periodic_exporting_metric_reader.cc | 4 +++- sdk/test/trace/tracer_test.cc | 6 +++--- 6 files changed, 14 insertions(+), 8 deletions(-) diff --git a/api/test/nostd/span_test.cc b/api/test/nostd/span_test.cc index 09d32ecfb8..98e825142d 100644 --- a/api/test/nostd/span_test.cc +++ b/api/test/nostd/span_test.cc @@ -182,10 +182,10 @@ TEST(SpanTest, Iteration) std::array array = {1, 2, 3}; span s1{array.data(), array.size()}; - EXPECT_EQ(std::distance(s1.begin(), s1.end()), array.size()); + EXPECT_EQ(std::distance(s1.begin(), s1.end()), (ptrdiff_t)array.size()); EXPECT_TRUE(std::equal(s1.begin(), s1.end(), array.begin())); span s2{array.data(), array.size()}; - EXPECT_EQ(std::distance(s2.begin(), s2.end()), array.size()); + EXPECT_EQ(std::distance(s2.begin(), s2.end()), (ptrdiff_t)array.size()); EXPECT_TRUE(std::equal(s2.begin(), s2.end(), array.begin())); } diff --git a/examples/http/client.cc b/examples/http/client.cc index 9525b297e1..0e3414fb85 100644 --- a/examples/http/client.cc +++ b/examples/http/client.cc @@ -82,7 +82,7 @@ int main(int argc, char *argv[]) // The port the validation service listens to can be specified via the command line. if (argc > 1) { - port = atoi(argv[1]); + port = (uint16_t)(atoi(argv[1])); } else { diff --git a/examples/http/server.cc b/examples/http/server.cc index 87a95500db..d550ccf22a 100644 --- a/examples/http/server.cc +++ b/examples/http/server.cc @@ -75,7 +75,7 @@ int main(int argc, char *argv[]) // The port the validation service listens to can be specified via the command line. if (argc > 1) { - server_port = atoi(argv[1]); + server_port = (uint16_t)atoi(argv[1]); } HttpServer http_server(server_name, server_port); diff --git a/ext/include/opentelemetry/ext/http/client/curl/http_operation_curl.h b/ext/include/opentelemetry/ext/http/client/curl/http_operation_curl.h index d1c6e16d96..bf5645f876 100644 --- a/ext/include/opentelemetry/ext/http/client/curl/http_operation_curl.h +++ b/ext/include/opentelemetry/ext/http/client/curl/http_operation_curl.h @@ -6,7 +6,11 @@ #include "opentelemetry/ext/http/client/http_client.h" #include "opentelemetry/version.h" +//#pragma warning(push) +#pragma warning(suppress : 5204) #include +//#pragma warning(pop) + #include #include #include diff --git a/sdk/src/metrics/export/periodic_exporting_metric_reader.cc b/sdk/src/metrics/export/periodic_exporting_metric_reader.cc index 9316049fd8..62c664b7cc 100644 --- a/sdk/src/metrics/export/periodic_exporting_metric_reader.cc +++ b/sdk/src/metrics/export/periodic_exporting_metric_reader.cc @@ -1,13 +1,15 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#pragma warning(disable : 5204) #include "opentelemetry/sdk/metrics/export/periodic_exporting_metric_reader.h" #include "opentelemetry/sdk/common/global_log_handler.h" #include "opentelemetry/sdk/metrics/push_metric_exporter.h" #include +//#pragma warning(push) +#pragma warning(suppress : 5204) #include +//#pragma warning(pop) OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk diff --git a/sdk/test/trace/tracer_test.cc b/sdk/test/trace/tracer_test.cc index 3287b39e5d..399c3c6d9f 100644 --- a/sdk/test/trace/tracer_test.cc +++ b/sdk/test/trace/tracer_test.cc @@ -271,11 +271,11 @@ TEST(Tracer, StartSpanWithAttributes) ASSERT_EQ(9, cur_span_data->GetAttributes().size()); ASSERT_EQ(314159, nostd::get(cur_span_data->GetAttributes().at("attr1"))); ASSERT_EQ(false, nostd::get(cur_span_data->GetAttributes().at("attr2"))); - ASSERT_EQ(314159, nostd::get(cur_span_data->GetAttributes().at("attr3"))); + ASSERT_EQ((uint32_t)314159, nostd::get(cur_span_data->GetAttributes().at("attr3"))); ASSERT_EQ(-20, nostd::get(cur_span_data->GetAttributes().at("attr4"))); - ASSERT_EQ(20, nostd::get(cur_span_data->GetAttributes().at("attr5"))); + ASSERT_EQ((uint32_t)20, nostd::get(cur_span_data->GetAttributes().at("attr5"))); ASSERT_EQ(-20, nostd::get(cur_span_data->GetAttributes().at("attr6"))); - ASSERT_EQ(20, nostd::get(cur_span_data->GetAttributes().at("attr7"))); + ASSERT_EQ((uint64_t)20, nostd::get(cur_span_data->GetAttributes().at("attr7"))); ASSERT_EQ(3.1, nostd::get(cur_span_data->GetAttributes().at("attr8"))); ASSERT_EQ("string", nostd::get(cur_span_data->GetAttributes().at("attr9"))); From 6fcf878d6117870209567aeac002a21d7404c687 Mon Sep 17 00:00:00 2001 From: Lalit Kumar Bhasin Date: Tue, 3 Jan 2023 22:17:59 -0800 Subject: [PATCH 09/12] fix --- .../opentelemetry/ext/http/client/curl/http_operation_curl.h | 4 ++-- sdk/src/metrics/export/periodic_exporting_metric_reader.cc | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ext/include/opentelemetry/ext/http/client/curl/http_operation_curl.h b/ext/include/opentelemetry/ext/http/client/curl/http_operation_curl.h index bf5645f876..8515f57a13 100644 --- a/ext/include/opentelemetry/ext/http/client/curl/http_operation_curl.h +++ b/ext/include/opentelemetry/ext/http/client/curl/http_operation_curl.h @@ -6,10 +6,10 @@ #include "opentelemetry/ext/http/client/http_client.h" #include "opentelemetry/version.h" -//#pragma warning(push) +#if defined(_MSC_VER) #pragma warning(suppress : 5204) +#endif #include -//#pragma warning(pop) #include #include diff --git a/sdk/src/metrics/export/periodic_exporting_metric_reader.cc b/sdk/src/metrics/export/periodic_exporting_metric_reader.cc index 62c664b7cc..4769b6169d 100644 --- a/sdk/src/metrics/export/periodic_exporting_metric_reader.cc +++ b/sdk/src/metrics/export/periodic_exporting_metric_reader.cc @@ -6,10 +6,10 @@ #include "opentelemetry/sdk/metrics/push_metric_exporter.h" #include -//#pragma warning(push) +#if defined(_MSC_VER) #pragma warning(suppress : 5204) +#endif #include -//#pragma warning(pop) OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk From caf8a04fedaeeca9520a6ecbe0590c40acf85e9a Mon Sep 17 00:00:00 2001 From: Lalit Date: Tue, 3 Jan 2023 22:19:02 -0800 Subject: [PATCH 10/12] format --- .../opentelemetry/ext/http/client/curl/http_operation_curl.h | 2 +- sdk/src/metrics/export/periodic_exporting_metric_reader.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/include/opentelemetry/ext/http/client/curl/http_operation_curl.h b/ext/include/opentelemetry/ext/http/client/curl/http_operation_curl.h index 8515f57a13..089662c86d 100644 --- a/ext/include/opentelemetry/ext/http/client/curl/http_operation_curl.h +++ b/ext/include/opentelemetry/ext/http/client/curl/http_operation_curl.h @@ -7,7 +7,7 @@ #include "opentelemetry/version.h" #if defined(_MSC_VER) -#pragma warning(suppress : 5204) +# pragma warning(suppress : 5204) #endif #include diff --git a/sdk/src/metrics/export/periodic_exporting_metric_reader.cc b/sdk/src/metrics/export/periodic_exporting_metric_reader.cc index 4769b6169d..24ddff6dbe 100644 --- a/sdk/src/metrics/export/periodic_exporting_metric_reader.cc +++ b/sdk/src/metrics/export/periodic_exporting_metric_reader.cc @@ -7,7 +7,7 @@ #include #if defined(_MSC_VER) -#pragma warning(suppress : 5204) +# pragma warning(suppress : 5204) #endif #include From c9db804b8fceb22dde9f2a2db02008d196d8d495 Mon Sep 17 00:00:00 2001 From: Lalit Kumar Bhasin Date: Tue, 3 Jan 2023 22:32:31 -0800 Subject: [PATCH 11/12] fix --- .../opentelemetry/ext/http/client/curl/http_operation_curl.h | 4 +++- sdk/src/metrics/export/periodic_exporting_metric_reader.cc | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ext/include/opentelemetry/ext/http/client/curl/http_operation_curl.h b/ext/include/opentelemetry/ext/http/client/curl/http_operation_curl.h index 089662c86d..e0f2c3e1ba 100644 --- a/ext/include/opentelemetry/ext/http/client/curl/http_operation_curl.h +++ b/ext/include/opentelemetry/ext/http/client/curl/http_operation_curl.h @@ -8,8 +8,10 @@ #if defined(_MSC_VER) # pragma warning(suppress : 5204) -#endif +# include +#else #include +#endif #include #include diff --git a/sdk/src/metrics/export/periodic_exporting_metric_reader.cc b/sdk/src/metrics/export/periodic_exporting_metric_reader.cc index 24ddff6dbe..6aaca901cd 100644 --- a/sdk/src/metrics/export/periodic_exporting_metric_reader.cc +++ b/sdk/src/metrics/export/periodic_exporting_metric_reader.cc @@ -8,8 +8,10 @@ #include #if defined(_MSC_VER) # pragma warning(suppress : 5204) -#endif +# include +#else #include +#endif OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk From 7dfaf0e42bc92549d85976c370f6965466bc4768 Mon Sep 17 00:00:00 2001 From: Lalit Date: Tue, 3 Jan 2023 22:33:50 -0800 Subject: [PATCH 12/12] fix --- .../opentelemetry/ext/http/client/curl/http_operation_curl.h | 4 ++-- sdk/src/metrics/export/periodic_exporting_metric_reader.cc | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ext/include/opentelemetry/ext/http/client/curl/http_operation_curl.h b/ext/include/opentelemetry/ext/http/client/curl/http_operation_curl.h index e0f2c3e1ba..eb3fd186df 100644 --- a/ext/include/opentelemetry/ext/http/client/curl/http_operation_curl.h +++ b/ext/include/opentelemetry/ext/http/client/curl/http_operation_curl.h @@ -8,9 +8,9 @@ #if defined(_MSC_VER) # pragma warning(suppress : 5204) -# include +# include #else -#include +# include #endif #include diff --git a/sdk/src/metrics/export/periodic_exporting_metric_reader.cc b/sdk/src/metrics/export/periodic_exporting_metric_reader.cc index 6aaca901cd..1d2f96db00 100644 --- a/sdk/src/metrics/export/periodic_exporting_metric_reader.cc +++ b/sdk/src/metrics/export/periodic_exporting_metric_reader.cc @@ -8,9 +8,9 @@ #include #if defined(_MSC_VER) # pragma warning(suppress : 5204) -# include +# include #else -#include +# include #endif OPENTELEMETRY_BEGIN_NAMESPACE