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

Wshadow compiler warning catches issues #248

Closed
Ryanf55 opened this issue Jun 9, 2023 · 2 comments
Closed

Wshadow compiler warning catches issues #248

Ryanf55 opened this issue Jun 9, 2023 · 2 comments

Comments

@Ryanf55
Copy link

Ryanf55 commented Jun 9, 2023

Enabling Wshadow in nav2 caught problems in pluginlib with shadowed variables.

In file included from /opt/ros/rolling/include/pluginlib/pluginlib/class_loader.hpp:334,
                 from /home/ryan/Development/nav2_ws/install/nav2_costmap_2d/include/nav2_costmap_2d/costmap_2d_ros.hpp:54,
                 from /home/ryan/Development/nav2_ws/install/nav2_core/include/nav2_core/global_planner.hpp:21,
                 from /home/ryan/Development/nav2_ws/src/nav2/nav2_system_tests/src/error_codes/planner/planner_error_plugin.hpp:25,
                 from /home/ryan/Development/nav2_ws/src/nav2/nav2_system_tests/src/error_codes/planner/planner_error_plugin.cpp:15:
/opt/ros/rolling/include/pluginlib/pluginlib/./class_loader_imp.hpp: In member function 'virtual std::string pluginlib::ClassLoader<T>::getClassLibraryPath(const string&)':
/opt/ros/rolling/include/pluginlib/pluginlib/./class_loader_imp.hpp:491:13: error: declaration of 'it' shadows a previous local [-Werror=shadow]
  491 |   for (auto it = paths_to_try.begin(); it != paths_to_try.end(); it++) {
      |             ^~
/opt/ros/rolling/include/pluginlib/pluginlib/./class_loader_imp.hpp:479:20: note: shadowed declaration is here
  479 |   ClassMapIterator it = classes_available_.find(lookup_name);

Branch: rolling from debian 5.3.0-1jammy.20230512.161129

I propose adding that compilation option to pluginlib CMakeLists.txt and fixing any shadowed variables.

Relates to #224

@SteveMacenski
Copy link
Member

I fixed in #250

@clalancette
Copy link

Fixed by #250

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

No branches or pull requests

3 participants