Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Conversation

@swernli
Copy link
Collaborator

@swernli swernli commented Jul 14, 2020

This updates the CMake build configuration for the native simulator to use and require C++17. This will allow us to support C++17 specific features, such as std::optional and std::any.

#if (SAFEINT_COMPILER == CLANG_COMPILER || SAFEINT_COMPILER == GCC_COMPILER) && CPLUSPLUS_STD < CPLUSPLUS_11
#error Must compile with --std=c++11, preferably --std=c++14 to use constexpr improvements
#if (SAFEINT_COMPILER == CLANG_COMPILER || SAFEINT_COMPILER == GCC_COMPILER) && CPLUSPLUS_STD < CPLUSPLUS_17
#error Must compile with --std=c++17
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Note that this changes the build requirement for clang and gcc to C++17, where previously this file would have accepted and attempted to handle anything down to C++11. That said, the CMakeLists.txt for all the code under src\Native already had C++14 as the required standard, so I don't believe our support of C++11 was genuine here. Given that after this switch we will start incorporating C++17 only features, it felt appropriate to update this requirement too.

Copy link
Contributor

@dbwz8 dbwz8 left a comment

Choose a reason for hiding this comment

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

I assume you've tested the build on both Windows and Linux.

@swernli
Copy link
Collaborator Author

swernli commented Jul 14, 2020

@dbwz8 Yup, I tested these changes over here: #309. That included an actual usage of std::optional so that I could be sure that the Linux and Mac pipelines built as expected, and manually inspected the pipeline logs to double check.

@swernli swernli requested a review from matthiastroyer July 14, 2020 23:19
@swernli swernli merged commit a2064f7 into master Jul 15, 2020
@swernli swernli deleted the swernli/cplusplus17 branch September 4, 2020 05:11
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants