The warnings in daemon were aggravating and risky
for development (too easy to miss new ones) so I spent some
time last week and today working on removing them.
The first patch gets us down to almost no warnings with
the original -Wall setting. That was by far the hardest part.
Once I'd done that, I enabled nearly all of gcc's warnings via
gnulib's warnings and manywarnings modules and the code
added to configure.ac in the final patch.
I did it that way so that we can still bisect without compile
failure, even when using the new --enable-gcc-warnings option.
I.e., fix all warnings, *and then* add the code that turns on
the new -W options along with -Werror.
I suggest that developers always configure with --enable-gcc-warnings.
The 2nd patch is self explanatory.
0003 adds some omitted "\n"-after ";" in emitted code.
The remaining changes address new warnings exposed by using
all of the new -W options. Among them, there were some real
bugs. 0006 is a portability bug, at least.
0007 probably doesn't matter much in practice, but I looked
because of a warning about ignored write return value.
0011 is definitely a bug. It was highlighted via the
sign-vs-unsigned warning.
751 0001-adjust-const-pointers-to-avoid-warnings.patch
33 0002-python-avoid-_POSIX_C_SOURCE-redefinition-warning.patch
39 0003-generator.ml-emit-slightly-prettier-code.patch
50 0004-avoid-warning-about-old-style-no-param-function-defi.patch
39 0005-command.c-avoid-shadowing-a-global-function.patch
41 0006-guestfsd.c-don-t-perform-arithmetic-on-void-pointers.patch
42 0007-daemon-zero-don-t-ignore-write-and-close-errors.patch
41 0008-wc-blockdev-avoid-warnings-about-discarding-const-qu.patch
48 0009-sfdisk.c-fallocate.c-use-a-string-literal-as-format.patch
26 0010-daemon.h-avoid-warning-about-possible-noreturn-funct.patch
27 0011-guestfsd-don-t-ignore-failed-write-to-socket.patch
35 0012-xattr.c-avoid-warning-about-comparison-between-signe.patch
125 0013-daemon-enable-Werror-and-many-gcc-warnings-when-enab.patch
$ diffstat 00*
b/daemon/Makefile.am | 3 -
b/daemon/augeas.c | 2
b/daemon/blockdev.c | 2
b/daemon/command.c | 12 ++--
b/daemon/configure.ac | 61 ++++++++++++++++++++++++
b/daemon/daemon.h | 6 +-
b/daemon/debug.c | 2
b/daemon/df.c | 4 -
b/daemon/fallocate.c | 2
b/daemon/guestfsd.c | 20 ++++----
b/daemon/lvm.c | 12 +---
b/daemon/m4/gnulib-cache.m4 | 5 +-
b/daemon/proto.c | 3 -
b/daemon/sfdisk.c | 10 ++--
b/daemon/sync.c | 3 -
b/daemon/wc.c | 3 -
b/daemon/xattr.c | 11 ++--
b/daemon/zero.c | 19 +++++--
b/fish/fish.c | 6 +-
b/fish/fish.h | 6 +-
b/src/generator.ml | 108 ++++++++++++++++++++++++--------------------
daemon/blockdev.c | 2
daemon/command.c | 9 +--
daemon/daemon.h | 3 -
daemon/guestfsd.c | 7 +-
daemon/sfdisk.c | 5 --
src/generator.ml | 12 ++--
27 files changed, 206 insertions(+), 132 deletions(-)