ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Appropriate warning/error level for gcc with ROS

asked 2014-11-04 08:16:57 -0500

Wolf gravatar image

Ref. to this question:

what would be an appropriate warning level for building packages against ROS? Ideally all released ros packages (or at least their headers) should compile at this error level


If I compile with -Wall -Werror I cannot compile pcl using packages because:

catkin_make -DCMAKE_CXX_FLAGS=-Wall\ -Werror -DCMAKE_C_FLAGS=-Wall\ -Werror

errors, e. g.:

/usr/include/pcl-1.7/pcl/visualization/area_picking_event.h: In member function ‘bool pcl::visualization::AreaPickingEvent::getPointsIndices(std::vector<int>&) const’:
/usr/include/pcl-1.7/pcl/visualization/area_picking_event.h:64:30: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]

If I compile with -Wall -Wextra -Werror I cannot compile cv_bridge using packages because:

catkin_make -DCMAKE_CXX_FLAGS=-Wall\ -Wextra\ -Werror -DCMAKE_C_FLAGS=-Wall\ -Wextra\ -Werror

errors, e. g.:

/opt/ros/hydro/include/cv_bridge/cv_bridge.h:330:61:   instantiated from here
/opt/ros/hydro/include/cv_bridge/cv_bridge.h:316:15: error: unused parameter ‘s’ [-Werror=unused-parameter]
/opt/ros/hydro/include/cv_bridge/cv_bridge.h:316:15: error: unused parameter ‘indent’ [-Werror=unused-parameter]
/opt/ros/hydro/include/cv_bridge/cv_bridge.h:316:15: error: unused parameter ‘m’ [-Werror=unused-parameter]

I am under ros hydro, ubuntu 12.04. However, I would not see this as bugs in the respective packages. The question is if there is (or should be) a policy on this or is it just that everything that compiles without errors is OK? The latter would unfortunately expand to everybody using ROS because you cannot compile own code with a higher error level if the included libs do not fullfil it....

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2014-11-04 11:29:53 -0500

Dirk Thomas gravatar image

There is currently no policy regarding this.

For most packages you can expect that they have no warning when you use the default warning level (since that will be what most people are using).

It would be great to have a policy on that but it will likely also take a lot of effort to get "all" ROS packages to comply with it. You could try to formalize a policy and suggest it to the ROS community (e.g. on ros-users@) and/or provide pull requests to the packages you care most about.

You might want to try to use include_directories(SYSTEM ...) ( ) to avoid warning for external header files. But blindly suppressing them might also hide real problems so I wouldn't recommend it.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-11-04 08:16:57 -0500

Seen: 913 times

Last updated: Nov 04 '14