ext: Disable the unused-value warning in clang for pybind.
authorGabe Black <gabeblack@google.com>
Mon, 10 Feb 2020 03:57:17 +0000 (19:57 -0800)
committerGabe Black <gabeblack@google.com>
Wed, 4 Mar 2020 03:26:41 +0000 (03:26 +0000)
commit082ec1a9c77d0ce0f8169cf3d425de0849b27743
tree937dadb08fc4df0478511cac6bbf5b97e5308d39
parent8cf9c5260c392669154e940f93173281aec5b08a
ext: Disable the unused-value warning in clang for pybind.

pybind internally uses a construct which initializes an array of bools
as a way to run a function on each member of a parameter pack. It then
discards the array since it was just trying to run the function. This
triggers a warning in clang 11 called unused-value which breaks the
build.

This change adds some pragmas to the pybind11.h header which disable
that warning while in pybind11 which is less intrusive than trying to
fix the false positive warning, and better than disabling the warning
universally. Since g++ and clang++ will complain if they see this
pragma guarded by the other's name, these pragmas are also surrounded
by ifdefs which should make them only visible to clang.

Change-Id: Ie9b5c65e8cadc8b96fbc1bd7971bed4a61c4340d
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/25228
Maintainer: Jason Lowe-Power <jason@lowepower.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
ext/pybind11/include/pybind11/pybind11.h