Browse Source

Alexandre Oliva writes:

While testing the FR-V code with GCC mainline, I ran into some
problems in the RPC code.  It relies on a GCC extension that is no
longer available, namely, the result of a cast is no longer considered
an lvalue.

This patch enables the code to compile.  I haven't been able to test
RPC though, especially in a multi-threaded environment.
Eric Andersen 20 years ago
parent
commit
377c7157a8

+ 2 - 2
include/rpc/xdr.h

@@ -274,9 +274,9 @@ struct xdr_discrim
  * in the RPC code will not work on 64bit Solaris platforms !
  */
 #define IXDR_GET_LONG(buf) \
-	((long)ntohl((u_long)*__extension__((u_int32_t*)(buf))++))
+	((long)ntohl((u_long)*(*(u_int32_t**)&(buf))++))
 #define IXDR_PUT_LONG(buf, v) \
-	(*__extension__((u_int32_t*)(buf))++ = (long)htonl((u_long)(v)))
+	(*(*(u_int32_t**)&(buf))++ = (long)htonl((u_long)(v)))
 #define IXDR_GET_U_LONG(buf)	      ((u_long)IXDR_GET_LONG(buf))
 #define IXDR_PUT_U_LONG(buf, v)	      IXDR_PUT_LONG(buf, (long)(v))
 

+ 2 - 2
libc/inet/rpc/auth_none.c

@@ -64,7 +64,7 @@ struct authnone_private_s {
   u_int mcnt;
 };
 #ifdef __UCLIBC_HAS_THREADS__
-#define authnone_private ((struct authnone_private_s *)RPC_THREAD_VARIABLE(authnone_private_s))
+#define authnone_private (*(struct authnone_private_s **)&RPC_THREAD_VARIABLE(authnone_private_s))
 #else
 static struct authnone_private_s *authnone_private;
 #endif
@@ -105,7 +105,7 @@ authnone_marshal (AUTH *client, XDR *xdrs)
 {
   struct authnone_private_s *ap;
 
-  ap = (struct authnone_private_s *) authnone_private;
+  ap = authnone_private;
   if (ap == NULL)
     return FALSE;
   return (*xdrs->x_ops->x_putbytes) (xdrs, ap->marshalled_client, ap->mcnt);

+ 1 - 1
libc/inet/rpc/clnt_perror.c

@@ -58,7 +58,7 @@ static char *auth_errmsg (enum auth_stat stat) internal_function;
  * buf variable in a few functions.  Overriding a global variable
  * with a local variable of the same name is a bad idea, anyway.
  */
-#define buf ((char *)RPC_THREAD_VARIABLE(clnt_perr_buf_s))
+#define buf (*(char **)&RPC_THREAD_VARIABLE(clnt_perr_buf_s))
 #else
 static char *buf;
 #endif

+ 1 - 1
libc/inet/rpc/clnt_raw.c

@@ -62,7 +62,7 @@ struct clntraw_private_s
     u_int mcnt;
   };
 #ifdef __UCLIBC_HAS_THREADS__
-#define clntraw_private ((struct clntraw_private_s *)RPC_THREAD_VARIABLE(clntraw_private_s))
+#define clntraw_private (*(struct clntraw_private_s **)&RPC_THREAD_VARIABLE(clntraw_private_s))
 #else
 static struct clntraw_private_s *clntraw_private;
 #endif

+ 1 - 1
libc/inet/rpc/clnt_simple.c

@@ -58,7 +58,7 @@ struct callrpc_private_s
     char *oldhost;
   };
 #ifdef __UCLIBC_HAS_THREADS__
-#define callrpc_private ((struct callrpc_private_s *)RPC_THREAD_VARIABLE(callrpc_private_s))
+#define callrpc_private (*(struct callrpc_private_s **)&RPC_THREAD_VARIABLE(callrpc_private_s))
 #else
 static struct callrpc_private_s *callrpc_private;
 #endif

+ 2 - 2
libc/inet/rpc/svc.c

@@ -48,7 +48,7 @@
 #include <sys/poll.h>
 
 #ifdef __UCLIBC_HAS_THREADS__
-#define xports ((SVCXPRT **)RPC_THREAD_VARIABLE(svc_xports_s))
+#define xports (*(SVCXPRT ***)&RPC_THREAD_VARIABLE(svc_xports_s))
 #else
 static SVCXPRT **xports;
 #endif
@@ -67,7 +67,7 @@ struct svc_callout {
   void (*sc_dispatch) (struct svc_req *, SVCXPRT *);
 };
 #ifdef __UCLIBC_HAS_THREADS__
-#define svc_head ((struct svc_callout *)RPC_THREAD_VARIABLE(svc_head_s))
+#define svc_head (*(struct svc_callout **)&RPC_THREAD_VARIABLE(svc_head_s))
 #else
 static struct svc_callout *svc_head;
 #endif

+ 1 - 1
libc/inet/rpc/svc_raw.c

@@ -56,7 +56,7 @@ struct svcraw_private_s
     char verf_body[MAX_AUTH_BYTES];
   };
 #ifdef __UCLIBC_HAS_THREADS__
-#define svcraw_private ((struct svcraw_private_s *)RPC_THREAD_VARIABLE(svcraw_private_s))
+#define svcraw_private (*(struct svcraw_private_s **)&RPC_THREAD_VARIABLE(svcraw_private_s))
 #else
 static struct svcraw_private_s *svcraw_private;
 #endif

+ 2 - 2
libc/inet/rpc/svc_simple.c

@@ -64,7 +64,7 @@ struct proglst_
     struct proglst_ *p_nxt;
   };
 #ifdef __UCLIBC_HAS_THREADS__
-#define proglst ((struct proglst_ *)RPC_THREAD_VARIABLE(svcsimple_proglst_s))
+#define proglst (*(struct proglst_ **)&RPC_THREAD_VARIABLE(svcsimple_proglst_s))
 #else
 static struct proglst_ *proglst;
 #endif
@@ -72,7 +72,7 @@ static struct proglst_ *proglst;
 
 static void universal (struct svc_req *rqstp, SVCXPRT *transp_s);
 #ifdef __UCLIBC_HAS_THREADS__
-#define transp ((SVCXPRT *)RPC_THREAD_VARIABLE(svcsimple_transp_s))
+#define transp (*(SVCXPRT **)&RPC_THREAD_VARIABLE(svcsimple_transp_s))
 #else
 static SVCXPRT *transp;
 #endif