apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <trawi...@bellsouth.net>
Subject Re: [PATCH] iconv tweak
Date Wed, 07 Feb 2001 18:14:59 GMT
Doesn't AC_TRY_COMPILE() succeed if there is a warning?  I think your
patch only helps on rare systems where the compiler won't compile it
at all if the const-ness doesn't match the iconv() prototype.  Yeah,
that is an improvement over the current situation but it would be nice
to get rid of the problem -- warning or error -- altogether.

Mo DeJong <mdejong@cygnus.com> writes:

> On Sun, 4 Feb 2001, Greg Stein wrote:
> 
> > There was some discussion about iconv prototyes here recently, but I kind of
> > missed it.
> > 
> > Do we always need to live with a warning about a type mismatch, or is the
> > cast below appropriate?
> > 
> > IOW, do some headers have "const" on them, and others not?
> 
> Yup, you cannot just use a cast, you need to use a HAVE...
> test because headers differ and newer versions of
> gcc will generate an error on a plain cast.

What does "plain cast" in this sense mean?

> Here is the bit of code from the Jikes java compiler
> that deals with this issue.
> 
>                     size_t n = iconv(_converter,
> #ifdef HAVE_ERROR_CALL_ICONV_CONST
>                                      (char **)
> #endif
>                                      &source_ptr, &srcl,
>                                      (char **)&chp, &chl
>                     );

The code would be nicer if we define ICONV_INBUF_TYPE to "char **" or
"const char **" and then do

  n = iconv(_converter,
            (ICONV_INBUF_TYPE)&source_ptr, &srcl,
            (char **)&chp, &chl);

but that is a minor detail (particularly since we have so few calls to
iconv).

Is it reasonable to test for a compile *warning* via autoconf?

-- 
Jeff Trawick | trawickj@bellsouth.net | PGP public key at web site:
       http://www.geocities.com/SiliconValley/Park/9289/
             Born in Roswell... married an alien...

Mime
View raw message