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

[rcl_lifecycle] Add warnings #830

Merged
merged 2 commits into from
Oct 21, 2020
Merged

Conversation

audrow
Copy link
Member

@audrow audrow commented Oct 13, 2020

This PR enables -Wformat=2, -Wconversion, -Wshadow, and -Wsign-conversion in rcl_lifecycle. This PR relies on using gtest v1.10.0, see ament/googletest#8.

@audrow audrow self-assigned this Oct 13, 2020
@audrow
Copy link
Member Author

audrow commented Oct 13, 2020

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

Copy link
Collaborator

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

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

would you share why you came up with these options and plan to add these options in other packages as well?

@audrow
Copy link
Member Author

audrow commented Oct 14, 2020

Hi @fujitatomoya, for the next ROS2 release, we want to add several warnings to all of the maintained C and C++ packages. The thinking is that this will help maintain code quality and catch bugs (it has already caught a few in other packages). I made a proposal and worked with the team to find a set of warnings to include. I'll ask if I can make the proposal public.

Below is the full set of warnings. This PR doesn't do all of them because some of the warnings require solving additional problems (so far, mostly to do with vendor packages, like googletest).

-Wall -Wextra -Wpedantic -Wformat=2 -Wundef -Wconversion -Woverloaded-virtual -Wswitch-default -Wshadow -Wsign-conversion -Wnon-virtual-dtor -Wold-style-cast -Wcast-qual

@fujitatomoya
Copy link
Collaborator

@audrow

sounds great 👍 thanks 😃

rcl_lifecycle/src/com_interface.c Outdated Show resolved Hide resolved
Signed-off-by: Audrow Nash <audrow.nash@gmail.com>
Signed-off-by: Audrow Nash <audrow.nash@gmail.com>
@audrow audrow force-pushed the audrow/add-warnings-rcl_lifecycle branch from 255312d to d159f26 Compare October 21, 2020 03:30
@audrow
Copy link
Member Author

audrow commented Oct 21, 2020

I also tested above packages to see if changing the type of rcl_lifecycle_state_t's member id caused any warnings.

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

@audrow audrow merged commit 5ef4b2d into master Oct 21, 2020
@delete-merged-branch delete-merged-branch bot deleted the audrow/add-warnings-rcl_lifecycle branch October 21, 2020 17:44
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