Skip to content

configure: workaround "maybe uninitialized" warning#3760

Merged
andypugh merged 1 commit intoLinuxCNC:masterfrom
BsAtHome:fix_maybe-uninit
Feb 1, 2026
Merged

configure: workaround "maybe uninitialized" warning#3760
andypugh merged 1 commit intoLinuxCNC:masterfrom
BsAtHome:fix_maybe-uninit

Conversation

@BsAtHome
Copy link
Contributor

At least g++ 15.2.0 and 15.2.1 generate warnings about "maybe uninitialized" in std::string/std::basic_string class as described in #3709. It is most probably a false positive as this warning has been seen before.

This PR "fixes" #3709 by detecting the warning in a configure test and adds "-Wno-maybe-uninitialized" to the compiler invocation if a warning was present. Older g++, like from debian 11, 12 and 13 as well as clang++, will not have this warning and no additional compiler flags are added.
The configure test will no longer flag a g++ when the distribution's compiler is updated with the issue fixed. That makes the configure test the better choice than to use complex #if constructs in the sources.

If it was only g++, then the test could have been slightly more tight by using "-Werror=maybe-uninitialized", but that does not work with clang++. Therefore, it is assumed that no other warnings will occur in the test and that should not be the case in the test program:

#include <boost/python/extract.hpp>
std::string func(boost::python::object& o) {
	return boost::python::extract<std::string>(o);
}
int main() { return 0; }

@andypugh andypugh merged commit 644ef11 into LinuxCNC:master Feb 1, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants