You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Blair Zajac <bl...@orcaware.com> on 2002/02/12 02:30:41 UTC

Goto label warning with gcc -Wall

When not compiling with --enable-maintainer-mode, then you get this warning
with gcc -Wall:

subversion/mod_dav_svn/repos.c: In function `dav_svn_get_resource':
subversion/mod_dav_svn/repos.c:1030: warning: label `unknown_URI' defined but not used

The label is used here:

#ifdef SVN_DEBUG
  if (comb->res.type == DAV_RESOURCE_TYPE_UNKNOWN)
    {
      DBG0("DESIGN FAILURE: should not be UNKNOWN at this point");
      goto unknown_URI;
    }
#endif

and the goto is this:

 unknown_URI:
  /* Unknown URI. Return NULL to indicate "no resource" */
  *resource = NULL;
  return NULL;
}

Can the label code just be moved into the if statement, or is there a
reason that this code is split up?  -1 on style points here.  If not,
then let's put #ifdef SVN_DEBUG around the label and the code following it.

Best,
Blair

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Re: Goto label warning with gcc -Wall

Posted by Greg Stein <gs...@lyra.org>.
On Mon, Feb 11, 2002 at 09:45:26PM -0600, Karl Fogel wrote:
> Blair Zajac <bl...@orcaware.com> writes:
> > Attached is a patch to fix this warning.
> 
> This patch looks good to me (at first I thought it was leaving the
> function without a return value, but then I looked at the code).  I'll
> defer to Greg Stein to apply, as he knows best what that code is
> doing.

Yup, looks good, but missing a log message. I've gone ahead and applied it
with a log message (please send one in the future with any patch).

The unknown_URI label was multiply-used in the past, but after some
simplifications it became just that one reference. Combining them was the
right approach.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Re: Goto label warning with gcc -Wall

Posted by Karl Fogel <kf...@newton.ch.collab.net>.
Blair Zajac <bl...@orcaware.com> writes:
> Attached is a patch to fix this warning.

This patch looks good to me (at first I thought it was leaving the
function without a return value, but then I looked at the code).  I'll
defer to Greg Stein to apply, as he knows best what that code is
doing.

-K

> Index: ./subversion/mod_dav_svn/repos.c
> ===================================================================
> --- ./subversion/mod_dav_svn/repos.c
> +++ ./subversion/mod_dav_svn/repos.c	Mon Feb 11 18:44:10 2002
> @@ -985,8 +985,10 @@
>  #ifdef SVN_DEBUG
>    if (comb->res.type == DAV_RESOURCE_TYPE_UNKNOWN)
>      {
> +      /* Unknown URI. Return NULL to indicate "no resource" */
>        DBG0("DESIGN FAILURE: should not be UNKNOWN at this point");
> -      goto unknown_URI;
> +      *resource = NULL;
> +      return NULL;
>      }
>  #endif
>  
> @@ -1026,11 +1028,6 @@
>                         "special resource area, but does not exist. This is "
>                         "generally caused by a problem in the client "
>                         "software.");
> -
> - unknown_URI:
> -  /* Unknown URI. Return NULL to indicate "no resource" */
> -  *resource = NULL;
> -  return NULL;
>  }
>  
>  static dav_error * dav_svn_get_parent_resource(const dav_resource *resource,
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

[PATCH] Re: Goto label warning with gcc -Wall

Posted by Blair Zajac <bl...@orcaware.com>.
Attached is a patch to fix this warning.

Blair

Blair Zajac wrote:
> 
> When not compiling with --enable-maintainer-mode, then you get this warning
> with gcc -Wall:
> 
> subversion/mod_dav_svn/repos.c: In function `dav_svn_get_resource':
> subversion/mod_dav_svn/repos.c:1030: warning: label `unknown_URI' defined but not used
> 
> The label is used here:
> 
> #ifdef SVN_DEBUG
>   if (comb->res.type == DAV_RESOURCE_TYPE_UNKNOWN)
>     {
>       DBG0("DESIGN FAILURE: should not be UNKNOWN at this point");
>       goto unknown_URI;
>     }
> #endif
> 
> and the goto is this:
> 
>  unknown_URI:
>   /* Unknown URI. Return NULL to indicate "no resource" */
>   *resource = NULL;
>   return NULL;
> }
> 
> Can the label code just be moved into the if statement, or is there a
> reason that this code is split up?  -1 on style points here.  If not,
> then let's put #ifdef SVN_DEBUG around the label and the code following it.
> 
> Best,
> Blair

-- 
Blair Zajac <bl...@orcaware.com>
Web and OS performance plots - http://www.orcaware.com/orca/