Jim Meyering
2009-Aug-27 11:35 UTC
[Libguestfs] [PATCH 4/4] build: enable gcc warnings in capitests/ and ocaml/
Here are four small patches. First, I enabled all the warnings, then I fixed the newly exposed offenses, then I put the warning-enabling patch at the end, for the sake of future bisectors: [1/4] ocaml/guestfs_c.c avoid signed/unsigned-comparison warning [2/4] ocaml/guestfs_c.c: avoid warning about initialization discarding "const" [3/4] ocaml/guestfs_c.c: avoid warning about missing prototypes [4/4] build: enable gcc warnings in capitests/ and ocaml/>From 1accb67720596bd946809d4032661f5d3adb7a26 Mon Sep 17 00:00:00 2001From: Jim Meyering <meyering at redhat.com> Date: Thu, 27 Aug 2009 12:34:38 +0200 Subject: [PATCH libguestfs 1/4] ocaml/guestfs_c.c avoid signed/unsigned-comparison warning * ocaml/guestfs_c.c (ocaml_guestfs_strings_val): Declare index as unsigned int. --- ocaml/guestfs_c.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/ocaml/guestfs_c.c b/ocaml/guestfs_c.c index f983696..9a7454d 100644 --- a/ocaml/guestfs_c.c +++ b/ocaml/guestfs_c.c @@ -131,7 +131,7 @@ ocaml_guestfs_strings_val (guestfs_h *g, value sv) { CAMLparam1 (sv); char **r; - int i; + unsigned int i; r = guestfs_safe_malloc (g, sizeof (char *) * (Wosize_val (sv) + 1)); for (i = 0; i < Wosize_val (sv); ++i) -- 1.6.4.1.359.g4fc77>From 27420d5dcf7ba550751323ea2f27cf45b9146a91 Mon Sep 17 00:00:00 2001From: Jim Meyering <meyering at redhat.com> Date: Thu, 27 Aug 2009 12:36:25 +0200 Subject: [PATCH libguestfs 2/4] ocaml/guestfs_c.c: avoid warning about initialization discarding "const" * ocaml/guestfs_c.c (guestfs_custom_operations): Add a cast. --- ocaml/guestfs_c.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/ocaml/guestfs_c.c b/ocaml/guestfs_c.c index 9a7454d..62d42d3 100644 --- a/ocaml/guestfs_c.c +++ b/ocaml/guestfs_c.c @@ -51,7 +51,7 @@ guestfs_finalize (value gv) } static struct custom_operations guestfs_custom_operations = { - "guestfs_custom_operations", + (char *) "guestfs_custom_operations", guestfs_finalize, custom_compare_default, custom_hash_default, -- 1.6.4.1.359.g4fc77>From 4125126085bd81bf96efc2cdbdec0f5596c6c9e8 Mon Sep 17 00:00:00 2001From: Jim Meyering <meyering at redhat.com> Date: Thu, 27 Aug 2009 13:23:20 +0200 Subject: [PATCH libguestfs 3/4] ocaml/guestfs_c.c: avoid warning about missing prototypes * ocaml/guestfs_c.c (ocaml_guestfs_create, ocaml_guestfs_close): Declare. --- ocaml/guestfs_c.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/ocaml/guestfs_c.c b/ocaml/guestfs_c.c index 62d42d3..80dcf99 100644 --- a/ocaml/guestfs_c.c +++ b/ocaml/guestfs_c.c @@ -42,6 +42,10 @@ }while(0) #endif +/* These prototypes are solely to quiet gcc warning. */ +CAMLprim value ocaml_guestfs_create (void); +CAMLprim value ocaml_guestfs_close (value gv); + /* Allocate handles and deal with finalization. */ static void guestfs_finalize (value gv) -- 1.6.4.1.359.g4fc77>From e933691fd1c1a5543c05fcd209ce57daf6cac4f7 Mon Sep 17 00:00:00 2001From: Jim Meyering <meyering at redhat.com> Date: Mon, 24 Aug 2009 11:39:42 +0200 Subject: [PATCH libguestfs 4/4] build: enable gcc warnings in capitests/ and ocaml/ * capitests/Makefile.am: Use $(WARN_CFLAGS) and $(WERROR_CFLAGS). * ocaml/Makefile.am:: Likewise. --- capitests/Makefile.am | 3 ++- ocaml/Makefile.am | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/capitests/Makefile.am b/capitests/Makefile.am index 361c6a3..3b80c0e 100644 --- a/capitests/Makefile.am +++ b/capitests/Makefile.am @@ -24,7 +24,8 @@ EXTRA_DIST = \ check_PROGRAMS = tests test-command tests_SOURCES = tests.c -tests_CFLAGS = -I$(top_srcdir)/src -I$(top_builddir)/src -Wall +tests_CFLAGS = -I$(top_srcdir)/src -I$(top_builddir)/src \ + $(WARN_CFLAGS) $(WERROR_CFLAGS) tests_LDADD = $(top_builddir)/src/libguestfs.la # Old version of e2fsprogs which didn't support UUIDs? diff --git a/ocaml/Makefile.am b/ocaml/Makefile.am index d65ebaa..462404c 100644 --- a/ocaml/Makefile.am +++ b/ocaml/Makefile.am @@ -29,7 +29,8 @@ CLEANFILES = *.cmi *.cmo *.cmx *.cma *.cmxa *.o *.a *.so CLEANFILES += t/*.cmi t/*.cmo t/*.cmx t/*.o t/*.a t/*.so AM_CPPFLAGS = -I$(top_builddir) -I$(OCAMLLIB) -I$(top_srcdir)/ocaml \ - -I$(top_srcdir)/src -I$(top_builddir)/src + -I$(top_srcdir)/src -I$(top_builddir)/src \ + $(WARN_CFLAGS) $(WERROR_CFLAGS) if HAVE_OCAML -- 1.6.4.1.359.g4fc77
Richard W.M. Jones
2009-Aug-28 09:37 UTC
[Libguestfs] [PATCH 4/4] build: enable gcc warnings in capitests/ and ocaml/
On Thu, Aug 27, 2009 at 01:35:54PM +0200, Jim Meyering wrote:> Here are four small patches. > First, I enabled all the warnings, then I fixed the newly exposed > offenses, then I put the warning-enabling patch at the end, > for the sake of future bisectors:Yes, ACK. Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://et.redhat.com/~rjones/libguestfs/ See what it can do: http://et.redhat.com/~rjones/libguestfs/recipes.html