gazebosim / gz-sim

Open source robotics simulator. The latest version of Gazebo.
https://gazebosim.org
Apache License 2.0
685 stars 262 forks source link

Fix GCC/CMake warnings for Noble #2375

Closed j-rivero closed 5 months ago

j-rivero commented 5 months ago

🎉 New feature

Summary

Fix the CMake and GCC warnings that appeared when building on Noble. Each of the three commits is self-explanatory for review. The most tropical change is the 55498d807af68e18f5850f41adadbac3d7f5e9, quoting the commit description:

    GCC is emitting a warning about a possible dangling pointer on table
    like definitions:

    warning: possibly dangling reference to a temporary [-Wdangling-reference]
      660 |         auto const& table = get_current_events_table(state_indexes{});
          |                     ^~~~~

    Which I think that really comes from the use of state_indexes{} as
    argument:

      note: the temporary was destroyed at the end of the full expression
      660 |         auto const& table = get_current_events_table(state_indexes{});
          |                             ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~

    Clang is quiet about this and make me think that is a false positive
    since the metaprogramming code is using just the type of the state_indexes
    as much as I can see.

Checklist

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.