tech-userlevel archive

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

Re: grep/util.c type mismatch



   Date: Mon, 14 Jul 2014 11:06:27 -0700
   From: enh <enh%google.com@localhost>

   building NetBSD's grep for Android/x86, i get:

   grep/util.c:332:9: error: format '%lc' expects argument of type
   'wchar_t *', but argument 3 has type 'wint_t *' [-Werror=format=]
            "%lc", &wbegin) != 1)
            ^
   --- util.c 21 Jan 2013 03:24:43 -0000 1.17
   +++ util.c 14 Jul 2014 18:05:23 -0000
   @@ -324,7 +324,7 @@
     continue;
     /* Check for whole word match */
     if (fg_pattern[i].word && pmatch.rm_so != 0) {
   - wint_t wbegin, wend;
   + wchar_t wbegin, wend;

I don't think this change is sufficient, because passing a wchar_t to
iswalnum via iswword a few lines below is not kosher.  You need to
convert to wint_t via the unsigned version of wchar_t, except I don't
know that we have a correct portable way to do that.

...unless I am much mistaken and there is no analogue to the issue for
isalnum &c. documented in the CAVEATS section of the ctype(3) man
page.


Home | Main Index | Thread Index | Old Index