[PATCH 0/5] xfstests: eliminate build warnings in the "dmapi" subtree
aelder at sgi.com
Fri Mar 4 13:37:51 CST 2011
Now that we're building the "dmapi" subtree the same way as the rest
of the code in "xfstests", a lot of warnings are showing up in the
build. This series eliminates them all, at least for three build
architectures I have used so far (i386, x86_64, and ia64).
Because of the sheer number of changes, I've broken it into
a small series, each focused on files under a certain portion
of the tree under "dmapi".
Below are the types of warnings, and how they were generally fixed.
In all cases I scanned the affected code to be reasonably sure the
warning was harmless and the fix did not obscure a real problem.
- Variables possibly used before set. Fixed by initializing such
variables to 0 or NULL, or some appropriate symbolic value if
- "Bald" assignments used as conditional values; GCC suggests adding
an extra set of parentheses. Fixed by pulling the assignments out
as a previous line of code, and using the assigned value alone in
- Variables used in scanf() functions having types that differ from
what the format string indicates. Fixed by creating and using new
variables of the type needed for scanf(), and then assigning the
result to the original variable with a cast.
- Variables used in printf() functions having types that differ from
what the format string indicates. Fixed by casting the variable
to the type indicated in the format string. In a few cases I
changed "%lld" formats to "%llu" to be consistent with other usage
for printing the same variable. (But I did not do this
- A lot of these cases involved using "%zd" in place of just
"%d" for printing size_t objects.
- In one case, replaced a call to tmpnam() with an equivalent call
to mkstmp() using a local variable.
Patch 1 covers files under:
Patch 2 covers:
dmapi/src/suite1/cmd/ (part 1)
Patch 3 covers:
dmapi/src/suite1/cmd/ (part 2)
Patch 4 covers:
dmapi/src/suite1/cmd/ (part 3)
Patch 5 covers:
More information about the xfs