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

Re: svn commit: r1349316 - /subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c

From: Hyrum K Wright <hyrum.wright_at_wandisco.com>
Date: Tue, 12 Jun 2012 15:29:51 +0200

On Tue, Jun 12, 2012 at 3:22 PM, <stefan2_at_apache.org> wrote:
> Author: stefan2
> Date: Tue Jun 12 13:22:40 2012
> New Revision: 1349316
>
> URL: http://svn.apache.org/viewvc?rev=1349316&view=rev
> Log:
> Fix "unreachable code" warning under Windows. In the for (i=0;i<retries;++i)
> loop header, the ++i would never be executed. So, replace the condition and
> increment with a target-dependent macro.
>
> * subversion/libsvn_fs_fs/fs_fs.c
>  (RECOVERABLE_RETRY_COUNT): drop
>  (RECOVERABLE_RETRY_LOOP): new macro
>  (read_current, revision_proplist, get_and_increment_txn_key_body):
>   use the new macro to guard retries
>
> Modified:
>    subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
>
> Modified: subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c?rev=1349316&r1=1349315&r2=1349316&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c (original)
> +++ subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c Tue Jun 12 13:22:40 2012
> @@ -1451,8 +1451,6 @@ svn_fs_fs__upgrade(svn_fs_t *fs, apr_poo
>  * these macros do not.
>  */
>
> -#define RECOVERABLE_RETRY_COUNT 10
> -
>  #ifdef ESTALE
>  /* Do not use do-while due to the embedded 'continue'.  */
>  #define RETRY_RECOVERABLE(err, filehandle, expr)                \
> @@ -1481,9 +1479,12 @@ svn_fs_fs__upgrade(svn_fs_t *fs, apr_poo
>           return svn_error_trace(err);                         \
>       }                                                         \
>   } else
> +#define RECOVERABLE_RETRY_LOOP \
> +  i < RECOVERABLE_RETRY_COUNT; i++
>  #else
>  #define RETRY_RECOVERABLE(err, filehandle, expr)  SVN_ERR(expr)
>  #define IGNORE_RECOVERABLE(err, expr) SVN_ERR(expr)
> +#define RECOVERABLE_RETRY_LOOP ;
>  #endif
>
>  /* Long enough to hold: "<svn_revnum_t> <node id> <copy id>\0"
> @@ -1508,7 +1509,7 @@ read_current(const char *fname, char **b
>
>   *buf = apr_palloc(pool, CURRENT_BUF_LEN);
>   iterpool = svn_pool_create(pool);
> -  for (i = 0; i < RECOVERABLE_RETRY_COUNT; i++)
> +  for (i = 0; RECOVERABLE_RETRY_LOOP)
>     {
>       svn_pool_clear(iterpool);
>
> @@ -3206,7 +3207,7 @@ revision_proplist(apr_hash_t **proplist_
>
>       proplist = apr_hash_make(pool);
>       iterpool = svn_pool_create(pool);
> -      for (i = 0; i < RECOVERABLE_RETRY_COUNT; i++)
> +      for (i = 0; RECOVERABLE_RETRY_LOOP)
>         {
>           svn_pool_clear(iterpool);
>
> @@ -5038,7 +5039,7 @@ get_and_increment_txn_key_body(void *bat
>   cb->txn_id = apr_palloc(cb->pool, MAX_KEY_SIZE);
>
>   iterpool = svn_pool_create(pool);
> -  for (i = 0; i < RECOVERABLE_RETRY_COUNT; ++i)
> +  for (i = 0; RECOVERABLE_RETRY_LOOP)
>     {
>       svn_pool_clear(iterpool);
>
>

On non-windows platforms, this gives:
[[[
subversion/libsvn_fs_fs/fs_fs.c:1512:15: error: use of undeclared identifier
      'RECOVERABLE_RETRY_COUNT'
  for (i = 0; RECOVERABLE_RETRY_LOOP)
              ^
subversion/libsvn_fs_fs/fs_fs.c:1483:7: note: expanded from macro
      'RECOVERABLE_RETRY_LOOP'
  i < RECOVERABLE_RETRY_COUNT; i++
      ^
subversion/libsvn_fs_fs/fs_fs.c:3210:19: error: use of undeclared identifier
      'RECOVERABLE_RETRY_COUNT'
      for (i = 0; RECOVERABLE_RETRY_LOOP)
                  ^
subversion/libsvn_fs_fs/fs_fs.c:1483:7: note: expanded from macro
      'RECOVERABLE_RETRY_LOOP'
  i < RECOVERABLE_RETRY_COUNT; i++
      ^
subversion/libsvn_fs_fs/fs_fs.c:5042:15: error: use of undeclared identifier
      'RECOVERABLE_RETRY_COUNT'
  for (i = 0; RECOVERABLE_RETRY_LOOP)
              ^
subversion/libsvn_fs_fs/fs_fs.c:1483:7: note: expanded from macro
      'RECOVERABLE_RETRY_LOOP'
  i < RECOVERABLE_RETRY_COUNT; i++
      ^
3 errors generated.
]]]

-Hyrum

-- 
uberSVN: Apache Subversion Made Easy
http://www.uberSVN.com/
Received on 2012-06-12 15:30:24 CEST

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.