subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bre...@apache.org
Subject svn commit: r1616255 - in /subversion/trunk/subversion: include/svn_types.h libsvn_subr/error.c libsvn_subr/sqlite.c
Date Wed, 06 Aug 2014 15:27:08 GMT
Author: breser
Date: Wed Aug  6 15:27:08 2014
New Revision: 1616255

URL: http://svn.apache.org/r1616255
Log:
Introduce and use SVN_UNUSED.

* subversion/include/svn_types.h
  (SVN_UNUSED): New macro.

* subversion/libsvn_subr/error.c
  (err_abort): Use SVN_UNUSED instead of a bunch of compiler pragmas to supress
    the unused warning.

* subversion/libsvn_subr/sqlite.c
  (close_apr): Use SVN_UNUSED.


Modified:
    subversion/trunk/subversion/include/svn_types.h
    subversion/trunk/subversion/libsvn_subr/error.c
    subversion/trunk/subversion/libsvn_subr/sqlite.c

Modified: subversion/trunk/subversion/include/svn_types.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_types.h?rev=1616255&r1=1616254&r2=1616255&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_types.h (original)
+++ subversion/trunk/subversion/include/svn_types.h Wed Aug  6 15:27:08 2014
@@ -163,6 +163,13 @@ struct svn_null_pointer_constant_stdarg_
 #define SVN_VA_NULL ((struct svn_null_pointer_constant_stdarg_sentinel_t*)0)
 /* See? (char*)NULL -- They have the same length, but the cast looks ugly. */
 
+
+/** Macro used to specify that a variable is intentionally left unused.
+ *  Supresses compiler warnings about the variable being unused.
+ *
+ * @since New in 1.9.
+ */
+#define SVN_UNUSED(v) ( (void)(v) )
 
 
 /** Subversion error object.

Modified: subversion/trunk/subversion/libsvn_subr/error.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/error.c?rev=1616255&r1=1616254&r2=1616255&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/error.c (original)
+++ subversion/trunk/subversion/libsvn_subr/error.c Wed Aug  6 15:27:08 2014
@@ -85,34 +85,15 @@ svn_error__locate(const char *file, long
 
 /* Cleanup function for errors.  svn_error_clear () removes this so
    errors that are properly handled *don't* hit this code. */
-#if defined(SVN_DEBUG)
-/* GCC >= 4.6 has support for diagnostic pragmas that let us
- * turn off warnings.  clang also supports the same pragmas */
-#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) \
-     || defined(__clang__))
-  #define IGNORING_UNUSED_WARNING
-  #pragma GCC diagnostic push
-  #pragma GCC diagnostic ignored "-Wunused-variable"
-#endif /* supports diagnostic pragmas */
 static apr_status_t err_abort(void *data)
 {
   svn_error_t *err = data;  /* For easy viewing in a debugger */
-#ifndef IGNORING_UNUSED_WARNING
-  /* Fake a use for the variable to avoid compiler warnings if we can't turn
-   * them off via pragmas. */
-  err = err;
-#endif /* IGNORING_UNUSED_WARNING */
+  SVN_UNUSED(err);
 
   if (!getenv("SVN_DBG_NO_ABORT_ON_ERROR_LEAK"))
     abort();
   return APR_SUCCESS;
 }
-#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) \
-     || defined(__clang__))
-  #undef IGNORING_UNUSED_WARNING
-  #pragma GCC diagnostic pop
-#endif /* supports diagnostic pragmas */
-#endif
 
 
 static svn_error_t *

Modified: subversion/trunk/subversion/libsvn_subr/sqlite.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/sqlite.c?rev=1616255&r1=1616254&r2=1616255&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/sqlite.c (original)
+++ subversion/trunk/subversion/libsvn_subr/sqlite.c Wed Aug  6 15:27:08 2014
@@ -934,7 +934,7 @@ close_apr(void *data)
             {
 #ifdef SVN_DEBUG
               const char *stmt_text = db->statement_strings[i];
-              (void)stmt_text; /* Supress unused warning */
+              SVN_UNUSED(stmt_text);
 
               SVN_ERR_MALFUNCTION_NO_RETURN();
 #else



Mime
View raw message