Ask Your Question
0

Suppressing the ROS_CREATE_SIMPLE_SERIALIZER_ARM warnings when building from source

asked 2016-09-04 06:20:33 -0500

spmaniato gravatar image

When building ros_comm from source for an ARM architecture, I get multiple warnings about the ROS_CREATE_SIMPLE_SERIALIZER_ARM macro. Here's a snippet:

In file included from /usr/catkin_ws/src/ros_comm/rosbag_storage/include/rosbag/message_instance.h:39:0,
                 from /usr/catkin_ws/src/ros_comm/rosbag_storage/include/rosbag/view.h:41,
                 from /usr/catkin_ws/src/ros_comm/rosbag_storage/src/view.cpp:28:
/opt/ros/indigo/include/ros/serialization.h:207:56: warning: unused parameter ‘t’ [-Wunused-parameter]
     inline static uint32_t serializedLength(const Type t) \
                                                        ^
/opt/ros/indigo/include/ros/serialization.h:214:5: note: in expansion of macro ‘ROS_CREATE_SIMPLE_SERIALIZER_ARM’
     ROS_CREATE_SIMPLE_SERIALIZER_ARM(uint8_t);
     ^
/opt/ros/indigo/include/ros/serialization.h:207:56: warning: unused parameter ‘t’ [-Wunused-parameter]
     inline static uint32_t serializedLength(const Type t) \
                                                        ^
/opt/ros/indigo/include/ros/serialization.h:215:5: note: in expansion of macro ‘ROS_CREATE_SIMPLE_SERIALIZER_ARM’
     ROS_CREATE_SIMPLE_SERIALIZER_ARM(int8_t);
     ^

Is there a simple way to get rid of (or just suppress) these specific warnings? For example, I'm guessing I can pass a make flag that suppresses all warnings of this type: -Wunused-parameter. What would that look like?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2016-09-04 07:03:42 -0500

gvdhoorn gravatar image

updated 2016-09-04 07:10:31 -0500

Well, generally you can disable gcc warnings and errors by passing a -Wno-.. variant of the involved warning option.

In this case that would be -Wno-unused-variable.

Btw, this is really not ROS specific at all, but a simple gcc configuration problem, and well documented:

You can request many specific warnings with options beginning with ‘-W’, for example -Wimplicit to request warnings on implicit declarations. Each of these specific warning options also has a negative form beginning ‘-Wno-’ to turn off warnings; for example, -Wno-implicit.

From GCC Command Options - Warning Options in the GCC manual.


Edit: suppressing these kinds of warnings and errors is typically not a good idea. If you must do it, try to narrow the scope of the suppression as much as possible by setting the flag on the CMake target using set_target_properties(${TARGET} PROPERTIES ...) instead of globally using add_definitions(..).

edit flag offensive delete link more

Comments

Thanks a lot! And yes, the question was mostly non-ROS-specific. It's just that I was thinking there might be a way to suppress warnings for a specific package via a combination of catkin/cmake/make arguments and flags.

spmaniato gravatar imagespmaniato ( 2016-09-04 07:17:12 -0500 )edit

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

Stats

Asked: 2016-09-04 06:20:33 -0500

Seen: 502 times

Last updated: Sep 04 '16