Skip to content

Commit ecb478d

Browse files
committed
configure: workaround "maybe uninitialized" when compiling with g++ 15.2.
1 parent bf71baa commit ecb478d

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

src/configure.ac

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -987,6 +987,30 @@ if test "x" = "x$BOOST_PYTHON_LIB"; then
987987
DEPFOUND=false
988988
fi
989989

990+
# Test for a "maybe uninitialized" in the python::boost library in
991+
# extract<std::string> when compiled with g++ 15.2.[01] and maybe others.
992+
# The test needs to have -O2 and -Wall enabled to expose the probem.
993+
AC_LANG_PUSH([C++])
994+
CPPFLAGS_SAVED="$CPPFLAGS"
995+
CPPFLAGS="$PYTHON_CPPFLAGS $BOOST_CPPFLAGS $CPPFLAGS -O2 -Wall -Werror"
996+
AC_CACHE_CHECK(whether $CXX has a "maybe uninitialized" false positive, ax_cv_cxx_boost_maybe_uninit,
997+
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
998+
#include <boost/python/extract.hpp>
999+
std::string func(boost::python::object& o) {
1000+
return boost::python::extract<std::string>(o);
1001+
}
1002+
int main() { return 0; }
1003+
]])],
1004+
[ax_cv_cxx_boost_maybe_uninit=no],
1005+
[ax_cv_cxx_boost_maybe_uninit=yes])
1006+
]
1007+
)
1008+
CPPFLAGS="$CPPFLAGS_SAVED"
1009+
if test x$ax_cv_cxx_boost_maybe_uninit = xyes; then
1010+
CPPFLAGS="$CPPFLAGS -Wno-maybe-uninitialized"
1011+
fi
1012+
AC_LANG_POP([C++])
1013+
9901014
AC_MSG_CHECKING([whether to build documentation])
9911015
AC_ARG_ENABLE(build-documentation,
9921016
AS_HELP_STRING(

0 commit comments

Comments
 (0)