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

Fix/implement C++2020 compilation, tests, and CI #1017

Merged
merged 4 commits into from
Dec 9, 2021

Conversation

dmitrykobets-msft
Copy link
Member

@dmitrykobets-msft dmitrykobets-msft commented Nov 29, 2021

The C++2020 features (std::span support) were not enabled in the CI. As a result, the code had compilation issues that were never caught. Furthermore, the compiler versions in the README did not match up to the compilers that were actually being tested. For instance, the minimum GCC version advertised is 8, but we are testing 7.5.0 instead. The precise versions we should be testing will be re-visited in a later PR. But for now, this PR simply updates the README to be accurate to what is currently being tested.

Compiler Advertised (before this PR) Actually Tested
XCode 11.4 & 10.3 12.4 & 11.3
GCC 9 & 8 9.3.0 & 7.5.0
Clang 11 & 10 11.0.0 & 9.0.0
Visual Studio with MSVC VS2017 (15.9) & VS2019 (16.4) VS2017 (15.9.21) & VS2019 (16.11.2)
Visual Studio with LLVM VS2017 (Clang 9) & VS2019 (Clang 10) none

Previously, the guard for the span tests was __cplusplus >= 202002L. Unfortunately, this does not work for all compilers. For instance, in GCC 10, running with -std=c++20 will fail the above condition (__cplusplus will still be at 2017), and yet __cpp_lib_span >= 202002L will be true. But for GCC 9 and GCC 8, __cplusplus will still be at 2017 and __cpp_lib_span is undefined (neither have <span> support). In all cases above, the span tests will be silently skipped.
To avoid this confusing / incorrect (in the case of GCC 10) behavior, make the span tests execute unconditionally if running in CI mode with C++20 enabled. If a compiler version does not support span, the C++20 version should be explicitly removed from its CI jobs.

@SloppyJaconda
Copy link
Contributor

Out of curiosity, is there a specific issue that you're looking to fix with this?

@dmitrykobets-msft
Copy link
Member Author

@SloppyJaconda It appears that the C++20 feature support actually had compilation / syntax errors. This was hidden because C++20 was never part of the CI pipeline, so the tests were never run. So this PR fixes those errors and attempts to enable C++20 in the CI

@dmitrykobets-msft dmitrykobets-msft force-pushed the dmitrykobets-msft/fix-span-2020 branch 24 times, most recently from 6a657c0 to b07cd48 Compare December 3, 2021 22:57
@dmitrykobets-msft dmitrykobets-msft force-pushed the dmitrykobets-msft/fix-span-2020 branch 13 times, most recently from 6ad2fa3 to e3567c5 Compare December 7, 2021 19:07
@dmitrykobets-msft dmitrykobets-msft changed the title Dmitrykobets msft/fix span 2020 Fix/implement C++2020 compilation, tests, and CI Dec 7, 2021
@dmitrykobets-msft dmitrykobets-msft force-pushed the dmitrykobets-msft/fix-span-2020 branch 10 times, most recently from 7bfc115 to f02afb1 Compare December 7, 2021 21:49
@dmitrykobets-msft dmitrykobets-msft marked this pull request as ready for review December 7, 2021 22:07
Copy link

@sunnychatterjee sunnychatterjee 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 cleaning this up! Changes look good to me.

@dmitrykobets-msft dmitrykobets-msft merged commit bcf008a into main Dec 9, 2021
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.

None yet

3 participants