https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119324
Robert Dubner <rdubner at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #14 from Robert Dubner <rdubner at gcc dot gnu.org> ---
This exercise has been extremely useful.
The use of cppcheck is a bit of an art form. Using it has exposed a few real
problems, but we've reached a point in the COBOL code where even Jim and I are
having discussions that don't quite reach to the point of disagreements about
which cppcheck warnings to eliminate by suppression, or by changing the code.
Some are a matter of style, and that becomes a matter of opinion.
However, we have eliminated enough warnings that I am closing this PR.
I have scripted cppcheck for libgcobol/*.cc and gcc/cobol/*.cc into my extended
cobolworx testsuite, so they run routinely. With the following inputs to
cppcheck, they generate no warnings.
The configuration file:
cat >$CFG <<EndOfText
<?xml version="1.0"?>
<def format="2">
<define name="HOST_SIZE_T_PRINT_UNSIGNED" value=""%ld""/>
<define name="GCC_PRISZ" value=""z""/>
<define name="YYLTYPE" value="struct {int first_line; int first_column; int
last_line; int last_column;}"/>
<define name="__FLT128_MANT_DIG__" value="113"/>
<define name="__FLT128_MIN_EXP__" value="-16381"/>
<define name="FIXED_WIDE_INT" value="int"/>
<define name="get_power_of_ten" value="int"/>
<define name="HOST_SIZE_T_PRINT_DEC" value=""%d""/>
<define name="HOST_SIZE_T_PRINT_HEX_PURE" value=""%z""/>
</def>
EndOfText
The command line:
cppcheck --inline-suppr --enable=all --force --language=c++ --std=c++14
--library=$CFG \
--check-level=exhaustive \
--suppress=unusedFunction \
--suppress=missingInclude \
--suppress=missingIncludeSystem \
--suppress=postfixOperator \
--suppress=checkersReport \
--suppress=noExplicitConstructor \
--suppress=unmatchedSuppression \
$(cat $FILES) > $RESULT 2>&1
The final check:
cat $RESULT | grep -v -E "^Checking.*$"
Thanks again to David Binderman for sending me down this road; it's been
educational and useful.