configure: workaround "maybe uninitialized" warning#3760
Merged
andypugh merged 1 commit intoLinuxCNC:masterfrom Feb 1, 2026
Merged
configure: workaround "maybe uninitialized" warning#3760andypugh merged 1 commit intoLinuxCNC:masterfrom
andypugh merged 1 commit intoLinuxCNC:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: