bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fnmatch.c refuse to build with --enable-gcc-warnings


From: Paul Eggert
Subject: Re: fnmatch.c refuse to build with --enable-gcc-warnings
Date: Sat, 06 Jul 2013 17:13:37 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130623 Thunderbird/17.0.7

Thanks, I pushed this fix into gnulib:

---
 ChangeLog          | 6 ++++++
 lib/fnmatch_loop.c | 4 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f714711..7698099 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2013-07-06  Paul Eggert  <address@hidden>
 
+       fnmatch: don't goto over declaration
+       * lib/fnmatch_loop.c (FCT): Hoist local up one level, to avoid
+       undefined behavior for goto over a declaration.
+       Problem reported by Charlie Brown in
+       <http://lists.gnu.org/archive/html/bug-gnulib/2013-07/msg00009.html>.
+
        pipe2: decouple from binary-io a bit
        This is for Emacs, which needs pipe2 but not binary-io.
        * lib/pipe2.c [!GNULIB_BINARY_IO]: Don't include binary-io.h.
diff --git a/lib/fnmatch_loop.c b/lib/fnmatch_loop.c
index 1953302..c303de2 100644
--- a/lib/fnmatch_loop.c
+++ b/lib/fnmatch_loop.c
@@ -227,6 +227,8 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR 
*string_end,
             c = *p++;
             for (;;)
               {
+               bool is_range = false;
+
                 if (!(flags & FNM_NOESCAPE) && c == L_('\\'))
                   {
                     if (*p == L_('\0'))
@@ -420,8 +422,6 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR 
*string_end,
                   }
                 else
                   {
-                    bool is_range = false;
-
 #ifdef _LIBC
                     bool is_seqval = false;
 
-- 
1.7.11.7




reply via email to

[Prev in Thread] Current Thread [Next in Thread]