pluginlib
pluginlib copied to clipboard
Fix warnings reported by Wformat
If I compile with -Wall
, -Wextra
and -Wpedantic
I get the following error reported by -Wformat
. This MR adds static casts to void*
which is the type that %p
expects.
/opt/ros/melodic/include/pluginlib/././class_loader_imp.hpp: In instantiation of ‘pluginlib::ClassLoader<T>::ClassLoader(std::__cxx11::string, std::__cxx11::string, std::__cxx11::string, std::vector<std::__cxx11::basic_string<char> >) [with T = ?; std::__cxx11::string = std::__cxx11::basic_string<char>]’:
?:16:67: required from here
/opt/ros/melodic/include/ros/console.h:348:26: warning: format ‘%p’ expects argument of type ‘void*’, but argument 9 has type ‘pluginlib::ClassLoader<?>*’ [-Wformat=]
::ros::console::print(filter, __rosconsole_define_location__loc.logger_, __rosconsole_define_location__loc.level_, __FILE__, __LINE__, __ROSCONSOLE_FUNCTION__, __VA_ARGS__)
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/ros/melodic/include/ros/console.h:351:5: note: in expansion of macro ‘ROSCONSOLE_PRINT_AT_LOCATION_WITH_FILTER’
ROSCONSOLE_PRINT_AT_LOCATION_WITH_FILTER(NULL, __VA_ARGS__)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/ros/melodic/include/ros/console.h:387:7: note: in expansion of macro ‘ROSCONSOLE_PRINT_AT_LOCATION’
ROSCONSOLE_PRINT_AT_LOCATION(__VA_ARGS__); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/ros/melodic/include/ros/console.h:572:35: note: in expansion of macro ‘ROS_LOG_COND’
#define ROS_LOG(level, name, ...) ROS_LOG_COND(true, level, name, __VA_ARGS__)
^~~~~~~~~~~~
/opt/ros/melodic/include/rosconsole/macros_generated.h:60:36: note: in expansion of macro ‘ROS_LOG’
#define ROS_DEBUG_NAMED(name, ...) ROS_LOG(::ros::console::levels::Debug, std::string(ROSCONSOLE_NAME_PREFIX) + "." + name, __VA_ARGS__)
^~~~~~~
/opt/ros/melodic/include/pluginlib/././class_loader_imp.hpp:83:3: note: in expansion of macro ‘ROS_DEBUG_NAMED’
ROS_DEBUG_NAMED("pluginlib.ClassLoader", "Creating ClassLoader, base = %s, address = %p",
^
(I replaced my custom files and types with '?')
@nuclearsandwich
Upvoted.