You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Hyrum K Wright <hy...@hyrumwright.org> on 2011/04/24 02:57:34 UTC

Re: svn commit: r1096150 - /subversion/trunk/subversion/svnadmin/main.c

On Sat, Apr 23, 2011 at 8:59 AM,  <st...@apache.org> wrote:
> Author: stefan2
> Date: Sat Apr 23 13:59:23 2011
> New Revision: 1096150
>
> URL: http://svn.apache.org/viewvc?rev=1096150&view=rev
> Log:
> * subversion/svnadmin/main.c
>  (subcommand_crashtest): silence 'not all control paths return a value'
>   warning in VisualStudio
>
> Modified:
>    subversion/trunk/subversion/svnadmin/main.c
>
> Modified: subversion/trunk/subversion/svnadmin/main.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnadmin/main.c?rev=1096150&r1=1096149&r2=1096150&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/svnadmin/main.c (original)
> +++ subversion/trunk/subversion/svnadmin/main.c Sat Apr 23 13:59:23 2011
> @@ -2001,4 +2001,7 @@ subcommand_crashtest(apr_getopt_t *os, v
>
>   SVN_ERR(open_repos(&repos, opt_state->repository_path, pool));
>   abort();
> +
> +  /* merely silence a compiler warning (this will never be executed) */
> +  return SVN_NO_ERROR;
>  }
>
>

Heh. Now gcc emits an unreachable code error:
subversion/svnadmin/main.c: In function ‘subcommand_crashtest’:
subversion/svnadmin/main.c:2006: warning: will never be executed

I suppose we could if-def the above line depending on the compiler.
If we *don't* want to play such games, my heavily biased bikeshed
would be to omit the admittedly superfluous line.

-Hyrum

RE: svn commit: r1096150 - /subversion/trunk/subversion/svnadmin/main.c

Posted by Bert Huijben <be...@qqmail.nl>.
> ==========================================================
> ====================
> > --- subversion/trunk/subversion/svnadmin/main.c (original)
> > +++ subversion/trunk/subversion/svnadmin/main.c Sat Apr 23 13:59:23
> 2011
> > @@ -2001,4 +2001,7 @@ subcommand_crashtest(apr_getopt_t *os, v
> >
> >   SVN_ERR(open_repos(&repos, opt_state->repository_path, pool));
> >   abort();
> > +
> > +  /* merely silence a compiler warning (this will never be executed) */
> > +  return SVN_NO_ERROR;
> >  }
> >
> >
> 
> Heh. Now gcc emits an unreachable code error:
> subversion/svnadmin/main.c: In function ‘subcommand_crashtest’:
> subversion/svnadmin/main.c:2006: warning: will never be executed
> 
> I suppose we could if-def the above line depending on the compiler.
> If we *don't* want to play such games, my heavily biased bikeshed
> would be to omit the admittedly superfluous line.

.SVN_ERR_MALFUNCTION() should work in all cases.

	Bert


RE: svn commit: r1096150 - /subversion/trunk/subversion/svnadmin/main.c

Posted by Bert Huijben <be...@qqmail.nl>.
> ==========================================================
> ====================
> > --- subversion/trunk/subversion/svnadmin/main.c (original)
> > +++ subversion/trunk/subversion/svnadmin/main.c Sat Apr 23 13:59:23
> 2011
> > @@ -2001,4 +2001,7 @@ subcommand_crashtest(apr_getopt_t *os, v
> >
> >   SVN_ERR(open_repos(&repos, opt_state->repository_path, pool));
> >   abort();
> > +
> > +  /* merely silence a compiler warning (this will never be executed) */
> > +  return SVN_NO_ERROR;
> >  }
> >
> >
> 
> Heh. Now gcc emits an unreachable code error:
> subversion/svnadmin/main.c: In function ‘subcommand_crashtest’:
> subversion/svnadmin/main.c:2006: warning: will never be executed
> 
> I suppose we could if-def the above line depending on the compiler.
> If we *don't* want to play such games, my heavily biased bikeshed
> would be to omit the admittedly superfluous line.

.SVN_ERR_MALFUNCTION() should work in all cases.

	Bert