public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] xfstests: eliminate build warnings in the "dmapi" subtree
@ 2011-03-04 19:37 Alex Elder
  2011-03-22 17:35 ` Alex Elder
  0 siblings, 1 reply; 2+ messages in thread
From: Alex Elder @ 2011-03-04 19:37 UTC (permalink / raw)
  To: xfs

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
  available.
- "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
  the conditional.
- 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
  consistently.)
    - 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:
    dmapi/src/common/cmd/
    dmapi/src/common/lib/
    dmapi/src/sample_hsm/
    dmapi/src/simple/

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:
    dmapi/src/suite2/

					-Alex

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 0/5] xfstests: eliminate build warnings in the "dmapi" subtree
  2011-03-04 19:37 [PATCH 0/5] xfstests: eliminate build warnings in the "dmapi" subtree Alex Elder
@ 2011-03-22 17:35 ` Alex Elder
  0 siblings, 0 replies; 2+ messages in thread
From: Alex Elder @ 2011-03-22 17:35 UTC (permalink / raw)
  To: xfs

Ping?

On Fri, 2011-03-04 at 13:37 -0600, Alex Elder wrote:
> 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
>   available.
> - "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
>   the conditional.
> - 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
>   consistently.)
>     - 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:
>     dmapi/src/common/cmd/
>     dmapi/src/common/lib/
>     dmapi/src/sample_hsm/
>     dmapi/src/simple/
> 
> 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:
>     dmapi/src/suite2/
> 
> 					-Alex



_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-03-22 17:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-04 19:37 [PATCH 0/5] xfstests: eliminate build warnings in the "dmapi" subtree Alex Elder
2011-03-22 17:35 ` Alex Elder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox