bug-gnulib
[Top][All Lists]
Advanced

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

Re: stdlib tweak


From: Eric Blake
Subject: Re: stdlib tweak
Date: Wed, 23 Dec 2009 05:55:48 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666

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

According to Bruno Haible on 12/23/2009 3:32 AM:
>> I went with signature_check.
> 
> I like it. And yes, we need to make it non-'static', like so many other stuff
> in unit tests that we don't want gcc to warn about.

I can go either way on static vs. non-static - the use of _GL_UNUSED is
not that hard (and I've already run a sed script to make the change, so I
have a candidate commit either way).

>>  # include <iconv.h>
>> +
>> +size_t (*signature_check1) (iconv_t, char **, size_t *, char **,
>> +                            size_t *) = iconv;
> 
> On some systems, iconv is declared with 'const' in the first pointer argument

Yep; I already discovered and fixed it in the same way as you proposed in
my working copy.  By the way, libiconv has an annoying catch-22: we want
to FIX iconv.h to match POSIX on cygwin.  However, cygwin's <iconv.h>
comes from libiconv, and libiconv honors the const-ness present in
<iconv.h>.  Therefore, it requires some ugly munging with internals when
calling configure: http://cygwin.com/ml/cygwin/2009-12/msg00681.html

>> +/* Caution: lstat may be a function-like macro.  Although this
>> +   signature check must pass, it may be the signature of the real (and
>> +   broken) lstat rather than rpl_lstat.  Most code should not use the
>> +   address of lstat.  */
>> +int (*signature_check) (char const *, struct stat *) = lstat;
> 
> This warning is justified for the 'stat' function. But lstat is correctly
> redirected by gnulib. No need for this caution comment here.

Actually, on mingw, lstat is #defined to stat, and stat() is #defined to
rpl_stat().  So yes, on mingw, lstat is a function-like macro, and the
above check is on the native stat and not on our replacement rpl_stat.

>> +char *(*signature_check) (nl_item, locale_t) = nl_langinfo;
> 
> This is incorrect. nl_langinfo does not take a 'locale_t' argument.
> You must be confusing it with nl_langinfo_l (which is not supported by
> gnulib yet).

Oops.  The two lines are next to one another in POSIX.  Now fixed in my
local copy.
http://www.opengroup.org/onlinepubs/9699919799/functions/nl_langinfo.html

- --
Don't work too hard, make some time for fun as well!

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

iEYEARECAAYFAksyE1QACgkQ84KuGfSFAYCsigCgoMyEQrlK5a7ArhmTdHWN9qtm
rCMAoIgoxb2RyTTvhq2SBiqj3YY5TjK5
=bUE5
-----END PGP SIGNATURE-----




reply via email to

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