From 082ec1a9c77d0ce0f8169cf3d425de0849b27743 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Sun, 9 Feb 2020 19:57:17 -0800 Subject: [PATCH] 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 Tested-by: kokoro Reviewed-by: Jason Lowe-Power --- ext/pybind11/include/pybind11/pybind11.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ext/pybind11/include/pybind11/pybind11.h b/ext/pybind11/include/pybind11/pybind11.h index a0e639583..a9ee31a34 100644 --- a/ext/pybind11/include/pybind11/pybind11.h +++ b/ext/pybind11/include/pybind11/pybind11.h @@ -9,6 +9,10 @@ */ #pragma once +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunused-value" +#endif #if defined(__INTEL_COMPILER) # pragma warning push @@ -2174,3 +2178,7 @@ NAMESPACE_END(PYBIND11_NAMESPACE) #elif defined(__GNUG__) && !defined(__clang__) # pragma GCC diagnostic pop #endif + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif -- 2.30.2