diff --git a/CMakeLists.txt b/CMakeLists.txt index 47d1f80..8ce70f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -132,6 +132,19 @@ set_target_properties(ALF # Use C++17 target_compile_features(ALF PUBLIC cxx_std_17) +# GCC 15 emits a false-positive -Wmaybe-uninitialized when it deeply inlines +# Boost.Python's extract rvalue converters (used in +# PythonInterface.cxx and the Swt/Ic Python interface headers) into +# std::pair/boost::variant construction. The warning points into libstdc++'s +# bits/basic_string.h (_M_string_length) but is triggered by ALF's converters; +# the code is correct. The aliBuild recipe compiles with -Werror, so this +# false positive would otherwise be a hard failure. Keep the warning visible +# but non-fatal. GCC-only: the flag is not understood by Clang/AppleClang, and +# the Python interface is only built on non-APPLE (Python3_FOUND) anyway. +target_compile_options(ALF PRIVATE + $<$:-Wno-error=maybe-uninitialized> +) + #################################### # Executables diff --git a/src/IcPythonInterface.h b/src/IcPythonInterface.h index ef90d4c..aa7f3c7 100644 --- a/src/IcPythonInterface.h +++ b/src/IcPythonInterface.h @@ -131,6 +131,12 @@ struct IcArgsVariantConverter { IcArgsVariant ret; + // GCC 15 emits a false-positive -Wmaybe-uninitialized when the std::string + // materialized from boost::python::extract<> is copied into the variant/pair. +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +#endif bp::extract s(obj); if (s.check()) { ret = s(); @@ -144,6 +150,9 @@ struct IcArgsVariantConverter { ret = bp::extract>(tuple); } } +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic pop +#endif new (storage) IcArgsVariant(ret); data->convertible = storage; diff --git a/src/PythonInterface.cxx b/src/PythonInterface.cxx index c6cad48..2cb5f26 100644 --- a/src/PythonInterface.cxx +++ b/src/PythonInterface.cxx @@ -57,7 +57,16 @@ struct pairConverter { { bp::tuple tuple(bp::borrowed(obj)); void* storage = ((bp::converter::rvalue_from_python_storage>*)data)->storage.bytes; + // GCC 15 emits a false-positive -Wmaybe-uninitialized when the std::string + // materialized from boost::python::extract<> is copied into the std::pair. +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +#endif new (storage) std::pair(bp::extract(tuple[0]), bp::extract(tuple[1])); +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic pop +#endif data->convertible = storage; } }; diff --git a/src/ScaPythonInterface.h b/src/ScaPythonInterface.h index c5f6db5..b7e1ff9 100644 --- a/src/ScaPythonInterface.h +++ b/src/ScaPythonInterface.h @@ -137,6 +137,12 @@ struct ScaArgsVariantConverter { ScaArgsVariant ret; + // GCC 15 emits a false-positive -Wmaybe-uninitialized when the std::string + // materialized from boost::python::extract<> is copied into the variant/pair. +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +#endif bp::extract s(obj); if (s.check()) { ret = s(); @@ -150,6 +156,9 @@ struct ScaArgsVariantConverter { ret = bp::extract>(tuple); } } +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic pop +#endif new (storage) ScaArgsVariant(ret); data->convertible = storage; diff --git a/src/SwtPythonInterface.h b/src/SwtPythonInterface.h index a2e71bf..de9a01d 100644 --- a/src/SwtPythonInterface.h +++ b/src/SwtPythonInterface.h @@ -132,6 +132,12 @@ struct SwtArgsVariantConverter { SwtArgsVariant ret; + // GCC 15 emits a false-positive -Wmaybe-uninitialized when the std::string + // materialized from boost::python::extract<> is copied into the variant/pair. +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +#endif bp::extract s(obj); if (s.check()) { ret = s(); @@ -139,6 +145,9 @@ struct SwtArgsVariantConverter { bp::tuple tuple(bp::borrowed(obj)); ret = std::pair(bp::extract(tuple[0]), bp::extract(tuple[1])); } +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic pop +#endif new (storage) SwtArgsVariant(ret); data->convertible = storage;