You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Victor J. Orlikowski" <vj...@raleigh.ibm.com> on 2000/06/20 00:36:32 UTC

[PATCH] Yet another compile warning patch

Index: src/lib/apr/misc/unix/errorcodes.c
===================================================================
RCS file: /cvs/apache/apache-2.0/src/lib/apr/misc/unix/errorcodes.c,v
retrieving revision 1.21
diff -u -r1.21 errorcodes.c
--- errorcodes.c        2000/06/13 13:41:21     1.21
+++ errorcodes.c        2000/06/19 22:34:55
@@ -247,7 +247,7 @@
 static char *apr_os_strerror(char* buf, ap_size_t bufsize, int err)
 {
 #ifdef HAVE_HSTRERROR
-    return stuffbuffer(buf, bufsize, hstrerror(err));
+    return stuffbuffer(buf, bufsize, (char *)hstrerror(err));
 #else /* HAVE_HSTRERROR */
     const char *msg;



Re: [PATCH] Yet another compile warning patch

Posted by "Victor J. Orlikowski" <vj...@raleigh.ibm.com>.
apr_private.h has a define that determines the inclusion of netdb.h, so
netdb.h is probably being included.

Plus, I made myself a short testfile, including netdb.h explicitly.
No dice.

Victor


Re: [PATCH] Yet another compile warning patch

Posted by Jeff Trawick <tr...@ibm.net>.
> Date: Mon, 19 Jun 2000 19:20:04 -0400 (EDT)
> From: "Victor J. Orlikowski" <vj...@raleigh.ibm.com>
> 
> The warning received is:
> warning: assignment makes pointer from integer without a cast
> The prototype of hstrerror on AIX (from netdb.h) is:
> const char *    hstrerror(int);
> So I don't understand the need of this either.....
> 
> Victor

Is it possible that even if netdb.h is included you aren't getting the
declaration of hstrerror() because of a feature test macro?

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

Re: [PATCH] Yet another compile warning patch

Posted by "Victor J. Orlikowski" <vj...@raleigh.ibm.com>.
*Argh!*

It seems that AIX gcc is not being particularly intelligent with regard to
the handling of const.
It's gcc 2.95.2, so const *should not* be a problem, but that is where the
warning stems.
stuffbuffer says it wants a const char* as a third parameter, and
hstrerror returns a const char*, but gcc seems to ignore the const on the
parameter to stuffbuffer.

Suggest: a test for AIX and gcc, to cast to char*?
Got any better ideas?

Victor


Re: [PATCH] Yet another compile warning patch

Posted by "Victor J. Orlikowski" <vj...@raleigh.ibm.com>.
The warning received is:
warning: assignment makes pointer from integer without a cast
The prototype of hstrerror on AIX (from netdb.h) is:
const char *    hstrerror(int);
So I don't understand the need of this either.....

Victor






Re: [PATCH] Yet another compile warning patch

Posted by Jeff Trawick <tr...@ibm.net>.
> Date: Mon, 19 Jun 2000 18:36:32 -0400 (EDT)
> From: "Victor J. Orlikowski" <vj...@raleigh.ibm.com>
> 
> Index: src/lib/apr/misc/unix/errorcodes.c
> ===================================================================
> RCS file: /cvs/apache/apache-2.0/src/lib/apr/misc/unix/errorcodes.c,v
> retrieving revision 1.21
> diff -u -r1.21 errorcodes.c
> --- errorcodes.c        2000/06/13 13:41:21     1.21
> +++ errorcodes.c        2000/06/19 22:34:55
> @@ -247,7 +247,7 @@
>  static char *apr_os_strerror(char* buf, ap_size_t bufsize, int err)
>  {
>  #ifdef HAVE_HSTRERROR
> -    return stuffbuffer(buf, bufsize, hstrerror(err));
> +    return stuffbuffer(buf, bufsize, (char *)hstrerror(err));
>  #else /* HAVE_HSTRERROR */
>      const char *msg;

That doesn't seem right...  What is the warning?  What is the AIX
prototype for hstrerror() and what header file is it in?  Something
is wrong (or I'm real confused) if we have to cast the return value of
hstrerror() to char *.

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