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

use target_compile_features() to require C++17 features #1613

Closed
wants to merge 1 commit into from

Conversation

sloretz
Copy link
Contributor

@sloretz sloretz commented Apr 1, 2021

Requires ament/googletest#15

Draft, because @audrow has a similar change and is seeing failures in rqt_gui_cpp

@sloretz sloretz requested a review from wjwwood April 1, 2021 21:36
@sloretz sloretz self-assigned this Apr 1, 2021
@sloretz sloretz requested a review from Karsten1987 April 1, 2021 21:37
Copy link
Member

@wjwwood wjwwood left a comment

Choose a reason for hiding this comment

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

I have a similar patch in #1598 and it failed to build rqt_gui_cpp, which is what @audrow was looking into:

https://ci.ros2.org/job/ci_linux/14187/consoleFull

@sloretz
Copy link
Contributor Author

sloretz commented Apr 1, 2021

I have a similar patch in #1452 and it failed to build rqt_gui_cpp

I'm unable to reproduce that failure locally with --packages-above-and-dependencies rclcpp, this PR, ament/googletest#15, and this extra C++17 include (@audrow's idea to act as a canary if downstream of rclcpp someone builds with less than C++17 support).

diff --git a/rclcpp/include/rclcpp/rclcpp.hpp b/rclcpp/include/rclcpp/rclcpp.hpp
index 56e999f7..3a3383e3 100644
--- a/rclcpp/include/rclcpp/rclcpp.hpp
+++ b/rclcpp/include/rclcpp/rclcpp.hpp
@@ -142,6 +142,7 @@
 
 #include <csignal>
 #include <memory>
+#include <variant>
 
 #include "rclcpp/executors.hpp"
 #include "rclcpp/guard_condition.hpp"

Without steps to reproduce, I'll un-draft this one and run full CI

@sloretz sloretz marked this pull request as ready for review April 1, 2021 22:28
@sloretz
Copy link
Contributor Author

sloretz commented Apr 1, 2021

CI (build: --packages-above-and-dependencies rclcpp test: --packages-select rclcpp)

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@sloretz
Copy link
Contributor Author

sloretz commented Apr 1, 2021

It needed a bigger diff, including the c++17 header isn't enough to trigger compiler errors

diff --git a/rclcpp/include/rclcpp/rclcpp.hpp b/rclcpp/include/rclcpp/rclcpp.hpp
index 56e999f7..faf88911 100644
--- a/rclcpp/include/rclcpp/rclcpp.hpp
+++ b/rclcpp/include/rclcpp/rclcpp.hpp
@@ -142,6 +142,7 @@
 
 #include <csignal>
 #include <memory>
+#include <variant>
 
 #include "rclcpp/executors.hpp"
 #include "rclcpp/guard_condition.hpp"
@@ -158,4 +159,11 @@
 #include "rclcpp/waitable.hpp"
 #include "rclcpp/wait_set.hpp"
 
+inline
+void
+use_cpp17()
+{
+  std::variant<int, float> foobar;
+}
+

@sloretz
Copy link
Contributor Author

sloretz commented Apr 1, 2021

Got steps to reproduce, one more fix needed: ros-visualization/rqt#246

Copy link
Member

@wjwwood wjwwood left a comment

Choose a reason for hiding this comment

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

lgtm

This is essentially what is in #1598.

I think, if CI is good, we should merge the other two prs, but not this one. It makes more sense to me turn on this requirement for rclcpp when we introduce the need. And the other two prs are good to have either way.

@wjwwood
Copy link
Member

wjwwood commented Apr 2, 2021

We're gonna close this in favor of #1598.

@wjwwood wjwwood closed this Apr 2, 2021
@wjwwood
Copy link
Member

wjwwood commented Apr 2, 2021

Thanks for figuring out the details and fixing issues @sloretz!

@wjwwood wjwwood deleted the use_tgt_compile_features branch April 2, 2021 22:27
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