You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by sv...@apache.org on 2013/05/22 06:02:14 UTC

svn commit: r1485051 - in /subversion/branches/1.8.x: ./ STATUS subversion/include/svn_error.h

Author: svn-role
Date: Wed May 22 04:02:13 2013
New Revision: 1485051

URL: http://svn.apache.org/r1485051
Log:
Merge r1484755 from trunk:

 * r1484755
   Fix SVN_ERR_ASSERT macro to provide failed expression, instead of
   evaluated value when compiled using Visual Studio 2010.
   Justification:
     Assertions diagnostic is important. Regression from 1.7.x.
   Votes:
     +1: ivan, cmpilato, pburba

Modified:
    subversion/branches/1.8.x/   (props changed)
    subversion/branches/1.8.x/STATUS
    subversion/branches/1.8.x/subversion/include/svn_error.h

Propchange: subversion/branches/1.8.x/
------------------------------------------------------------------------------
  Merged /subversion/trunk:r1484755

Modified: subversion/branches/1.8.x/STATUS
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/STATUS?rev=1485051&r1=1485050&r2=1485051&view=diff
==============================================================================
--- subversion/branches/1.8.x/STATUS (original)
+++ subversion/branches/1.8.x/STATUS Wed May 22 04:02:13 2013
@@ -143,14 +143,6 @@ Approved changes:
 # blocking issues.  If in doubt see this link for details:
 # http://subversion.apache.org/docs/community-guide/releasing.html#release-stabilization
 
- * r1484755
-   Fix SVN_ERR_ASSERT macro to provide failed expression, instead of
-   evaluated value when compiled using Visual Studio 2010.
-   Justification:
-     Assertions diagnostic is important. Regression from 1.7.x.
-   Votes:
-     +1: ivan, cmpilato, pburba
-
  * r1483391, r1483397
    Fix 'svn diff' erroring out on missing tree conflict victims.
    Justification:

Modified: subversion/branches/1.8.x/subversion/include/svn_error.h
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/include/svn_error.h?rev=1485051&r1=1485050&r2=1485051&view=diff
==============================================================================
--- subversion/branches/1.8.x/subversion/include/svn_error.h (original)
+++ subversion/branches/1.8.x/subversion/include/svn_error.h Wed May 22 04:02:13 2013
@@ -491,22 +491,10 @@ svn_error_t *svn_error_purge_tracing(svn
     abort();                                                 \
   } while (1)
 
-/** Check that a condition is true: if not, report an error (appending
- * ERR if non-NULL) and possibly terminate the program.
+/** Like SVN_ERR_ASSERT(), but append ERR to the returned error chain.
  *
- * If the boolean expression @a expr is true, do nothing. Otherwise,
- * act as determined by the current "malfunction handler" which may have
- * been specified by a call to svn_error_set_malfunction_handler() or else
- * is the default handler as specified in that function's documentation. If
- * the malfunction handler returns, then cause the function using this macro
- * to return the error object that it generated.
- *
- * @note The intended use of this macro is to check a condition that cannot
- * possibly be false unless there is a bug in the program.
- *
- * @note The condition to be checked should not be computationally expensive
- * if it is reached often, as, unlike traditional "assert" statements, the
- * evaluation of this expression is not compiled out in release-mode builds.
+ * If EXPR is false, return a malfunction error whose chain includes ERR.
+ * If EXPR is true, do nothing.  (In particular, this does not clear ERR.)
  *
  * Types: (svn_boolean_t expr, svn_error_t *err)
  *
@@ -527,13 +515,38 @@ svn_error_t *svn_error_purge_tracing(svn
   } while (0)
 #endif
 
-/** Like SVN_ERR_ASSERT_E(), but with @a err always NULL.
+
+/** Check that a condition is true: if not, report an error and possibly
+ * terminate the program.
  *
- * @see SVN_ERR_ASSERT_E()
+ * If the Boolean expression @a expr is true, do nothing. Otherwise,
+ * act as determined by the current "malfunction handler" which may have
+ * been specified by a call to svn_error_set_malfunction_handler() or else
+ * is the default handler as specified in that function's documentation. If
+ * the malfunction handler returns, then cause the function using this macro
+ * to return the error object that it generated.
+ *
+ * @note The intended use of this macro is to check a condition that cannot
+ * possibly be false unless there is a bug in the program.
+ *
+ * @note The condition to be checked should not be computationally expensive
+ * if it is reached often, as, unlike traditional "assert" statements, the
+ * evaluation of this expression is not compiled out in release-mode builds.
  *
  * @since New in 1.6.
+ *
+ * @see SVN_ERR_ASSERT_E()
  */
-#define SVN_ERR_ASSERT(expr)       SVN_ERR_ASSERT_E(expr, NULL)
+#ifdef __clang_analyzer__
+#include <assert.h>
+#define SVN_ERR_ASSERT(expr)       assert((expr))
+#else
+#define SVN_ERR_ASSERT(expr)                                            \
+  do {                                                                  \
+    if (!(expr))                                                        \
+      SVN_ERR(svn_error__malfunction(TRUE, __FILE__, __LINE__, #expr)); \
+  } while (0)
+#endif
 
 /** Similar to SVN_ERR_ASSERT(), but without the option of returning
  * an error to the calling function.