Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUILD] Introduce CXX 20 CI pipeline for MSVC/Windows #2450

Merged
merged 13 commits into from
Dec 14, 2023

Conversation

ThomsonTan
Copy link
Contributor

@ThomsonTan ThomsonTan commented Dec 13, 2023

Fixes # (issue)

Changes

Please provide a brief description of the changes here.

For significant contributions please make sure you have completed the following items:

  • CHANGELOG.md updated for non-trivial changes
  • Unit tests have been added
  • Changes in public API reviewed

@ThomsonTan ThomsonTan requested a review from a team December 13, 2023 21:56
Copy link

codecov bot commented Dec 13, 2023

Codecov Report

Merging #2450 (d029d19) into main (ab440e4) will not change coverage.
The diff coverage is n/a.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2450   +/-   ##
=======================================
  Coverage   87.06%   87.06%           
=======================================
  Files         199      199           
  Lines        6087     6087           
=======================================
  Hits         5299     5299           
  Misses        788      788           

@ThomsonTan ThomsonTan marked this pull request as draft December 13, 2023 23:49
@ThomsonTan ThomsonTan marked this pull request as ready for review December 14, 2023 06:15
Copy link
Member

@marcalff marcalff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the better CI coverage.

See comments on unit tests, about C++17 vs C++20.

@@ -48,7 +48,7 @@ TEST(VariantTest, Get)
EXPECT_EQ(nostd::get<int>(w), 12);
EXPECT_EQ(*nostd::get_if<int>(&v), 12);
EXPECT_EQ(nostd::get_if<float>(&v), nullptr);
#if __EXCEPTIONS
#if __EXCEPTIONS || (defined(OPENTELEMETRY_STL_VERSION) && (OPENTELEMETRY_STL_VERSION >= 2020))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std::variant is introduced in C++17, not C++20.

Please investigate (local CXX 17 MSVC build) if the logic should be OPENTELEMETRY_STL_VERSION >= 2017 instead.

Also, somehow the existing code passed in C++14, C++17, C++20 builds in CI with GCC.

Not sure which platform and/or which compiler do set __EXCEPTIONS, please clarify if you know the context.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found out that __EXCEPTIONS is set by GCC and Clang, except when building with -fno-exceptions.

This is likely why a GCC build with exceptions passed this test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for looking into it. Will try MSVC C++ 17 build.

Copy link
Contributor Author

@ThomsonTan ThomsonTan Dec 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified that bad_variant_access exception was thrown out with MSVC/C++17. Thanks for the catch.

Comment on lines 74 to 75
#if __EXCEPTIONS || (defined(OPENTELEMETRY_STL_VERSION) && (OPENTELEMETRY_STL_VERSION >= 2020))
EXPECT_THROW((void)s.substr(10), std::out_of_range);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect the existing code was incorrect, as std::string_view is introduced in C++17, not C++20.

Please investigate (local CXX 17 MSVC build) if the logic should be OPENTELEMETRY_STL_VERSION >= 2017 instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified that std::out_of_range exception was thrown out with MSVC/C++17. Thanks for the catch.

@marcalff marcalff merged commit 03f2a69 into open-telemetry:main Dec 14, 2023
46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants