Fix #641, string operations on GCC9 #642
Merged
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.
Describe the contribution
Ensure clean build, no warnings on string operations using GCC 9.3.0.
Fixes #641
Testing performed
Build code with default config, SIMULATION=native BUILDTYPE=release on GCC 9.3.0.
Confirm successful build with no warning.
Confirm unit tests passing
Sanity check CFE operation
Expected behavior changes
No impact to behavior
System(s) tested on
Ubuntu 20.04 LTS 64 bit
Additional context
Some string ops were genuinely incorrect (particularly in UT) but some were perfectly OK and handled correctly per the C spec. In particular the new "rules" that GCC9 warns about make the
strncat()
library function (and some others) somewhat off-limits even if used correctly.The new string truncation checking feature of GCC generates a boatload of false positives and basically makes certain library functions generate warnings even if used correctly, some other projects have been adding
-Wno-stringop-truncation
compiler flag to avoid this. However with these workarounds CFE is able to build without adding this, but apps might need it.Contributor Info - All information REQUIRED for consideration of pull request
Joseph Hickey, Vantage Systems, Inc.