Skip to content

compile with stricter compiler options where it's not too cumbersome #305

Closed

Description

@mikaelarguedas

follow up of ros2/rclcpp#253
I created pedantic branch for most ros2 specific repos. This branch simply passes -Wpedantic to GCC and CLANG

The goal of the issue is to keep track of which packages don't comply with stricter rules and the reason why. This is also a place to gather feedback on which ones are worth changing to comply with stricter compiler rules.

Packages not patched (yet ?):
class_loader and every package depending on it:
- trying to diverge as less as possible from master to facilitate backports later on:
- class_loader: now compiles with pedantic

  • console_bridge: fails on MacOS: Compiler warnings on OSX due to the use of ## __VA_ARGS__ ros/console_bridge#55
    - python message generation:
    - pedantic doesn't like casting pointers <=> function pointers. This is used heavily in python generated messages to convert data structures (fixed as of compile with stricter compiler options where it's not too cumbersome #305 (comment))
  • rcl:
    • the memory tools redefine a bunch of memory functions (malloc, realloc etc) but without the proper flags and attributes so build fails with pedantic. It may be cumbersome to fix if we need to add compiler/platform specific logic to support this flag
  • rclpy:
    • pedantic doesn't like casting pointers <=> function pointers. This is used to retrieve all the C functions used to convert data between C and Python
  • tlsf_cpp:
    • uses VLAs, should be fixable but haven't find an elegant way to do it yet
  • ros1_bridge:
    • uses ROS1 messages, ROS1 message generation doesn't comply with pedantic

Except from those packages, CI is passing without warning on gcc and clang.
Linux: Build Status
OSX: Build Status

I also gave a try to also pass /W4 to MSVC
as expected MSVC is spitting a lot more warnings on about every package. Some of them are legit and will be addressed. But I think that a good amount could/should be ignored.
Windows: Build Status

Activity

  1. added
    enhancement
    on Jan 5, 2017
  2. added
    in progress
    on Feb 10, 2017
  3. mikaelarguedas commented on Feb 10, 2017

    @mikaelarguedas
    MemberAuthor

    Here is a a first iteration for pedantic (Linux, OSX), I put only commit whent we just have to add the flag and opened PR where there is code change.

    CI:

  4. added
    in review
    and removed
    in progress
    on Feb 10, 2017
  5. wjwwood commented on Feb 28, 2017

    @wjwwood
    Member

    I only had comments on one of the linked set of changes, lgtm.

  6. mikaelarguedas commented on Feb 28, 2017

    @mikaelarguedas
    MemberAuthor

    reran CI for all these branch:

    • Linux:
      • Build Status
    • macOS:
      • Build Status (expected because of python3.6 issue)
    • Windows:
      • Build Status
  7. added
    ready
    and removed
    in review
    on Feb 28, 2017
  8. mikaelarguedas commented on Mar 2, 2017

    @mikaelarguedas
    MemberAuthor

    Iterating on this (updating the first comment of this issue as things moves forward):
    message packages can use this flag for c++, the blocker is still that the Cpython code uses object pointer to function pointer conversion for all the type conversion functions:
    geometry2: ros/geometry2@72b7072
    common_interfaces: ros2/common_interfaces@4a5c9e3
    rcl_interfaces: ros2/rcl_interfaces@dd78248

    One demo was not using extra or pedantic:
    demos: ros2/demos@af0699d

    rmw_connext_dynamic_cpp: ros2/rmw_connext#219

    rmw_opensplice (now that it compiles again): ros2/rmw_opensplice#163

    CI (without tests only to identify warnings):

    • Linux:
      • Build Status
    • macOS:
      • Build Status
  9. added
    in review
    and removed
    ready
    on Mar 2, 2017
  10. mikaelarguedas commented on Mar 24, 2017

    @mikaelarguedas
    MemberAuthor

    CI with rebased branches and addressed review comments:

    • Linux:
      • Build Status
    • macOS:
      • Build Status
  11. added
    ready
    and removed
    in review
    on Mar 24, 2017
  12. removed
    ready
    on Apr 5, 2017
  13. removed their assignment
    on Apr 5, 2017
  14. mikaelarguedas commented on Mar 8, 2018

    @mikaelarguedas
    MemberAuthor

    class_loader now complies as well: ros/class_loader#80

  15. clalancette commented on Jan 7, 2021

    @clalancette
    Contributor

    Between the work that Mikael did here, and the more recent work that Audrow did, we've enabled a lot of warnings on a lot of packages. While we can go further, that is always the case, so I'm going to consider this "done". If there are additional flags we should enable on specific packages, we'll open up separate issues for each of them for easier tracking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions