[PATCH:libxtrans 07/10] Add _X_UNUSED attributes to silence unused parameter warnings

Alan Coopersmith alan.coopersmith at oracle.com
Tue Sep 27 14:28:27 PDT 2011


Not all the transport variants use all the arguments to every function,
but as long as one transport type needs it, they all get the args passed.

Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 Xtransint.h  |    4 ++++
 Xtranslcl.c  |   20 ++++++++++----------
 Xtranssock.c |    2 +-
 Xtransutil.c |    2 +-
 4 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/Xtransint.h b/Xtransint.h
index bfd79d6..1052777 100644
--- a/Xtransint.h
+++ b/Xtransint.h
@@ -78,6 +78,10 @@ from The Open Group.
 
 #include "Xtrans.h"
 
+#ifndef _X_UNUSED  /* Defined in Xfuncproto.h in xproto >= 7.0.22 */
+# define _X_UNUSED  /* */
+#endif
+
 #ifdef XTRANSDEBUG
 # include <stdio.h>
 #endif /* XTRANSDEBUG */
diff --git a/Xtranslcl.c b/Xtranslcl.c
index af935b0..7acc907 100644
--- a/Xtranslcl.c
+++ b/Xtranslcl.c
@@ -123,7 +123,7 @@ static int TRANS(LocalClose)(XtransConnInfo ciptr);
 /* Type Not Supported */
 
 static int
-TRANS(OpenFail)(XtransConnInfo ciptr, char *port)
+TRANS(OpenFail)(XtransConnInfo ciptr _X_UNUSED, char *port _X_UNUSED)
 
 {
     return -1;
@@ -132,7 +132,7 @@ TRANS(OpenFail)(XtransConnInfo ciptr, char *port)
 #ifdef TRANS_REOPEN
 
 static int
-TRANS(ReopenFail)(XtransConnInfo ciptr, int fd, char *port)
+TRANS(ReopenFail)(XtransConnInfo ciptr _X_UNUSED, int fd _X_UNUSED, char *port _X_UNUSED)
 
 {
     return 0;
@@ -221,7 +221,7 @@ extern char *ptsname(
     int
 );
 
-static void _dummy(int sig)
+static void _dummy(int sig _X_UNUSED)
 
 {
 }
@@ -1299,7 +1299,7 @@ TRANS(PTSReopenServer)(XtransConnInfo ciptr, int fd, char *port)
 #ifdef LOCAL_TRANS_NAMED
 
 static int
-TRANS(NAMEDReopenServer)(XtransConnInfo ciptr, int fd, char *port)
+TRANS(NAMEDReopenServer)(XtransConnInfo ciptr, int fd _X_UNUSED, char *port)
 
 {
 #ifdef NAMEDNODENAME
@@ -1866,7 +1866,7 @@ TRANS(LocalOpenClient)(int type, char *protocol, char *host, char *port)
 #ifdef TRANS_SERVER
 
 static XtransConnInfo
-TRANS(LocalOpenServer)(int type, char *protocol, char *host, char *port)
+TRANS(LocalOpenServer)(int type, char *protocol, char *host _X_UNUSED, char *port)
 
 {
     int	i;
@@ -1981,7 +1981,7 @@ TRANS(LocalReopenServer)(int type, int index, int fd, char *port)
 #ifdef TRANS_CLIENT
 
 static XtransConnInfo
-TRANS(LocalOpenCOTSClient)(Xtransport *thistrans, char *protocol,
+TRANS(LocalOpenCOTSClient)(Xtransport *thistrans _X_UNUSED, char *protocol,
 			   char *host, char *port)
 
 {
@@ -2040,7 +2040,7 @@ TRANS(LocalOpenCOTSServer)(Xtransport *thistrans, char *protocol,
 #ifdef TRANS_CLIENT
 
 static XtransConnInfo
-TRANS(LocalOpenCLTSClient)(Xtransport *thistrans, char *protocol,
+TRANS(LocalOpenCLTSClient)(Xtransport *thistrans _X_UNUSED, char *protocol,
 			   char *host, char *port)
 
 {
@@ -2055,7 +2055,7 @@ TRANS(LocalOpenCLTSClient)(Xtransport *thistrans, char *protocol,
 #ifdef TRANS_SERVER
 
 static XtransConnInfo
-TRANS(LocalOpenCLTSServer)(Xtransport *thistrans, char *protocol,
+TRANS(LocalOpenCLTSServer)(Xtransport *thistrans _X_UNUSED, char *protocol,
 			   char *host, char *port)
 
 {
@@ -2134,7 +2134,7 @@ TRANS(LocalSetOption)(XtransConnInfo ciptr, int option, int arg)
 #ifdef TRANS_SERVER
 
 static int
-TRANS(LocalCreateListener)(XtransConnInfo ciptr, char *port, unsigned int flags)
+TRANS(LocalCreateListener)(XtransConnInfo ciptr, char *port, unsigned int flags _X_UNUSED)
 
 {
     prmsg(2,"LocalCreateListener(%p->%d,%s)\n",ciptr,ciptr->fd,port);
@@ -2199,7 +2199,7 @@ TRANS(LocalAccept)(XtransConnInfo ciptr, int *status)
 #ifdef TRANS_CLIENT
 
 static int
-TRANS(LocalConnect)(XtransConnInfo ciptr, char *host, char *port)
+TRANS(LocalConnect)(XtransConnInfo ciptr, char *host _X_UNUSED, char *port)
 
 {
     prmsg(2,"LocalConnect(%p->%d,%s)\n", ciptr, ciptr->fd, port);
diff --git a/Xtranssock.c b/Xtranssock.c
index c2d69e6..268c599 100644
--- a/Xtranssock.c
+++ b/Xtranssock.c
@@ -453,7 +453,7 @@ TRANS(SocketOpen) (int i, int type)
 #ifdef TRANS_REOPEN
 
 static XtransConnInfo
-TRANS(SocketReopen) (int i, int type, int fd, char *port)
+TRANS(SocketReopen) (int i _X_UNUSED, int type, int fd, char *port)
 
 {
     XtransConnInfo	ciptr;
diff --git a/Xtransutil.c b/Xtransutil.c
index 3cb01c5..bf52b37 100644
--- a/Xtransutil.c
+++ b/Xtransutil.c
@@ -316,7 +316,7 @@ int
 void
 #endif
 #endif
-nameserver_lost(int sig)
+nameserver_lost(int sig _X_UNUSED)
 {
   nameserver_timedout = 1;
   longjmp (env, -1);
-- 
1.7.3.2



More information about the xorg-devel mailing list