[Ovirt-devel] [PATCH] avoid warnings from gcc -Wshadow

Jim Meyering jim at meyering.net
Mon Sep 8 13:37:36 UTC 2008


"Perry N. Myers" <pmyers at redhat.com> wrote:
> Jim Meyering wrote:
>> I usually build with gcc's -Wshadow option.
>> That triggered some warnings, and since the changes are tiny,
>> I fixed the code to avoid the warnings.
>
> ACK, should you also commit change so that we always build with
> -Wshadow as well?

Yes.  Even thought of that, but was lazy^W concentrating on
getting things to work on rawhide, so let it slide.
Now that you've prodded me, here's a low-investment patch:
(for the whole-hog approach, look at libvirt's LIBVIRT_COMPILE_WARNINGS)

>From 4584255f33ff21488dd516ee58ca1d9f914acedd Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Mon, 8 Sep 2008 15:33:58 +0200
Subject: [PATCH] * configure.ac: If using gcc and default CFLAGS, enable some warnings.

---
 configure.ac |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac
index 443f4d5..453d015 100644
--- a/configure.ac
+++ b/configure.ac
@@ -9,5 +9,9 @@ PKG_CHECK_MODULES([DBUS], [dbus-1 >= 1.2.1])
 PKG_CHECK_MODULES([HAL], [hal >= 0.5.11])
 PKG_CHECK_MODULES([VIRT], [libvirt >= 0.4.4])

+# If using gcc and default CFLAGS, enable some warnings.
+test x"$ac_ct_CC:$CFLAGS" = 'xgcc:-g -O2' \
+  && CFLAGS="$CFLAGS -Wshadow -Wall -Werror"
+
 AC_CONFIG_FILES([Makefile ovirt-identify-node/Makefile])
 AC_OUTPUT
--
1.6.0.1.196.g01914




More information about the ovirt-devel mailing list