Skip to contentSkip to conversation

Remove warnings on various platforms

PATCH In review Tom Haynes 3 participants 6 messages Jun 28, 2011 – Jun 29, 2011

Subsystems (2)
lore
Share & tools
lore

Tom Haynes

author
#0 lore raw

PATCH 1/1 Remove warnings on various platforms

---
 basic/subr.c       |    5 ++++-
 basic/test1.c      |    1 +
 basic/test2.c      |    1 +
 basic/test3.c      |    1 +
 basic/test4.c      |    1 +
 basic/test4a.c     |    1 +
 basic/test5.c      |    1 +
 basic/test5a.c     |    1 +
 basic/test5b.c     |    1 +
 basic/test6.c      |    1 +
 basic/test7.c      |    1 +
 basic/test7a.c     |    1 +
 basic/test7b.c     |    1 +
 basic/test8.c      |    1 +
 basic/test9.c      |    1 +
 domount.c          |    3 +++
 general/large.c    |    1 +
 general/stat.c     |    1 +
 getopt.c           |    3 +++
 special/dupreq.c   |    1 +
 special/negseek.c  |    1 +
 special/nfsidem.c  |    1 +
 special/nstat.c    |    1 +
 special/rename.c   |    1 +
 special/rewind.c   |    6 +++++-
 special/stat.c     |    1 +
 special/touchn.c   |    6 ++++--
 special/truncate.c |    6 +++++-
 tools/dirdmp.c     |    1 +
 tools/dirprt.c     |    1 +
 tools/pmapbrd.c    |   15 ++++++++-------
 tools/tcpd.c       |    2 +-
 tools/udp.c        |    2 +-
 tools/udpd.c       |    2 +-
 34 files changed, 59 insertions(+), 15 deletions(-)
basic/subr.c +4 -1
index cf220b7..dafff4f 100644
@@ -19,17 +19,20 @@
 #endif
 
 #include <sys/types.h>
-#include <sys/timeb.h>
 
 #ifdef DOSorWIN32
+#include <sys/timeb.h>
 #include <time.h>
 #else
 #include <sys/time.h>
 #endif
+
 #include <sys/stat.h>
+#include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+
 #ifdef STDARG
 #include <stdarg.h>
 #endif
basic/test1.c +1 -0
index 6b15c34..18514ea 100644
@@ -50,6 +50,7 @@ usage()
 	fprintf(stdout, "          n    Suppress test directory create operations\n");
 }
 
+int
 main(argc, argv)
 	int argc;
 	char *argv[];
basic/test2.c +1 -0
index cdb52eb..f6f9e2f 100644
@@ -48,6 +48,7 @@ usage()
 	fprintf(stdout, "          n    Suppress test directory create operations\n");
 }
 
+int
 main(argc, argv)
 	int argc;
 	char *argv[];
basic/test3.c +1 -0
index c53fff8..7b31da8 100644
@@ -48,6 +48,7 @@ usage()
 	fprintf(stdout, "          n    Suppress test directory create operations\n");
 }
 
+int
 main(argc, argv)
 	int argc;
 	char *argv[];
basic/test4.c +1 -0
index f72e956..416c0a6 100644
@@ -52,6 +52,7 @@ usage()
 		"          n    Suppress test directory create operations\n");
 }
 
+int
 main(argc, argv)
 	int argc;
 	char *argv[];
basic/test4a.c +1 -0
index 336ed74..1706b1a 100644
@@ -52,6 +52,7 @@ usage()
 		"          n    Suppress test directory create operations\n");
 }
 
+int
 main(argc, argv)
 	int argc;
 	char *argv[];
basic/test5.c +1 -0
index f9463ae..6ba9e87 100644
@@ -80,6 +80,7 @@ usage()
 #endif
 }
 
+int
 main(argc, argv)
 	int argc;
 	char *argv[];
basic/test5a.c +1 -0
index 716d917..bb4cbd5 100644
@@ -79,6 +79,7 @@ usage()
 #endif
 }
 
+int
 main(argc, argv)
 	int argc;
 	char *argv[];
basic/test5b.c +1 -0
index 7062680..4d8d2c7 100644
@@ -60,6 +60,7 @@ usage()
 	fprintf(stdout, "          n    Suppress test directory create operations\n");
 }
 
+int
 main(argc, argv)
 	int argc;
 	char *argv[];
basic/test6.c +1 -0
index 1d64c88..96388f2 100644
@@ -65,6 +65,7 @@ usage()
 	fprintf(stdout, "          i    Ignore non-test files dir entries\n");
 }
 
+int
 main(argc, argv)
 	int argc;
 	char *argv[];
basic/test7.c +1 -0
index f7b3e2e..d19685f 100644
@@ -53,6 +53,7 @@ usage()
 	fprintf(stdout, "          n    Suppress test directory create operations\n");
 }
 
+int
 main(argc, argv)
 	int argc;
 	char *argv[];
basic/test7a.c +1 -0
index 1e4170c..bc8f363 100644
@@ -51,6 +51,7 @@ usage()
 	fprintf(stdout, "          n    Suppress test directory create operations\n");
 }
 
+int
 main(argc, argv)
 	int argc;
 	char *argv[];
basic/test7b.c +1 -0
index 2f5b119..925b1fc 100644
@@ -53,6 +53,7 @@ usage()
 	fprintf(stdout, "          n    Suppress test directory create operations\n");
 }
 
+int
 main(argc, argv)
 	int argc;
 	char *argv[];
basic/test8.c +1 -0
index ea9aa0c..d65eb3a 100644
@@ -55,6 +55,7 @@ usage()
 	fprintf(stdout, "          n    Suppress test directory create operations\n");
 }
 
+int
 main(argc, argv)
 	int argc;
 	char *argv[];
basic/test9.c +1 -0
index ef68fc2..f376109 100644
@@ -65,6 +65,7 @@ usage()
 	fprintf(stdout, "          n    Suppress test directory create operations\n");
 }
 
+int
 main(argc, argv)
 	int argc;
 	char *argv[];
domount.c +3 -0
index 8982684..5b2fb80 100644
@@ -8,7 +8,10 @@
  */
 
 #include <stdio.h>
+#include <stdlib.h>
+#include <strings.h>
 
+int
 main(argc, argv)
 	int argc;
 	char **argv;
general/large.c +1 -0
index 5dd2950..b5bad18 100644
@@ -49,6 +49,7 @@ int	nc, nl, np, nxo, na;
 
 #define	cunlink(s)	if (s) unlink(s)
 
+int
 main(argc, argv)
 	char **argv;
 {
general/stat.c +1 -0
index b9128ae..67c58f5 100644
@@ -24,6 +24,7 @@ char	*Prog, *File;
 int	getattfmt();
 void	prtstat();
 
+int
 main(argc, argv)
 	int	argc;
 	char	*argv[];
getopt.c +3 -0
index da64713..ae1eb11 100644
@@ -36,6 +36,7 @@
 	(void) write(2, errbuf, 2);}
 
 #include <string.h>
+#include <stdlib.h>
 
 int	opterr = 1;
 int	optind = 1;
@@ -94,7 +95,9 @@ char	**argv, *opts;
 
 #include	<stdio.h>
 
+int
 main(ac, av)
+int	ac;
 char	**av;
 {
 	register int	i;
special/dupreq.c +1 -0
index 29174a6..8a896ee 100644
@@ -17,6 +17,7 @@
 #include <fcntl.h>
 #endif
 
+int
 main(argc, argv)
 	int argc;
 	char *argv[];
special/negseek.c +1 -0
index c974070..00d42d4 100644
@@ -21,6 +21,7 @@
 #endif
 #endif /* DOSorWIN32 */
 
+int
 main(argc, argv)
 	int argc;
 	char *argv[];
special/nfsidem.c +1 -0
index ac95c39..5bae363 100644
@@ -53,6 +53,7 @@ static char TBAR[MAXPATHLEN];
 static char LBAR[MAXPATHLEN];
 static char str[STRCHARS];
 
+int
 main(ac,av)
 	int ac;
 	char *av[];
special/nstat.c +1 -0
index 87c1def..fdbd3f9 100644
@@ -26,6 +26,7 @@
 
 static int stats = 0;
 
+int
 main(argc, argv)
 	int argc;
 	char *argv[];
special/rename.c +1 -0
index 8abbc60..a16d7be 100644
@@ -21,6 +21,7 @@
 #endif
 #endif /* DOSorWIN32 */
 
+int
 main(argc, argv)
 	int argc;
 	char *argv[];
special/rewind.c +5 -1
index b5400d3..32003ea 100644
@@ -14,7 +14,11 @@
 #include <unistd.h>
 #endif /* DOSorWIN32 */
 
-main()
+/*ARGSUSED*/    
+int
+main(argc, argv)
+	int argc;
+	char *argv[];
 {
 	char buffer[8192];
 	int size = 8192;
special/stat.c +1 -0
index 941eec1..c87f422 100644
@@ -34,6 +34,7 @@ static int stats = 0;
 
 static void statit ARGS_((char *));
 
+int
 main(argc, argv)
 	int argc;
 	char *argv[];
special/touchn.c +4 -2
index 3038eba..fdbfe14 100644
@@ -18,8 +18,10 @@
 
 #include "../tests.h"
 
-main(argc,argv)
-char **argv;
+int
+main(argc, argv)
+	int argc;
+	char **argv;
 {
 	int n;
 	char buf[1024];
special/truncate.c +5 -1
index 4c4f076..50b65ad 100644
@@ -18,7 +18,11 @@
 #include <unistd.h>
 #endif /* DOSorWIN32 */
 
-main()
+/*ARGSUSED*/    
+int
+main(argc, argv)
+	int argc;
+	char *argv[];
 {
 	int fd;
 	struct stat statb;
tools/dirdmp.c +1 -0
index 76ac2c3..9b87e11 100644
@@ -31,6 +31,7 @@ static DIR * my_opendir ARGS_((char *name));
 static void print ARGS_((char *));
 static struct dirent *my_readdir ARGS_((DIR *dirp));
 
+int
 main(argc, argv)
 	int argc;
 	char *argv[];
tools/dirprt.c +1 -0
index a8b50ea..9d5fb98 100644
@@ -34,6 +34,7 @@
 static DIR *my_opendir ARGS_((char *));
 static void print ARGS_((char *));
 
+int
 main(argc, argv)
 	int argc;
 	char *argv[];
tools/pmapbrd.c +8 -7
index 2bb05b6..71aadd8 100644
@@ -174,8 +174,9 @@ main(argc, argv)
 		 * XXX shouldn't have to cast eachresult?
 		 */
 		clnt_stat =
-		    clnt_broadcast_time(sock, RPROG, RVERS, RPROC_NUM, xdr_void, &a,
-		    xdr_void, &b, (resultproc_t)eachresult, &t);
+		    clnt_broadcast_time(sock, RPROG, RVERS, RPROC_NUM,
+		    (xdrproc_t)xdr_void, &a, (xdrproc_t)xdr_void, &b,
+		    (resultproc_t)eachresult, &t);
 		if(clnt_stat != RPC_TIMEDOUT) {
 			printf("error: clnt_stat = %d\n", clnt_stat);
 			clnt_perrno(clnt_stat);
@@ -243,9 +244,9 @@ xdr_rmtcallres(xdrs, crp)
 {
 
 #ifdef SVR3
-	if (xdr_reference(xdrs, (caddr_t *)&crp->port_ptr, sizeof (ulong), xdr_u_long) &&
+	if (xdr_reference(xdrs, (caddr_t *)&crp->port_ptr, sizeof (ulong), (xdrproc_t)xdr_u_long) &&
 #else
-	if (xdr_reference(xdrs, (caddr_t *)&crp->port_ptr, sizeof (u_long), xdr_u_long) &&
+	if (xdr_reference(xdrs, (caddr_t *)&crp->port_ptr, sizeof (u_long), (xdrproc_t)xdr_u_long) &&
 #endif
 		xdr_u_long(xdrs, &crp->resultslen))
 		return ((*(crp->xdr_results))(xdrs, crp->results_ptr));
@@ -387,7 +388,7 @@ clnt_broadcast_time(sock, prog, vers, proc, xargs, argsp, xresults,
 recv_again:
 	msg.acpted_rply.ar_verf = _null_auth;
 	msg.acpted_rply.ar_results.where = (caddr_t)&r;
-	msg.acpted_rply.ar_results.proc = xdr_rmtcallres;
+	msg.acpted_rply.ar_results.proc = (xdrproc_t)xdr_rmtcallres;
 	readfds = mask;
 	switch (select(32, (fd_set *)&readfds, (fd_set *)NULL, (fd_set *)NULL,
 			t)) {
@@ -409,7 +410,7 @@ recv_again:
 try_again:
 	fromlen = sizeof(struct sockaddr);
 	inlen = recvfrom(sock, inbuf, MAX_BROADCAST_SIZE, 0,
-		(struct sockaddr *)&raddr, &fromlen);
+		(struct sockaddr *)&raddr, (socklen_t *)&fromlen);
 	if (inlen < 0) {
 		if (errno == EINTR)
 			goto try_again;
@@ -447,7 +448,7 @@ try_again:
 		/* otherwise, just random garbage */
 	}
 	xdrs->x_op = XDR_FREE;
-	msg.acpted_rply.ar_results.proc = xdr_void;
+	msg.acpted_rply.ar_results.proc = (xdrproc_t)xdr_void;
 	(void)xdr_replymsg(xdrs, &msg);
 	(void)(*xresults)(xdrs, resultsp);
 	xdr_destroy(xdrs);
tools/tcpd.c +1 -1
index 8ab8877..b81945b 100644
@@ -55,7 +55,7 @@ main(argc, argv)
 	while(1) {
 		fprintf(stderr, "%s awaiting accept\n", argv[0]);
 		addrlen = sizeof(struct sockaddr_in);
-		if ((ns = accept(s, (struct sockaddr *)&addr, &addrlen)) < 0)
+		if ((ns = accept(s, (struct sockaddr *)&addr, (socklen_t *)&addrlen)) < 0)
 			xxit("accept");
 #ifdef __STDC__
 		if (hp = gethostbyaddr((const char *)&addr.sin_addr,
tools/udp.c +1 -1
index 70dc495..cc83646 100644
@@ -62,7 +62,7 @@ main(argc, argv)
 
 	ret = sendto(s, buf, len, 0, (struct sockaddr *)&addr, addrlen);
 	fprintf(stderr, " sendto ret %d (len %d)\n", ret, len);
-	ret = recvfrom(s, buf, BUFSIZ, 0, (struct sockaddr *)&addr, &addrlen);
+	ret = recvfrom(s, buf, BUFSIZ, 0, (struct sockaddr *)&addr, (socklen_t *)&addrlen);
 	fprintf(stderr, " recvfrom ret %d\n", ret);
 
 	if (ret != len || *buf != *msg + 1 || strcmp(buf+1, msg+1))
tools/udpd.c +1 -1
index 17fdec5..7f6c592 100644
@@ -52,7 +52,7 @@ main(argc, argv)
 		fprintf(stderr, "%s awaiting request\n", argv[0]);
 		addrlen = sizeof(struct sockaddr_in);
 		ret = recvfrom(s, buf, BUFSIZ, 0, (struct sockaddr *)&addr,
-			       &addrlen);
+			       (socklen_t *)&addrlen);
 		if (ret < 0)
 			xxit("recvfrom");
 #ifdef __STDC__
Signature · 1 line
1.7.5.4
#1 lore raw

Hi.

For some of these new casts, wouldn't be it better to simply declare the variable to be the correct type to start with instead of casting some other type? For example, the socklen_t variables?

It seems funny that all of those XDR routines need to be casted as well.

	Thanx...

		ps

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Tom Haynes
Sent: Tuesday, June 28, 2011 6:22 PM
To: Steve Dickson
Cc: [email protected]; Tom Haynes
Subject: [PATCH 1/1] Remove warnings on various platforms

---
 basic/subr.c       |    5 ++++-
 basic/test1.c      |    1 +
 basic/test2.c      |    1 +
 basic/test3.c      |    1 +
 basic/test4.c      |    1 +
 basic/test4a.c     |    1 +
 basic/test5.c      |    1 +
 basic/test5a.c     |    1 +
 basic/test5b.c     |    1 +
 basic/test6.c      |    1 +
 basic/test7.c      |    1 +
 basic/test7a.c     |    1 +
 basic/test7b.c     |    1 +
 basic/test8.c      |    1 +
 basic/test9.c      |    1 +
 domount.c          |    3 +++
 general/large.c    |    1 +
 general/stat.c     |    1 +
 getopt.c           |    3 +++
 special/dupreq.c   |    1 +
 special/negseek.c  |    1 +
 special/nfsidem.c  |    1 +
 special/nstat.c    |    1 +
 special/rename.c   |    1 +
 special/rewind.c   |    6 +++++-
 special/stat.c     |    1 +
 special/touchn.c   |    6 ++++--
 special/truncate.c |    6 +++++-
 tools/dirdmp.c     |    1 +
 tools/dirprt.c     |    1 +
 tools/pmapbrd.c    |   15 ++++++++-------
 tools/tcpd.c       |    2 +-
 tools/udp.c        |    2 +-
 tools/udpd.c       |    2 +-
 34 files changed, 59 insertions(+), 15 deletions(-)
basic/subr.c +4 -1
index cf220b7..dafff4f 100644
@@ -19,17 +19,20 @@
 #endif
 
 #include <sys/types.h>
-#include <sys/timeb.h>
 
 #ifdef DOSorWIN32
+#include <sys/timeb.h>
 #include <time.h>
 #else
 #include <sys/time.h>
 #endif
+
 #include <sys/stat.h>
+#include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+
 #ifdef STDARG
 #include <stdarg.h>
 #endif
basic/test1.c +1 -0
index 6b15c34..18514ea 100644
@@ -50,6 +50,7 @@ usage()
 	fprintf(stdout, "          n    Suppress test directory create operations\n");
 }
 
+int
 main(argc, argv)
 	int argc;
 	char *argv[];
basic/test2.c +1 -0
index cdb52eb..f6f9e2f 100644
@@ -48,6 +48,7 @@ usage()
 	fprintf(stdout, "          n    Suppress test directory create operations\n");
 }
 
+int
 main(argc, argv)
 	int argc;
 	char *argv[];
basic/test3.c +1 -0
index c53fff8..7b31da8 100644
@@ -48,6 +48,7 @@ usage()
 	fprintf(stdout, "          n    Suppress test directory create operations\n");
 }
 
+int
 main(argc, argv)
 	int argc;
 	char *argv[];
basic/test4.c +1 -0
index f72e956..416c0a6 100644
@@ -52,6 +52,7 @@ usage()
 		"          n    Suppress test directory create operations\n");
 }
 
+int
 main(argc, argv)
 	int argc;
 	char *argv[];
basic/test4a.c +1 -0
index 336ed74..1706b1a 100644
@@ -52,6 +52,7 @@ usage()
 		"          n    Suppress test directory create operations\n");
 }
 
+int
 main(argc, argv)
 	int argc;
 	char *argv[];
basic/test5.c +1 -0
index f9463ae..6ba9e87 100644
@@ -80,6 +80,7 @@ usage()
 #endif
 }
 
+int
 main(argc, argv)
 	int argc;
 	char *argv[];
basic/test5a.c +1 -0
index 716d917..bb4cbd5 100644
@@ -79,6 +79,7 @@ usage()
 #endif
 }
 
+int
 main(argc, argv)
 	int argc;
 	char *argv[];
basic/test5b.c +1 -0
index 7062680..4d8d2c7 100644
@@ -60,6 +60,7 @@ usage()
 	fprintf(stdout, "          n    Suppress test directory create operations\n");
 }
 
+int
 main(argc, argv)
 	int argc;
 	char *argv[];
basic/test6.c +1 -0
index 1d64c88..96388f2 100644
@@ -65,6 +65,7 @@ usage()
 	fprintf(stdout, "          i    Ignore non-test files dir entries\n");
 }
 
+int
 main(argc, argv)
 	int argc;
 	char *argv[];
basic/test7.c +1 -0
index f7b3e2e..d19685f 100644
@@ -53,6 +53,7 @@ usage()
 	fprintf(stdout, "          n    Suppress test directory create operations\n");
 }
 
+int
 main(argc, argv)
 	int argc;
 	char *argv[];
basic/test7a.c +1 -0
index 1e4170c..bc8f363 100644
@@ -51,6 +51,7 @@ usage()
 	fprintf(stdout, "          n    Suppress test directory create operations\n");
 }
 
+int
 main(argc, argv)
 	int argc;
 	char *argv[];
basic/test7b.c +1 -0
index 2f5b119..925b1fc 100644
@@ -53,6 +53,7 @@ usage()
 	fprintf(stdout, "          n    Suppress test directory create operations\n");
 }
 
+int
 main(argc, argv)
 	int argc;
 	char *argv[];
basic/test8.c +1 -0
index ea9aa0c..d65eb3a 100644
@@ -55,6 +55,7 @@ usage()
 	fprintf(stdout, "          n    Suppress test directory create operations\n");
 }
 
+int
 main(argc, argv)
 	int argc;
 	char *argv[];
basic/test9.c +1 -0
index ef68fc2..f376109 100644
@@ -65,6 +65,7 @@ usage()
 	fprintf(stdout, "          n    Suppress test directory create operations\n");
 }
 
+int
 main(argc, argv)
 	int argc;
 	char *argv[];
domount.c +3 -0
index 8982684..5b2fb80 100644
@@ -8,7 +8,10 @@
  */
 
 #include <stdio.h>
+#include <stdlib.h>
+#include <strings.h>
 
+int
 main(argc, argv)
 	int argc;
 	char **argv;
general/large.c +1 -0
index 5dd2950..b5bad18 100644
@@ -49,6 +49,7 @@ int	nc, nl, np, nxo, na;
 
 #define	cunlink(s)	if (s) unlink(s)
 
+int
 main(argc, argv)
 	char **argv;
 {
general/stat.c +1 -0
index b9128ae..67c58f5 100644
@@ -24,6 +24,7 @@ char	*Prog, *File;
 int	getattfmt();
 void	prtstat();
 
+int
 main(argc, argv)
 	int	argc;
 	char	*argv[];
getopt.c +3 -0
index da64713..ae1eb11 100644
@@ -36,6 +36,7 @@
 	(void) write(2, errbuf, 2);}
 
 #include <string.h>
+#include <stdlib.h>
 
 int	opterr = 1;
 int	optind = 1;
@@ -94,7 +95,9 @@ char	**argv, *opts;
 
 #include	<stdio.h>
 
+int
 main(ac, av)
+int	ac;
 char	**av;
 {
 	register int	i;
special/dupreq.c +1 -0
index 29174a6..8a896ee 100644
@@ -17,6 +17,7 @@
 #include <fcntl.h>
 #endif
 
+int
 main(argc, argv)
 	int argc;
 	char *argv[];
special/negseek.c +1 -0
index c974070..00d42d4 100644
@@ -21,6 +21,7 @@
 #endif
 #endif /* DOSorWIN32 */
 
+int
 main(argc, argv)
 	int argc;
 	char *argv[];
special/nfsidem.c +1 -0
index ac95c39..5bae363 100644
@@ -53,6 +53,7 @@ static char TBAR[MAXPATHLEN];
 static char LBAR[MAXPATHLEN];
 static char str[STRCHARS];
 
+int
 main(ac,av)
 	int ac;
 	char *av[];
special/nstat.c +1 -0
index 87c1def..fdbd3f9 100644
@@ -26,6 +26,7 @@
 
 static int stats = 0;
 
+int
 main(argc, argv)
 	int argc;
 	char *argv[];
special/rename.c +1 -0
index 8abbc60..a16d7be 100644
@@ -21,6 +21,7 @@
 #endif
 #endif /* DOSorWIN32 */
 
+int
 main(argc, argv)
 	int argc;
 	char *argv[];
special/rewind.c +5 -1
index b5400d3..32003ea 100644
@@ -14,7 +14,11 @@
 #include <unistd.h>
 #endif /* DOSorWIN32 */
 
-main()
+/*ARGSUSED*/    
+int
+main(argc, argv)
+	int argc;
+	char *argv[];
 {
 	char buffer[8192];
 	int size = 8192;
special/stat.c +1 -0
index 941eec1..c87f422 100644
@@ -34,6 +34,7 @@ static int stats = 0;
 
 static void statit ARGS_((char *));
 
+int
 main(argc, argv)
 	int argc;
 	char *argv[];
special/touchn.c +4 -2
index 3038eba..fdbfe14 100644
@@ -18,8 +18,10 @@
 
 #include "../tests.h"
 
-main(argc,argv)
-char **argv;
+int
+main(argc, argv)
+	int argc;
+	char **argv;
 {
 	int n;
 	char buf[1024];
special/truncate.c +5 -1
index 4c4f076..50b65ad 100644
@@ -18,7 +18,11 @@
 #include <unistd.h>
 #endif /* DOSorWIN32 */
 
-main()
+/*ARGSUSED*/    
+int
+main(argc, argv)
+	int argc;
+	char *argv[];
 {
 	int fd;
 	struct stat statb;
tools/dirdmp.c +1 -0
index 76ac2c3..9b87e11 100644
@@ -31,6 +31,7 @@ static DIR * my_opendir ARGS_((char *name));
 static void print ARGS_((char *));
 static struct dirent *my_readdir ARGS_((DIR *dirp));
 
+int
 main(argc, argv)
 	int argc;
 	char *argv[];
tools/dirprt.c +1 -0
index a8b50ea..9d5fb98 100644
@@ -34,6 +34,7 @@
 static DIR *my_opendir ARGS_((char *));
 static void print ARGS_((char *));
 
+int
 main(argc, argv)
 	int argc;
 	char *argv[];
tools/pmapbrd.c +8 -7
index 2bb05b6..71aadd8 100644
@@ -174,8 +174,9 @@ main(argc, argv)
 		 * XXX shouldn't have to cast eachresult?
 		 */
 		clnt_stat =
-		    clnt_broadcast_time(sock, RPROG, RVERS, RPROC_NUM, xdr_void, &a,
-		    xdr_void, &b, (resultproc_t)eachresult, &t);
+		    clnt_broadcast_time(sock, RPROG, RVERS, RPROC_NUM,
+		    (xdrproc_t)xdr_void, &a, (xdrproc_t)xdr_void, &b,
+		    (resultproc_t)eachresult, &t);
 		if(clnt_stat != RPC_TIMEDOUT) {
 			printf("error: clnt_stat = %d\n", clnt_stat);
 			clnt_perrno(clnt_stat);
@@ -243,9 +244,9 @@ xdr_rmtcallres(xdrs, crp)
 {
 
 #ifdef SVR3
-	if (xdr_reference(xdrs, (caddr_t *)&crp->port_ptr, sizeof (ulong), xdr_u_long) &&
+	if (xdr_reference(xdrs, (caddr_t *)&crp->port_ptr, sizeof (ulong), (xdrproc_t)xdr_u_long) &&
 #else
-	if (xdr_reference(xdrs, (caddr_t *)&crp->port_ptr, sizeof (u_long), xdr_u_long) &&
+	if (xdr_reference(xdrs, (caddr_t *)&crp->port_ptr, sizeof (u_long), (xdrproc_t)xdr_u_long) &&
 #endif
 		xdr_u_long(xdrs, &crp->resultslen))
 		return ((*(crp->xdr_results))(xdrs, crp->results_ptr));
@@ -387,7 +388,7 @@ clnt_broadcast_time(sock, prog, vers, proc, xargs, argsp, xresults,
 recv_again:
 	msg.acpted_rply.ar_verf = _null_auth;
 	msg.acpted_rply.ar_results.where = (caddr_t)&r;
-	msg.acpted_rply.ar_results.proc = xdr_rmtcallres;
+	msg.acpted_rply.ar_results.proc = (xdrproc_t)xdr_rmtcallres;
 	readfds = mask;
 	switch (select(32, (fd_set *)&readfds, (fd_set *)NULL, (fd_set *)NULL,
 			t)) {
@@ -409,7 +410,7 @@ recv_again:
 try_again:
 	fromlen = sizeof(struct sockaddr);
 	inlen = recvfrom(sock, inbuf, MAX_BROADCAST_SIZE, 0,
-		(struct sockaddr *)&raddr, &fromlen);
+		(struct sockaddr *)&raddr, (socklen_t *)&fromlen);
 	if (inlen < 0) {
 		if (errno == EINTR)
 			goto try_again;
@@ -447,7 +448,7 @@ try_again:
 		/* otherwise, just random garbage */
 	}
 	xdrs->x_op = XDR_FREE;
-	msg.acpted_rply.ar_results.proc = xdr_void;
+	msg.acpted_rply.ar_results.proc = (xdrproc_t)xdr_void;
 	(void)xdr_replymsg(xdrs, &msg);
 	(void)(*xresults)(xdrs, resultsp);
 	xdr_destroy(xdrs);
tools/tcpd.c +1 -1
index 8ab8877..b81945b 100644
@@ -55,7 +55,7 @@ main(argc, argv)
 	while(1) {
 		fprintf(stderr, "%s awaiting accept\n", argv[0]);
 		addrlen = sizeof(struct sockaddr_in);
-		if ((ns = accept(s, (struct sockaddr *)&addr, &addrlen)) < 0)
+		if ((ns = accept(s, (struct sockaddr *)&addr, (socklen_t *)&addrlen)) < 0)
 			xxit("accept");
 #ifdef __STDC__
 		if (hp = gethostbyaddr((const char *)&addr.sin_addr,
tools/udp.c +1 -1
index 70dc495..cc83646 100644
@@ -62,7 +62,7 @@ main(argc, argv)
 
 	ret = sendto(s, buf, len, 0, (struct sockaddr *)&addr, addrlen);
 	fprintf(stderr, " sendto ret %d (len %d)\n", ret, len);
-	ret = recvfrom(s, buf, BUFSIZ, 0, (struct sockaddr *)&addr, &addrlen);
+	ret = recvfrom(s, buf, BUFSIZ, 0, (struct sockaddr *)&addr, (socklen_t *)&addrlen);
 	fprintf(stderr, " recvfrom ret %d\n", ret);
 
 	if (ret != len || *buf != *msg + 1 || strcmp(buf+1, msg+1))
tools/udpd.c +1 -1
index 17fdec5..7f6c592 100644
@@ -52,7 +52,7 @@ main(argc, argv)
 		fprintf(stderr, "%s awaiting request\n", argv[0]);
 		addrlen = sizeof(struct sockaddr_in);
 		ret = recvfrom(s, buf, BUFSIZ, 0, (struct sockaddr *)&addr,
-			       &addrlen);
+			       (socklen_t *)&addrlen);
 		if (ret < 0)
 			xxit("recvfrom");
 #ifdef __STDC__
Signature · 6 lines
1.7.5.4

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author
#2 lore raw
Quoted 9 lines · On Wed, Jun 29, 2011 at 07:53:19AM -0400, [email protected] wrote:

Hi.

For some of these new casts, wouldn't be it better to simply declare the variable to be the correct type to start with instead of casting some other type? For example, the socklen_t variables?

It seems funny that all of those XDR routines need to be casted as well.

	Thanx...

		ps

I tried to go with the most innocent changes I could. My main concern is lack of access to different platforms to do sanity compiles and unit testing.

Signature · 2 lines
Tom Haynes
ex-cfb
#3 lore raw

Hmmm. Yes, make sense.

That said, I think that it would be better to attempt to do it the right way and then let people tell us when it isn't quite right yet. We should eventually be able to come to a set of changes which are right, for everyone.

Compiling on Linux, Solaris, and FreeBSD should be a good start. Perhaps Olga or someone else could help with the Windows compiles. I suspect that we could find someone with access to AIX or HP/UX or ... :-)

Perhaps we could also consider cleaning up tests.init? The lists of commented out options seems quite unwieldly to me. Do we really need all of that stuff, especially for the much older systems?

	Thanx...

		ps

-----Original Message-----
From: Tom Haynes [mailto:[email protected]]
Sent: Wednesday, June 29, 2011 1:29 PM
To: Staubach, Peter
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/1] Remove warnings on various platforms

Quoted 9 lines · On Wed, Jun 29, 2011 at 07:53:19AM -0400, [email protected] wrote:

Hi.

For some of these new casts, wouldn't be it better to simply declare the variable to be the correct type to start with instead of casting some other type? For example, the socklen_t variables?

It seems funny that all of those XDR routines need to be casted as well.

	Thanx...

		ps

I tried to go with the most innocent changes I could. My main concern is lack of access to different platforms to do sanity compiles and unit testing.

Signature · 2 lines
Tom Haynes
ex-cfb
author
#4 lore raw
Quoted 3 lines · On Wed, Jun 29, 2011 at 02:16:24PM -0400, [email protected] wrote:

Hmmm. Yes, make sense.

That said, I think that it would be better to attempt to do it the right way and then let people tell us when it isn't quite right yet. We should eventually be able to come to a set of changes which are right, for everyone.

Okay, I'll do that and resubmit.

Quoted 4 lines

Compiling on Linux, Solaris, and FreeBSD should be a good start. Perhaps Olga or someone else could help with the Windows compiles. I suspect that we could find someone with access to AIX or HP/UX or ... :-)

Perhaps we could also consider cleaning up tests.init? The lists of commented out options seems quite unwieldly to me. Do we really need all of that stuff, especially for the much older systems?

Yeah, I've been wondering if modern tools like autoconfig would work here.

Quoted 32 lines
	Thanx...

		ps

-----Original Message-----
From: Tom Haynes [mailto:[email protected]]
Sent: Wednesday, June 29, 2011 1:29 PM
To: Staubach, Peter
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/1] Remove warnings on various platforms

Quoted 9 lines · On Wed, Jun 29, 2011 at 07:53:19AM -0400, [email protected] wrote:

Hi.

For some of these new casts, wouldn't be it better to simply declare the variable to be the correct type to start with instead of casting some other type? For example, the socklen_t variables?

It seems funny that all of those XDR routines need to be casted as well.

	Thanx...

		ps

I tried to go with the most innocent changes I could. My main concern is lack of access to different platforms to do sanity compiles and unit testing.

Signature · 2 lines
Tom Haynes
ex-cfb
Signature · 2 lines
Tom Haynes
ex-cfb
#5 lore raw

Tom Haynes wrote:

Quoted 1 line · On Wed, Jun 29, 2011 at 02:16:24PM -0400, [email protected] wrote:

Perhaps we could also consider cleaning up tests.init? The lists of

commented out options seems quite unwieldly to me. Do we really need all of that stuff, especially for the much older systems?

Yeah, I've been wondering if modern tools like autoconfig would work here.

I don't know that we need full-blown autoconf, which has portability problems of its own. Maybe a shell script or makefile that figures out (or asks) what you're running on and tweaks tests.init for you.