From 30b1d9bdd4ea7a0e313e662207217be5b33d48f7 Mon Sep 17 00:00:00 2001 From: nega Date: Sat, 6 Jul 2024 16:28:31 -0400 Subject: [PATCH] icetray - suppress dodgy gcc warning (#3551) GCC has a new-ish warning `-Wdangling-reference` that's part of `-Wall`. While good in concept, it seems to suffer from too many false-positives. This commit suppresses the warning here for all versions of GCC < 14.2. Hopefully by then the false positives rate will have been addressed or the warning is removed from `-Wall`. --- .../python/boost_serializable_pickle_suite.hpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/icetray/public/icetray/python/boost_serializable_pickle_suite.hpp b/icetray/public/icetray/python/boost_serializable_pickle_suite.hpp index 74c3ec12..cec3fe40 100644 --- a/icetray/public/icetray/python/boost_serializable_pickle_suite.hpp +++ b/icetray/public/icetray/python/boost_serializable_pickle_suite.hpp @@ -77,7 +77,19 @@ struct boost_serializable_pickle_suite : boost::python::pickle_suite { static boost::python::tuple getstate(boost::python::object element_obj) { + +// as of gcc 14.1 -Wdangling-reference (included in -Wall) is still being +// ironed out. kick that can down the road. +#if __GNUC__ == 13 || \ + (__GNUC__ == 14 && __GNUC_MINOR__ < 2) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdangling-reference" +#endif const T &element = boost::python::extract(element_obj)(); +#if __GNUC__ == 13 || \ + (__GNUC__ == 14 && __GNUC_MINOR__ < 2) +#pragma GCC diagnostic pop +#endif // serialize the object into a buffer std::vector blobBuffer;