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...@mail.utexas.edu> on 2009/04/17 14:19:54 UTC

Re: svn commit: r37324 - trunk/subversion/include

I'll let it as an exercise for the reader to actually use this new  
macro.  Something along the lines of
s/return err;/SVN_ERR_RETURN(err);/
would probably be a good start.

-Hyrum

On Apr 17, 2009, at 9:14 AM, Hyrum K. Wright wrote:

> Author: hwright
> Date: Fri Apr 17 07:14:37 2009
> New Revision: 37324
>
> Log:
> Following up to the recent work on adding a stack trace to errors,  
> create
> a new macro which returns a wrapped error.  Use that new macro in the
> definition of SVN_ERR().
>
> * subversion/include/svn_error.h
>  (SVN_ERR): Use SVN_ERR_RETURN(), and let it be conditionally defined.
>  (SVN_ERR_RETURN): New macro.
>
> Modified:
>   trunk/subversion/include/svn_error.h
>
> Modified: trunk/subversion/include/svn_error.h
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/include/svn_error.h?pathrev=37324&r1=37323&r2=37324
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- trunk/subversion/include/svn_error.h	Fri Apr 17 06:50:58 2009	 
> (r37323)
> +++ trunk/subversion/include/svn_error.h	Fri Apr 17 07:14:37 2009	 
> (r37324)
> @@ -276,21 +276,32 @@ svn_handle_warning(FILE *stream,
>  *
>  * would not mean what they appear to.
>  */
> -#ifdef SVN_ERR__TRACING
> -#define SVN_ERR__TRACED "traced call"
> -#define SVN_ERR(expr)                                            \
> -  do {                                                           \
> -    svn_error_t *svn_err__temp = (expr);                         \
> -    if (svn_err__temp)                                           \
> -      return svn_error_quick_wrap(svn_err__temp, SVN_ERR__TRACED); \
> -  } while (0)
> -#else
> #define SVN_ERR(expr)                           \
>   do {                                          \
>     svn_error_t *svn_err__temp = (expr);        \
>     if (svn_err__temp)                          \
> -      return svn_err__temp;                     \
> +      SVN_ERR_RETURN(svn_err__temp);            \
> +  } while (0)
> +
> +/**
> + * A statement macro for returning error values, very similar to @c  
> SVN_ERR.
> + *
> + * This macro can be used in place of directly returning an error  
> to ensure
> + * that the call stack is recorded correctly.
> + */
> +#ifdef SVN_ERR__TRACING
> +#define SVN_ERR__TRACED "traced call"
> +
> +#define SVN_ERR_RETURN(svn_err__temp2)                              \
> +  do {                                                              \
> +    if (svn_err__temp2)                                             \
> +      return svn_error_quick_wrap(svn_err__temp2, SVN_ERR__TRACED); \
> +    else                                                            \
> +      return (svn_err__temp2);                                      \
>   } while (0)
> +#else
> +#define SVN_ERR_RETURN(svn_err__temp2)                              \
> +  return (svn_err__temp2)
> #endif
>
> /** A statement macro, very similar to @c SVN_ERR.
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=495&dsMessageId=1768430

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1768481