[ros-users] [Discourse.ros.org] [Next Generation ROS] Adding…

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Emerson Knapp via Discourse.ros.org via ros-users
Date:  
To: ros-users
CC: Emerson Knapp via Discourse.ros.org
Subject: [ros-users] [Discourse.ros.org] [Next Generation ROS] Adding clang thread safety analysis for ROS2 core packages


Great! Done, thanks!

Another thought, it seems a little unwieldy to add this block to the `CMakeLists.txt` for every package that wants to use this analysis

```
# Enable thread safety annotations and analysis when using clang
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -std=c++14")
add_definitions(-D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS)
add_compile_options(-Wthread-safety)
endif()
```

Would there be a better way to either
1. Put that block in for all ament packages, so it's enabled globally, but only affects code that is annotated using the C++ macros
2. Add a cmake macro/function to enable it as a one-liner, like `ament_enable_thread_safety_analysis`?

@Thomas_Moulard maybe you have thoughts on this?





---
[Visit Topic](https://discourse.ros.org/t/adding-clang-thread-safety-analysis-for-ros2-core-packages/7930/12) or reply to this email to respond.


If you do not want to receive messages from ros-users please use the unsubscribe link below. If you use the one above, you will stop all of ros-users from receiving updates.
______________________________________________________________________________
ros-users mailing list

http://lists.ros.org/mailman/listinfo/ros-users
Unsubscribe: <http://lists.ros.org/mailman//options/ros-users>