ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
2

Appropriate warning/error level for gcc with ROS

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

Wolf gravatar image

Ref. to this question:

http://answers.ros.org/question/13819...

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

Examples:

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
1

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 ...) ( http://www.cmake.org/cmake/help/v2.8.... ) 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

Question Tools

1 follower

Stats

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

Seen: 1,030 times

Last updated: Nov 04 '14