* Fix cast as lvalue in sunrpc
@ 2004-02-08 16:41 Andreas Schwab
2004-02-08 18:15 ` Ulrich Drepper
0 siblings, 1 reply; 5+ messages in thread
From: Andreas Schwab @ 2004-02-08 16:41 UTC (permalink / raw)
To: libc-hacker
This fixes the uses of casts as lvalue in the sunrpc code.
Andreas.
2004-02-08 Andreas Schwab <schwab@suse.de>
* include/rpc/rpc.h: Declare thread variables with their correct
type.
* sunrpc/clnt_perr.c: Don't cast thread variables.
* sunrpc/clnt_raw.c: Likewise.
* sunrpc/clnt_simp.c: Likewise.
* sunrpc/key_call.c: Likewise.
* sunrpc/svcauth_des.c: Likewise.
* sunrpc/svc.c: Likewise.
* sunrpc/svc_raw.c: Likewise.
* sunrpc/svc_simple.c: Likewise.
Index: include/rpc/rpc.h
===================================================================
RCS file: /cvs/glibc/libc/include/rpc/rpc.h,v
retrieving revision 1.8
diff -u -p -a -r1.8 rpc.h
--- include/rpc/rpc.h 5 Aug 2002 22:10:59 -0000 1.8
+++ include/rpc/rpc.h 8 Feb 2004 14:19:14 -0000
@@ -17,24 +17,24 @@ struct rpc_thread_variables {
struct pollfd *svc_pollfd_s; /* Global, rpc_common.c */
int svc_max_pollfd_s; /* Global, rpc_common.c */
- void *clnt_perr_buf_s; /* clnt_perr.c */
+ char *clnt_perr_buf_s; /* clnt_perr.c */
- void *clntraw_private_s; /* clnt_raw.c */
+ struct clntraw_private_s *clntraw_private_s; /* clnt_raw.c */
- void *callrpc_private_s; /* clnt_simp.c */
+ struct callrpc_private_s *callrpc_private_s; /* clnt_simp.c */
- void *key_call_private_s; /* key_call.c */
+ struct key_call_private *key_call_private_s; /* key_call.c */
- void *authdes_cache_s; /* svcauth_des.c */
- void *authdes_lru_s; /* svcauth_des.c */
+ struct cache_entry *authdes_cache_s; /* svcauth_des.c */
+ int *authdes_lru_s; /* svcauth_des.c */
- void *svc_xports_s; /* svc.c */
- void *svc_head_s; /* svc.c */
+ SVCXPRT **svc_xports_s; /* svc.c */
+ struct svc_callout *svc_head_s; /* svc.c */
- void *svcraw_private_s; /* svc_raw.c */
+ struct svcraw_private_s *svcraw_private_s; /* svc_raw.c */
- void *svcsimple_proglst_s; /* svc_simple.c */
- void *svcsimple_transp_s; /* svc_simple.c */
+ struct proglst_ *svcsimple_proglst_s; /* svc_simple.c */
+ SVCXPRT *svcsimple_transp_s; /* svc_simple.c */
};
extern struct rpc_thread_variables *__rpc_thread_variables(void)
Index: sunrpc/clnt_perr.c
===================================================================
RCS file: /cvs/glibc/libc/sunrpc/clnt_perr.c,v
retrieving revision 1.19
diff -u -p -a -r1.19 clnt_perr.c
--- sunrpc/clnt_perr.c 1 Nov 2002 20:43:54 -0000 1.19
+++ sunrpc/clnt_perr.c 8 Feb 2004 14:19:14 -0000
@@ -55,7 +55,7 @@ static char *auth_errmsg (enum auth_stat
* 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 RPC_THREAD_VARIABLE(clnt_perr_buf_s)
#else
static char *buf;
#endif
Index: sunrpc/clnt_raw.c
===================================================================
RCS file: /cvs/glibc/libc/sunrpc/clnt_raw.c,v
retrieving revision 1.10
diff -u -p -a -r1.10 clnt_raw.c
--- sunrpc/clnt_raw.c 15 May 2002 00:21:00 -0000 1.10
+++ sunrpc/clnt_raw.c 8 Feb 2004 14:19:14 -0000
@@ -61,7 +61,7 @@ struct clntraw_private_s
u_int mcnt;
};
#ifdef _RPC_THREAD_SAFE_
-#define clntraw_private ((struct clntraw_private_s *)RPC_THREAD_VARIABLE(clntraw_private_s))
+#define clntraw_private RPC_THREAD_VARIABLE(clntraw_private_s)
#else
static struct clntraw_private_s *clntraw_private;
#endif
Index: sunrpc/clnt_simp.c
===================================================================
RCS file: /cvs/glibc/libc/sunrpc/clnt_simp.c,v
retrieving revision 1.14
diff -u -p -a -r1.14 clnt_simp.c
--- sunrpc/clnt_simp.c 15 May 2002 00:21:00 -0000 1.14
+++ sunrpc/clnt_simp.c 8 Feb 2004 14:19:14 -0000
@@ -55,7 +55,7 @@ struct callrpc_private_s
char *oldhost;
};
#ifdef _RPC_THREAD_SAFE_
-#define callrpc_private ((struct callrpc_private_s *)RPC_THREAD_VARIABLE(callrpc_private_s))
+#define callrpc_private RPC_THREAD_VARIABLE(callrpc_private_s)
#else
static struct callrpc_private_s *callrpc_private;
#endif
Index: sunrpc/key_call.c
===================================================================
RCS file: /cvs/glibc/libc/sunrpc/key_call.c,v
retrieving revision 1.16
diff -u -p -a -r1.16 key_call.c
--- sunrpc/key_call.c 6 Aug 2002 06:08:50 -0000 1.16
+++ sunrpc/key_call.c 8 Feb 2004 14:19:14 -0000
@@ -370,7 +370,7 @@ struct key_call_private {
uid_t uid; /* user-id at last authorization */
};
#ifdef _RPC_THREAD_SAFE_
-#define key_call_private_main ((struct key_call_private *)RPC_THREAD_VARIABLE(key_call_private_s))
+#define key_call_private_main RPC_THREAD_VARIABLE(key_call_private_s)
#else
static struct key_call_private *key_call_private_main;
#endif
Index: sunrpc/svc.c
===================================================================
RCS file: /cvs/glibc/libc/sunrpc/svc.c,v
retrieving revision 1.17
diff -u -p -a -r1.17 svc.c
--- sunrpc/svc.c 29 Aug 2003 07:45:18 -0000 1.17
+++ sunrpc/svc.c 8 Feb 2004 14:19:14 -0000
@@ -44,7 +44,7 @@
#include <sys/poll.h>
#ifdef _RPC_THREAD_SAFE_
-#define xports ((SVCXPRT **)RPC_THREAD_VARIABLE(svc_xports_s))
+#define xports RPC_THREAD_VARIABLE(svc_xports_s)
#else
static SVCXPRT **xports;
#endif
@@ -63,7 +63,7 @@ struct svc_callout {
void (*sc_dispatch) (struct svc_req *, SVCXPRT *);
};
#ifdef _RPC_THREAD_SAFE_
-#define svc_head ((struct svc_callout *)RPC_THREAD_VARIABLE(svc_head_s))
+#define svc_head RPC_THREAD_VARIABLE(svc_head_s)
#else
static struct svc_callout *svc_head;
#endif
Index: sunrpc/svc_raw.c
===================================================================
RCS file: /cvs/glibc/libc/sunrpc/svc_raw.c,v
retrieving revision 1.5
diff -u -p -a -r1.5 svc_raw.c
--- sunrpc/svc_raw.c 26 Feb 2002 01:43:56 -0000 1.5
+++ sunrpc/svc_raw.c 8 Feb 2004 14:19:14 -0000
@@ -54,7 +54,7 @@ struct svcraw_private_s
char verf_body[MAX_AUTH_BYTES];
};
#ifdef _RPC_THREAD_SAFE_
-#define svcraw_private ((struct svcraw_private_s *)RPC_THREAD_VARIABLE(svcraw_private_s))
+#define svcraw_private RPC_THREAD_VARIABLE(svcraw_private_s)
#else
static struct svcraw_private_s *svcraw_private;
#endif
Index: sunrpc/svc_simple.c
===================================================================
RCS file: /cvs/glibc/libc/sunrpc/svc_simple.c,v
retrieving revision 1.16
diff -u -p -a -r1.16 svc_simple.c
--- sunrpc/svc_simple.c 6 Aug 2002 05:10:30 -0000 1.16
+++ sunrpc/svc_simple.c 8 Feb 2004 14:19:14 -0000
@@ -61,7 +61,7 @@ struct proglst_
struct proglst_ *p_nxt;
};
#ifdef _RPC_THREAD_SAFE_
-#define proglst ((struct proglst_ *)RPC_THREAD_VARIABLE(svcsimple_proglst_s))
+#define proglst RPC_THREAD_VARIABLE(svcsimple_proglst_s)
#else
static struct proglst_ *proglst;
#endif
@@ -69,7 +69,7 @@ static struct proglst_ *proglst;
static void universal (struct svc_req *rqstp, SVCXPRT *transp_s);
#ifdef _RPC_THREAD_SAFE_
-#define transp ((SVCXPRT *)RPC_THREAD_VARIABLE(svcsimple_transp_s))
+#define transp RPC_THREAD_VARIABLE(svcsimple_transp_s)
#else
static SVCXPRT *transp;
#endif
Index: sunrpc/svcauth_des.c
===================================================================
RCS file: /cvs/glibc/libc/sunrpc/svcauth_des.c,v
retrieving revision 1.8
diff -u -p -a -r1.8 svcauth_des.c
--- sunrpc/svcauth_des.c 20 Aug 2001 06:37:09 -0000 1.8
+++ sunrpc/svcauth_des.c 8 Feb 2004 14:19:14 -0000
@@ -72,8 +72,8 @@ struct cache_entry
char *localcred; /* generic local credential */
};
#ifdef _RPC_THREAD_SAFE_
-#define authdes_cache ((struct cache_entry *)RPC_THREAD_VARIABLE(authdes_cache_s))
-#define authdes_lru ((int *)RPC_THREAD_VARIABLE(authdes_lru_s))
+#define authdes_cache RPC_THREAD_VARIABLE(authdes_cache_s)
+#define authdes_lru RPC_THREAD_VARIABLE(authdes_lru_s)
#else
static struct cache_entry *authdes_cache;
static int *authdes_lru;
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, MaxfeldstraÃe 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Fix cast as lvalue in sunrpc
2004-02-08 16:41 Fix cast as lvalue in sunrpc Andreas Schwab
@ 2004-02-08 18:15 ` Ulrich Drepper
2004-02-08 18:26 ` Andreas Jaeger
2004-02-08 19:11 ` Andreas Schwab
0 siblings, 2 replies; 5+ messages in thread
From: Ulrich Drepper @ 2004-02-08 18:15 UTC (permalink / raw)
To: Andreas Schwab; +Cc: libc-hacker
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Andreas Schwab wrote:
> This fixes the uses of casts as lvalue in the sunrpc code.
Does this change the generated code?
- --
⧠Ulrich Drepper ⧠Red Hat, Inc. ⧠444 Castro St ⧠Mountain View, CA â
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
iD8DBQFAJnyn2ijCOnn/RHQRAh7jAJ9Gfxlg5VH7UjhKZxhIruv4LvEm+gCgunRu
I4IjvJ7hRpF61a+Gu+WPELI=
=csAe
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Fix cast as lvalue in sunrpc
2004-02-08 18:15 ` Ulrich Drepper
@ 2004-02-08 18:26 ` Andreas Jaeger
2004-02-08 18:55 ` Ulrich Drepper
2004-02-08 19:11 ` Andreas Schwab
1 sibling, 1 reply; 5+ messages in thread
From: Andreas Jaeger @ 2004-02-08 18:26 UTC (permalink / raw)
To: Ulrich Drepper; +Cc: Andreas Schwab, libc-hacker
[-- Attachment #1: Type: text/plain, Size: 1242 bytes --]
Ulrich Drepper <drepper@redhat.com> writes:
> Andreas Schwab wrote:
>> This fixes the uses of casts as lvalue in the sunrpc code.
>
> Does this change the generated code?
Not with gcc-3_3-hammer-branch on AMD64:
gromit:/builds/glibc/hammer:[130]$ ll sunrpc/clnt_perr.o
-rw-r--r-- 1 aj users 116248 Feb 8 19:25 sunrpc/clnt_perr.o
gromit:/builds/glibc/hammer:[0]$ ll sunrpc/clnt_perr.o /tmp/clnt_perr.o
-rw-r--r-- 1 aj users 116248 Feb 8 19:24 /tmp/clnt_perr.o
-rw-r--r-- 1 aj users 116248 Feb 8 19:25 sunrpc/clnt_perr.o
gromit:/builds/glibc/hammer:[0]$ objdump -d sunrpc/clnt_perr.o > /tmp/1
gromit:/builds/glibc/hammer:[0]$ objdump -d /tmp/clnt_perr.o > /tmp/2
gromit:/builds/glibc/hammer:[0]$ diff -u /tmp/1 /tmp/2
--- /tmp/1 2004-02-08 19:25:33.000000000 +0100
+++ /tmp/2 2004-02-08 19:25:40.000000000 +0100
@@ -1,5 +1,5 @@
-sunrpc/clnt_perr.o: file format elf64-x86-64
+/tmp/clnt_perr.o: file format elf64-x86-64
Disassembly of section .text:
Andreas
--
Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj
SuSE Linux AG, Maxfeldstr. 5, 90409 Nürnberg, Germany
GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126
[-- Attachment #2: Type: application/pgp-signature, Size: 188 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Fix cast as lvalue in sunrpc
2004-02-08 18:26 ` Andreas Jaeger
@ 2004-02-08 18:55 ` Ulrich Drepper
0 siblings, 0 replies; 5+ messages in thread
From: Ulrich Drepper @ 2004-02-08 18:55 UTC (permalink / raw)
To: Andreas Jaeger; +Cc: Andreas Schwab, libc-hacker
Andreas Jaeger wrote:
> Not with gcc-3_3-hammer-branch on AMD64:
OK.
--
⧠Ulrich Drepper ⧠Red Hat, Inc. ⧠444 Castro St ⧠Mountain View, CA â
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Fix cast as lvalue in sunrpc
2004-02-08 18:15 ` Ulrich Drepper
2004-02-08 18:26 ` Andreas Jaeger
@ 2004-02-08 19:11 ` Andreas Schwab
1 sibling, 0 replies; 5+ messages in thread
From: Andreas Schwab @ 2004-02-08 19:11 UTC (permalink / raw)
To: Ulrich Drepper; +Cc: libc-hacker
Ulrich Drepper <drepper@redhat.com> writes:
> Andreas Schwab wrote:
>> This fixes the uses of casts as lvalue in the sunrpc code.
>
> Does this change the generated code?
It can't, since all it does is to remove casts while preserving type
correctness.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, MaxfeldstraÃe 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2004-02-08 19:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-08 16:41 Fix cast as lvalue in sunrpc Andreas Schwab
2004-02-08 18:15 ` Ulrich Drepper
2004-02-08 18:26 ` Andreas Jaeger
2004-02-08 18:55 ` Ulrich Drepper
2004-02-08 19:11 ` Andreas Schwab
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).