[libvirt] [PATCH] virsh: silence compiler warning
gcc warns: virsh.c:1879: warning: '0' flag ignored with '-' flag in gnu_printf format * tools/virsh.c (cmdDomjobinfo): Delete useless flag. --- tools/virsh.c | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tools/virsh.c b/tools/virsh.c index a6a637d..65487ed 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -1876,27 +1876,27 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd) vshPrint(ctl, "%-17s %-12llu ms\n", _("Time remaining:"), info.timeRemaining); if (info.dataTotal || info.dataRemaining || info.dataProcessed) { val = prettyCapacity(info.dataProcessed, &unit); - vshPrint(ctl, "%-17s %-0.3lf %s\n", _("Data processed:"), val, unit); + vshPrint(ctl, "%-17s %-.3lf %s\n", _("Data processed:"), val, unit); val = prettyCapacity(info.dataRemaining, &unit); - vshPrint(ctl, "%-17s %-0.3lf %s\n", _("Data remaining:"), val, unit); + vshPrint(ctl, "%-17s %-.3lf %s\n", _("Data remaining:"), val, unit); val = prettyCapacity(info.dataTotal, &unit); - vshPrint(ctl, "%-17s %-0.3lf %s\n", _("Data total:"), val, unit); + vshPrint(ctl, "%-17s %-.3lf %s\n", _("Data total:"), val, unit); } if (info.memTotal || info.memRemaining || info.memProcessed) { val = prettyCapacity(info.memProcessed, &unit); - vshPrint(ctl, "%-17s %-0.3lf %s\n", _("Memory processed:"), val, unit); + vshPrint(ctl, "%-17s %-.3lf %s\n", _("Memory processed:"), val, unit); val = prettyCapacity(info.memRemaining, &unit); - vshPrint(ctl, "%-17s %-0.3lf %s\n", _("Memory remaining:"), val, unit); + vshPrint(ctl, "%-17s %-.3lf %s\n", _("Memory remaining:"), val, unit); val = prettyCapacity(info.memTotal, &unit); - vshPrint(ctl, "%-17s %-0.3lf %s\n", _("Memory total:"), val, unit); + vshPrint(ctl, "%-17s %-.3lf %s\n", _("Memory total:"), val, unit); } if (info.fileTotal || info.fileRemaining || info.fileProcessed) { val = prettyCapacity(info.fileProcessed, &unit); - vshPrint(ctl, "%-17s %-0.3lf %s\n", _("File processed:"), val, unit); + vshPrint(ctl, "%-17s %-.3lf %s\n", _("File processed:"), val, unit); val = prettyCapacity(info.fileRemaining, &unit); - vshPrint(ctl, "%-17s %-0.3lf %s\n", _("File remaining:"), val, unit); + vshPrint(ctl, "%-17s %-.3lf %s\n", _("File remaining:"), val, unit); val = prettyCapacity(info.fileTotal, &unit); - vshPrint(ctl, "%-17s %-0.3lf %s\n", _("File total:"), val, unit); + vshPrint(ctl, "%-17s %-.3lf %s\n", _("File total:"), val, unit); } } else { ret = FALSE; -- 1.6.6.1
Eric Blake wrote:
gcc warns: virsh.c:1879: warning: '0' flag ignored with '-' flag in gnu_printf format
Odd... I don't get that warning on F12 or rawhide. Which version of gcc are you using? Any added options, beyond those provided by this: ./autogen.sh --enable-compile-warnings=maximum
* tools/virsh.c (cmdDomjobinfo): Delete useless flag. --- tools/virsh.c | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c index a6a637d..65487ed 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -1876,27 +1876,27 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd) vshPrint(ctl, "%-17s %-12llu ms\n", _("Time remaining:"), info.timeRemaining); if (info.dataTotal || info.dataRemaining || info.dataProcessed) { val = prettyCapacity(info.dataProcessed, &unit); - vshPrint(ctl, "%-17s %-0.3lf %s\n", _("Data processed:"), val, unit); + vshPrint(ctl, "%-17s %-.3lf %s\n", _("Data processed:"), val, unit);
ACK. That's safe. Confirmed: it's the change that would be produced by sed s/%-0/%-/, and virsh.c is the only affected file.
On Tue, Mar 02, 2010 at 05:19:01PM -0700, Eric Blake wrote:
gcc warns: virsh.c:1879: warning: '0' flag ignored with '-' flag in gnu_printf format
* tools/virsh.c (cmdDomjobinfo): Delete useless flag. --- tools/virsh.c | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c index a6a637d..65487ed 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -1876,27 +1876,27 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd) vshPrint(ctl, "%-17s %-12llu ms\n", _("Time remaining:"), info.timeRemaining); if (info.dataTotal || info.dataRemaining || info.dataProcessed) { val = prettyCapacity(info.dataProcessed, &unit); - vshPrint(ctl, "%-17s %-0.3lf %s\n", _("Data processed:"), val, unit); + vshPrint(ctl, "%-17s %-.3lf %s\n", _("Data processed:"), val, unit); val = prettyCapacity(info.dataRemaining, &unit); - vshPrint(ctl, "%-17s %-0.3lf %s\n", _("Data remaining:"), val, unit); + vshPrint(ctl, "%-17s %-.3lf %s\n", _("Data remaining:"), val, unit); val = prettyCapacity(info.dataTotal, &unit); - vshPrint(ctl, "%-17s %-0.3lf %s\n", _("Data total:"), val, unit); + vshPrint(ctl, "%-17s %-.3lf %s\n", _("Data total:"), val, unit); } if (info.memTotal || info.memRemaining || info.memProcessed) { val = prettyCapacity(info.memProcessed, &unit); - vshPrint(ctl, "%-17s %-0.3lf %s\n", _("Memory processed:"), val, unit); + vshPrint(ctl, "%-17s %-.3lf %s\n", _("Memory processed:"), val, unit); val = prettyCapacity(info.memRemaining, &unit); - vshPrint(ctl, "%-17s %-0.3lf %s\n", _("Memory remaining:"), val, unit); + vshPrint(ctl, "%-17s %-.3lf %s\n", _("Memory remaining:"), val, unit); val = prettyCapacity(info.memTotal, &unit); - vshPrint(ctl, "%-17s %-0.3lf %s\n", _("Memory total:"), val, unit); + vshPrint(ctl, "%-17s %-.3lf %s\n", _("Memory total:"), val, unit); } if (info.fileTotal || info.fileRemaining || info.fileProcessed) { val = prettyCapacity(info.fileProcessed, &unit); - vshPrint(ctl, "%-17s %-0.3lf %s\n", _("File processed:"), val, unit); + vshPrint(ctl, "%-17s %-.3lf %s\n", _("File processed:"), val, unit); val = prettyCapacity(info.fileRemaining, &unit); - vshPrint(ctl, "%-17s %-0.3lf %s\n", _("File remaining:"), val, unit); + vshPrint(ctl, "%-17s %-.3lf %s\n", _("File remaining:"), val, unit); val = prettyCapacity(info.fileTotal, &unit); - vshPrint(ctl, "%-17s %-0.3lf %s\n", _("File total:"), val, unit); + vshPrint(ctl, "%-17s %-.3lf %s\n", _("File total:"), val, unit); } } else { ret = FALSE;
On one hand it's a cleanup, so supposed to wait, on the other hand it looks fairly safe and touch only virsh not the library itself, so I'm fine pushing it now, ACK, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/
Daniel Veillard wrote:
On Tue, Mar 02, 2010 at 05:19:01PM -0700, Eric Blake wrote:
gcc warns: virsh.c:1879: warning: '0' flag ignored with '-' flag in gnu_printf format
* tools/virsh.c (cmdDomjobinfo): Delete useless flag. ... On one hand it's a cleanup, so supposed to wait, on the other hand it looks fairly safe and touch only virsh not the library itself, so I'm fine pushing it now, ACK,
Pushed.
According to Jim Meyering on 3/3/2010 2:03 AM:
Eric Blake wrote:
gcc warns: virsh.c:1879: warning: '0' flag ignored with '-' flag in gnu_printf format
Odd... I don't get that warning on F12 or rawhide. Which version of gcc are you using? Any added options, beyond those provided by this: ./autogen.sh --enable-compile-warnings=maximum
Huh - I had to go back and see what breadcrumbs show for how I had configured. I'm using F12, gcc 4.4.3, and ./config.status --version reports: configured by ./configure, generated by GNU Autoconf 2.63, with options "'CFLAGS=-Wall' '-C'" Apparently, in this build tree, I _didn't_ use --enable-compile-warnings, but had manually set CFLAGS myself to a subset of warnings (note to self - next time I bootstrap, I should use the configure option rather than trying to do it by hand). So is there something in plain -Wall that accidently gets turned back off by --enable-compile-warnings=maximum? Meanwhile, it would be nice to add -fdiagnostics-show-option to the set of warning flags attempted by --enable-compile-warnings. That would have told us which particular reason I got the warning. Or perhaps even use the gnulib module manywarnings, rather than hand-rolling LIBVIRT_COMPILE_WARNINGS, so that we pick up benefits from gnulib folks whenever better approaches for enabling warnings are implemented. I'll start a patch series along those lines (post 0.7.7). -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
participants (3)
-
Daniel Veillard -
Eric Blake -
Jim Meyering