bug-coreutils
[Top][All Lists]
Advanced

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

Re: switched coreutils to new regex implementation


From: Eric Blake
Subject: Re: switched coreutils to new regex implementation
Date: Fri, 08 Jul 2005 06:07:35 -0600
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Paul Eggert on 7/7/2005 6:32 PM:
> I installed the following to sync coreutils from gnulib with respect
> to regex.  This is a big patch, so I won't enclose the stuff that's
> identical to yesterday's gnulib patch.

gcc 3.4.4 emits these warnings on cygwin, when no -W flags are present.

In file included from regex.c:86:
regcomp.c: In function `init_dfa':
regcomp.c:921: warning: comparison is always true due to limited range of
data type
regcomp.c: In function `build_range_exp':
regcomp.c:2698: warning: comparison is always false due to limited range
of data type
regcomp.c:2698: warning: comparison is always false due to limited range
of data type

Cygwin defines WEOF to ((wint_t)-1), with sizeof(wchar_t) is 2 and
sizeof(wint_t) is 4.  That means a wchar_t will never equal WEOF.

Hmm, when working on this patch, the Makefile does not have a dependency
of lib/libcoreutils.a on the changes to lib/regcomp.c.  I also noticed
that I have both coreutils/lib/.deps/ and coreutils/lib/lib/.deps, if that
matters any.  I'm not sure what the correct patch here would be, my
workaround to test the patch was just deleting lib/reg*.o.

2005-07-08  Eric Blake  <address@hidden>  (tiny change)

        * regcomp.c (init_dfa, build_range_exp): Store __btowc value
        in wint_t, not wchar_t.

Index: lib/regcomp.c
===================================================================
RCS file: /cvsroot/coreutils/coreutils/lib/regcomp.c,v
retrieving revision 1.1
diff -u -p -r1.1 regcomp.c
- --- lib/regcomp.c       8 Jul 2005 00:23:16 -0000       1.1
+++ lib/regcomp.c       8 Jul 2005 12:05:49 -0000
@@ -917,7 +917,7 @@ init_dfa (dfa, pat_len)
          for (i = 0, ch = 0; i < BITSET_UINTS; ++i)
            for (j = 0; j < UINT_BITS; ++j, ++ch)
              {
- -               wchar_t wch = __btowc (ch);
+               wint_t wch = __btowc (ch);
                if (wch != WEOF)
                  dfa->sb_char[i] |= 1 << j;
 # ifndef _LIBC
@@ -2682,7 +2682,8 @@ build_range_exp (sbcset, start_elem, end

 # ifdef RE_ENABLE_I18N
   {
- -    wchar_t wc, start_wc, end_wc;
+    wchar_t wc;
+    wint_t start_wc, end_wc;
     wchar_t cmp_buf[6] = {L'\0', L'\0', L'\0', L'\0', L'\0', L'\0'};

     start_ch = ((start_elem->type == SB_CHAR) ? start_elem->opr.ch

- --
Life is short - so eat dessert first!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCzmyG84KuGfSFAYARAn70AJ4ifNvPxJbMVyU3O5FbR7NK1mVCjQCcCWVv
TvzPe4CSeKJOfl3AqHW4MaQ=
=mPQW
-----END PGP SIGNATURE-----




reply via email to

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