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

[PATCH] Move unused parameter warning suppression into a macro

From: Jonathan Gilbert <o2w9gs702_at_sneakemail.com>
Date: 2005-10-25 07:26:28 CEST

At David James recommendation, I have placed the macro into svn_types.h.
This seemed the least illogical place to put it, but none of the existing
headers were really a perfect match. :-)

Log:

Move unused parameter warning suppression into a macro instead of directly
using "(void)p;" or "p=p;" in otherwise semantically-oriented source code.

Index: subversion/include/svn_types.h
===================================================================
--- subversion/include/svn_types.h (revision 16987)
+++ subversion/include/svn_types.h (working copy)
@@ -84,6 +84,16 @@

 /** @} */

+/** A macro to suppress some compilers' "Parameter is not used" warnings */
+#ifndef SVN_UNUSED_PARAMETER
+#define SVN_UNUSED_PARAMETER(x) ((void)x)
+/* Possible alternative:
+ *
+ * #define SVN_UNUSED_PARAMETER(x) ((x) = (x))
+ */
+#endif /* SVN_UNUSED_PARAMETER */
+
+

 /** The various types of nodes in the Subversion filesystem. */
 typedef enum
 {
Index: subversion/libsvn_wc/adm_files.c
===================================================================
--- subversion/libsvn_wc/adm_files.c (revision 16987)
+++ subversion/libsvn_wc/adm_files.c (working copy)
@@ -57,7 +57,7 @@
 svn_boolean_t
 svn_wc_is_adm_dir (const char *name, apr_pool_t *pool)
 {
- (void)pool; /* Silence compiler warnings about unused parameter. */
+ SVN_UNUSED_PARAMETER(pool);
   return (0 == strcmp (name, adm_dir_name)
           || 0 == strcmp (name, default_adm_dir_name));
 }
@@ -66,7 +66,7 @@
 const char *
 svn_wc_get_adm_dir (apr_pool_t *pool)
 {
- (void)pool; /* Silence compiler warnings about unused parameter. */
+ SVN_UNUSED_PARAMETER(pool);
   return adm_dir_name;
 }

Index: subversion/libsvn_subr/config.c
===================================================================
--- subversion/libsvn_subr/config.c (revision 16987)
+++ subversion/libsvn_subr/config.c (working copy)
@@ -326,8 +326,8 @@
       option->expanded = FALSE;
     }

- (void)(baton); /* Unused parameter. */
- (void)(section); /* Unused parameter. */
+ SVN_UNUSED_PARAMETER(baton);
+ SVN_UNUSED_PARAMETER(section);
   return FALSE;
 }

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Oct 25 07:25:35 2005

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.