[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

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

From: Blair Zajac <blair_at_orcaware.com>
Date: 2002-02-12 03:46:10 CET

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 <blair@orcaware.com>
Web and OS performance plots - http://www.orcaware.com/orca/

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
Received on Sat Oct 21 14:37:06 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.