gazebosim / sdformat

Simulation Description Format (SDFormat) parser and description files.
http://sdformat.org
Apache License 2.0
166 stars 92 forks source link

Backport pybind11 warning fix #1404

Closed scpeters closed 5 months ago

scpeters commented 5 months ago

Backport #1389 to garden

Fixes a compiler warning on garden.

Original PR description:

Fix warning with pybind11 2.12

Summary

Version 2.12 of pybind11 was recently merged to homebrew-core:

This release includes https://github.com/pybind/pybind11/pull/4772, which causes a compiler warning in sdformat:

python/src/sdf/_gz_sdformat_pybind11.cc:153:25: warning: 'operator()' is deprecated: Please use py::set_error() instead (https://github.com/pybind/pybind11/pull/4772) [-Wdeprecated-declarations]
      sdfErrorsException(e.what());
                        ^
/usr/local/include/pybind11/pybind11.h:2623:5: note: 'operator()' has been explicitly marked deprecated here
    PYBIND11_DEPRECATED("Please use py::set_error() instead "
    ^
/usr/local/include/pybind11/detail/common.h:202:43: note: expanded from macro 'PYBIND11_DEPRECATED'
#    define PYBIND11_DEPRECATED(reason) [[deprecated(reason)]]
                                          ^
1 warning generated.

This adds a version check and a fix for newer versions of pybind11.

Checklist

Note to maintainers: Remember to use Rebase-and-Merge.