You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Ben Laurie <be...@gonzo.ben.algroup.co.uk> on 1996/07/03 12:49:40 UTC

cvs commit: apache/src mod_proxy.c (fwd)

Chuck Murcko wrote:
> From heap.ben.algroup.co.uk!arachnet-fw.algroup.co.uk!taz.hyperreal.com!hyperreal.com!owner-apache-cvs Wed Jul  3 04:03:47 1996
> Date: Tue, 2 Jul 1996 20:47:05 -0700
> From: Chuck Murcko <ch...@hyperreal.com>
> Message-Id: <19...@taz.hyperreal.com>
> To: apache-cvs@hyperreal.com
> Subject: cvs commit: apache/src mod_proxy.c
> Sender: owner-apache-cvs@hyperreal.com
> Precedence: bulk
> 
> chuck       96/07/02 20:47:04
> 
>   Modified:    src       mod_proxy.c
>   Log:
>   Submitted by:	Chuck Murcko
>   Avoid warning under gcc 2.7.2 & SunOS 4.1.4.
>   
>   Revision  Changes    Path
>   1.31      +1 -1      apache/src/mod_proxy.c
>   
>   Index: mod_proxy.c
>   ===================================================================
>   RCS file: /export/home/cvs/apache/src/mod_proxy.c,v
>   retrieving revision 1.30
>   retrieving revision 1.31
>   diff -C3 -r1.30 -r1.31
>   *** mod_proxy.c	1996/07/03 03:32:30	1.30
>   --- mod_proxy.c	1996/07/03 03:47:03	1.31
>   ***************
>   *** 1246,1252 ****
>         const char *p, *q;
>     
>         q = get_time();
>   !     p = strerror(errno);
>     
>         if (err != NULL)
>         {
>   --- 1246,1252 ----
>         const char *p, *q;
>     
>         q = get_time();
>   !     (char *)p = strerror(errno);

This is ridiculous. What warning does this fix?

I do object to fixing invalid warnings (and I find it hard to believe that this
one is valid) in the mainline code.

Cheers,

Ben.

>     
>         if (err != NULL)
>         {
>   
>   
>   

-- 
Ben Laurie                  Phone: +44 (181) 994 6435
Freelance Consultant and    Fax:   +44 (181) 994 6472
Technical Director          Email: ben@algroup.co.uk
A.L. Digital Ltd,           URL: http://www.algroup.co.uk
London, England.

Re: cvs commit: apache/src mod_proxy.c (fwd)

Posted by Paul Richards <p....@elsevier.co.uk>.
Ben Laurie writes:
 > > 
 > > The code is wrong, p should not be a "const char *", it's only used to
 > > pick up the error string from strerror and strerror returns a "char *".
 > > 
 > > The compiler warning is correct since the variable is not the same type
 > > as the return parameter.
 > 
 > Nah. An assignment from char * to const char * is legal. Vice versa is not.

I know it's legal, if it wasn't legal you'd have an error not a warning.

The warning is correct, the variable's declaration does not match the
type expected as specified by the function prototype, gcc 2.7.x creates
lots more warnings than earlier versions, it's more pedantic.

In this case the warning is genuinely harmless but correct the warning
properly not by casting to something it should have been in the first
place (the cast makes the const a complete waste of time anyway, even
if it had served some purpose in the first place, which it didn't).

It's very rare that sticking in a cast is the correct fix, it usually just
masks the real situation.

cvs commit: apache/src mod_proxy.c (fwd)

Posted by Paul Richards <p....@elsevier.co.uk>.
Ben Laurie writes:
 > > 
 > >   --- mod_proxy.c	1996/07/03 03:47:03	1.31
 > >   ***************
 > >   *** 1246,1252 ****
 > >         const char *p, *q;
 > >     
 > >         q = get_time();
 > >   !     p = strerror(errno);
 > >     
 > >         if (err != NULL)
 > >         {
 > >   --- 1246,1252 ----
 > >         const char *p, *q;
 > >     
 > >         q = get_time();
 > >   !     (char *)p = strerror(errno);
 > 
 > This is ridiculous. What warning does this fix?
 > 
 > I do object to fixing invalid warnings (and I find it hard to believe that this
 > one is valid) in the mainline code.

The code is wrong, p should not be a "const char *", it's only used to
pick up the error string from strerror and strerror returns a "char *".

The compiler warning is correct since the variable is not the same type
as the return parameter.