There are other ways to avoid the warning that are cleaner (outlined
on this list already), but those are more invasive, so I've taken the
easy way out, for now:

>From 57eaa6500c8afacc43b4dd301e6ff7123ee2fe48 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyer...@redhat.com>
Date: Wed, 28 Oct 2009 09:26:04 +0100
Subject: [PATCH] exclude: avoid an unwarranted warning

* lib/exclude.c (excluded_file_name): Initialize "rc" before switch.
---
 ChangeLog     |    5 +++++
 lib/exclude.c |    4 +++-
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 793ae50..54a79e8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-10-28  Jim Meyering  <meyer...@redhat.com>
+
+       exclude: avoid an unwarranted warning
+       * lib/exclude.c (excluded_file_name): Initialize "rc" before switch.
+
 2009-10-27  Eric Blake  <e...@byu.net>

        fseek: avoid compilation failure when fflush is replaced
diff --git a/lib/exclude.c b/lib/exclude.c
index 3ceeed7..310c5ab 100644
--- a/lib/exclude.c
+++ b/lib/exclude.c
@@ -412,7 +412,9 @@ excluded_file_name (struct exclude const *ex, char const *f)
      excluded to included or vice versa.  */
   for (seg = ex->head; seg; seg = seg->next)
     {
-      bool rc;
+      /* Pacify gcc, so it doesn't issue a spurious
+        "may be used uninitialized" warning.  */
+      bool rc = excluded;

       switch (seg->type)
        {
--
1.6.5.2.344.ga473e


Reply via email to