summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog45
-rw-r--r--debug/vasprintf_chk.c6
-rw-r--r--debug/vsnprintf_chk.c6
-rw-r--r--debug/vsprintf_chk.c6
-rw-r--r--elf/dl-load.c3
-rw-r--r--elf/dl-profile.c53
-rw-r--r--inet/rcmd.c21
-rw-r--r--inet/rexec.c13
-rw-r--r--nscd/nscd_helper.c7
-rw-r--r--sunrpc/clnt_raw.c16
-rw-r--r--sysdeps/unix/sysv/linux/dl-osinfo.h2
-rw-r--r--sysdeps/x86_64/dl-machine.h2
12 files changed, 141 insertions, 39 deletions
diff --git a/ChangeLog b/ChangeLog
index 22c8a2cb5b..719e2cace6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,50 @@
 2009-04-26  Ulrich Drepper  <drepper@redhat.com>
 
+	* sysdeps/unix/sysv/linux/dl-osinfo.h (dl_fatal): Remove inline
+	from definition.
+
+	* sysdeps/x86_64/dl-machine.h (elf_machine_rela): Don't define
+	label if it is not used.
+
+	* elf/dl-profile.c (_dl_start_profile): Define real-type variant
+	of gmon_hist_hdr and gmon_hdr structures and use them.
+
+	* elf/dl-load.c (open_verify): Add temporary variable to avoid
+	warning.
+
+	* nscd/nscd_helper.c (get_mapping): Avoid casts to avoid warnings.
+
+	* sunrpc/clnt_raw.c (clntraw_private_s): Use union in definition
+	to avoid cast.
+
+	* inet/rexec.c (rexec_af): Make sa2 a union to avoid warnings.
+	* inet/rcmd.c (rcmd_af): Make from a union of the various needed types
+	to avoid warnings.
+	(iruserok_af): Use ss_family instead of casts.
+
+	* gmon/gmon.c (write_hist): Define real-type variant of
+	gmon_hist_hdr structure and use it.
+	(write_gmon): Likewise for gmon_hdr.
+
+	* sysdeps/unix/sysv/linux/readv.c: Avoid declaration of replacement
+	function if we are not going to define it.
+	* sysdeps/unix/sysv/linux/writev.c: Likewise.
+
+	* inet/inet6_option.c (optin_alloc): Add temporary variable to
+	avoid warning.
+
+	* libio/strfile.h (struct _IO_streambuf): Use correct type and
+	name of VTable element.
+	* libio/iovsprintf.c: Avoid casts to avoid warnings.
+	* libio/iovsscanf.c: Likewise.
+	* libio/vasprintf.c: Likewise.
+	* libio/vsnprintf.c: Likewise.
+	* stdio-common/isoc99_vsscanf.c: Likewise.
+	* stdlib/strfmon_l.c: Likewise.
+	* debug/vasprintf_chk.c: Likewise.
+	* debug/vsnprintf_chk.c: Likewise.
+	* debug/vsprintf_chk.c: Likewise.
+
 	* nss/nsswitch.c (__nss_lookup_function): En/Decrypt cached
 	function pointers.
 
diff --git a/debug/vasprintf_chk.c b/debug/vasprintf_chk.c
index 6105516d59..bdd3acf3bb 100644
--- a/debug/vasprintf_chk.c
+++ b/debug/vasprintf_chk.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995,1997,1999-2002,2004,2006,2008
+/* Copyright (C) 1995,1997,1999-2002,2004,2006,2008,2009
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -53,8 +53,8 @@ __vasprintf_chk (char **result_ptr, int flags, const char *format,
 #ifdef _IO_MTSAFE_IO
   sf._sbf._f._lock = NULL;
 #endif
-  _IO_no_init ((_IO_FILE *) &sf._sbf, _IO_USER_LOCK, -1, NULL, NULL);
-  _IO_JUMPS ((struct _IO_FILE_plus *) &sf._sbf) = &_IO_str_jumps;
+  _IO_no_init (&sf._sbf._f, _IO_USER_LOCK, -1, NULL, NULL);
+  _IO_JUMPS (&sf._sbf) = &_IO_str_jumps;
   _IO_str_init_static_internal (&sf, string, init_string_size, string);
   sf._sbf._f._flags &= ~_IO_USER_BUF;
   sf._s._allocate_buffer = (_IO_alloc_type) malloc;
diff --git a/debug/vsnprintf_chk.c b/debug/vsnprintf_chk.c
index c46937ff6f..8e3d99fa57 100644
--- a/debug/vsnprintf_chk.c
+++ b/debug/vsnprintf_chk.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995, 1997, 1998, 2004, 2006
+/* Copyright (C) 1991, 1995, 1997, 1998, 2004, 2006, 2009
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -53,7 +53,7 @@ ___vsnprintf_chk (char *s, size_t maxlen, int flags, size_t slen,
     }
 
   _IO_no_init (&sf.f._sbf._f, _IO_USER_LOCK, -1, NULL, NULL);
-  _IO_JUMPS ((struct _IO_FILE_plus *) &sf.f._sbf) = &_IO_strn_jumps;
+  _IO_JUMPS (&sf.f._sbf) = &_IO_strn_jumps;
   s[0] = '\0';
 
   /* For flags > 0 (i.e. __USE_FORTIFY_LEVEL > 1) request that %n
@@ -62,7 +62,7 @@ ___vsnprintf_chk (char *s, size_t maxlen, int flags, size_t slen,
     sf.f._sbf._f._flags2 |= _IO_FLAGS2_FORTIFY;
 
   _IO_str_init_static_internal (&sf.f, s, maxlen - 1, s);
-  ret = INTUSE(_IO_vfprintf) ((_IO_FILE *) &sf.f._sbf, format, args);
+  ret = INTUSE(_IO_vfprintf) (&sf.f._sbf._f, format, args);
 
   if (sf.f._sbf._f._IO_buf_base != sf.overflow_buf)
     *sf.f._sbf._f._IO_write_ptr = '\0';
diff --git a/debug/vsprintf_chk.c b/debug/vsprintf_chk.c
index 6538064dce..22cb2c7ad9 100644
--- a/debug/vsprintf_chk.c
+++ b/debug/vsprintf_chk.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1994, 1997, 1999-2003, 2004, 2006
+/* Copyright (C) 1994, 1997, 1999-2003, 2004, 2006, 2009
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -75,7 +75,7 @@ ___vsprintf_chk (char *s, int flags, size_t slen, const char *format,
     __chk_fail ();
 
   _IO_no_init (&f._sbf._f, _IO_USER_LOCK, -1, NULL, NULL);
-  _IO_JUMPS ((struct _IO_FILE_plus *) &f._sbf) = &_IO_str_chk_jumps;
+  _IO_JUMPS (&f._sbf) = &_IO_str_chk_jumps;
   s[0] = '\0';
   _IO_str_init_static_internal (&f, s, slen - 1, s);
 
@@ -84,7 +84,7 @@ ___vsprintf_chk (char *s, int flags, size_t slen, const char *format,
   if (flags > 0)
     f._sbf._f._flags2 |= _IO_FLAGS2_FORTIFY;
 
-  ret = INTUSE(_IO_vfprintf) ((_IO_FILE *) &f._sbf, format, args);
+  ret = INTUSE(_IO_vfprintf) (&f._sbf._f, format, args);
 
   *f._sbf._f._IO_write_ptr = '\0';
   return ret;
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 0052bc22d4..0b896d9b47 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -1655,7 +1655,8 @@ open_verify (const char *name, struct filebuf *fbp, struct link_map *loader,
 						EI_PAD), 0))
 	{
 	  /* Something is wrong.  */
-	  if (*(Elf32_Word *) &ehdr->e_ident !=
+	  const Elf32_Word *magp = (const void *) ehdr->e_ident;
+	  if (*magp !=
 #if BYTE_ORDER == LITTLE_ENDIAN
 	      ((ELFMAG0 << (EI_MAG0 * 8)) |
 	       (ELFMAG1 << (EI_MAG1 * 8)) |
diff --git a/elf/dl-profile.c b/elf/dl-profile.c
index 47033f32ef..d9250bcadd 100644
--- a/elf/dl-profile.c
+++ b/elf/dl-profile.c
@@ -1,5 +1,5 @@
 /* Profiling of shared libraries.
-   Copyright (C) 1997-2002, 2003, 2004, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1997-2004, 2006, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
    Based on the BSD mcount implementation.
@@ -178,8 +178,6 @@ _dl_start_profile (void)
   const ElfW(Phdr) *ph;
   ElfW(Addr) mapstart = ~((ElfW(Addr)) 0);
   ElfW(Addr) mapend = 0;
-  struct gmon_hdr gmon_hdr;
-  struct gmon_hist_hdr hist_hdr;
   char *hist, *cp;
   size_t idx;
   size_t tossize;
@@ -251,15 +249,52 @@ _dl_start_profile (void)
 		   + 4 + 4 + fromssize * sizeof (struct here_cg_arc_record));
 
   /* Create the gmon_hdr we expect or write.  */
-  memset (&gmon_hdr, '\0', sizeof (struct gmon_hdr));
+  struct real_gmon_hdr
+  {
+    char cookie[4];
+    int32_t version;
+    char spare[3 * 4];
+  } gmon_hdr;
+  if (sizeof (gmon_hdr) != sizeof (struct gmon_hdr)
+      || (offsetof (struct real_gmon_hdr, cookie)
+	  != offsetof (struct gmon_hdr, cookie))
+      || (offsetof (struct real_gmon_hdr, version)
+	  != offsetof (struct gmon_hdr, version)))
+    abort ();
+
   memcpy (&gmon_hdr.cookie[0], GMON_MAGIC, sizeof (gmon_hdr.cookie));
-  *(int32_t *) gmon_hdr.version = GMON_SHOBJ_VERSION;
+  gmon_hdr.version = GMON_SHOBJ_VERSION;
+  memset (gmon_hdr.spare, '\0', sizeof (gmon_hdr.spare));
 
   /* Create the hist_hdr we expect or write.  */
-  *(char **) hist_hdr.low_pc = (char *) mapstart;
-  *(char **) hist_hdr.high_pc = (char *) mapend;
-  *(int32_t *) hist_hdr.hist_size = kcountsize / sizeof (HISTCOUNTER);
-  *(int32_t *) hist_hdr.prof_rate = __profile_frequency ();
+  struct real_gmon_hist_hdr
+  {
+    char *low_pc;
+    char *high_pc;
+    int32_t hist_size;
+    int32_t prof_rate;
+    char dimen[15];
+    char dimen_abbrev;
+  } hist_hdr;
+  if (sizeof (hist_hdr) != sizeof (struct gmon_hist_hdr)
+      || (offsetof (struct real_gmon_hist_hdr, low_pc)
+	  != offsetof (struct gmon_hist_hdr, low_pc))
+      || (offsetof (struct real_gmon_hist_hdr, high_pc)
+	  != offsetof (struct gmon_hist_hdr, high_pc))
+      || (offsetof (struct real_gmon_hist_hdr, hist_size)
+	  != offsetof (struct gmon_hist_hdr, hist_size))
+      || (offsetof (struct real_gmon_hist_hdr, prof_rate)
+	  != offsetof (struct gmon_hist_hdr, prof_rate))
+      || (offsetof (struct real_gmon_hist_hdr, dimen)
+	  != offsetof (struct gmon_hist_hdr, dimen))
+      || (offsetof (struct real_gmon_hist_hdr, dimen_abbrev)
+	  != offsetof (struct gmon_hist_hdr, dimen_abbrev)))
+    abort ();
+
+  hist_hdr.low_pc = (char *) mapstart;
+  hist_hdr.high_pc = (char *) mapend;
+  hist_hdr.hist_size = kcountsize / sizeof (HISTCOUNTER);
+  hist_hdr.prof_rate = __profile_frequency ();
   if (sizeof (hist_hdr.dimen) >= sizeof ("seconds"))
     {
       memcpy (hist_hdr.dimen, "seconds", sizeof ("seconds"));
diff --git a/inet/rcmd.c b/inet/rcmd.c
index 5dcbd25568..343e0954db 100644
--- a/inet/rcmd.c
+++ b/inet/rcmd.c
@@ -112,7 +112,13 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af)
 {
 	char paddr[INET6_ADDRSTRLEN];
 	struct addrinfo hints, *res, *ai;
-	struct sockaddr_storage from;
+	union
+	{
+	  struct sockaddr sa;
+	  struct sockaddr_storage ss;
+	  struct sockaddr_in sin;
+	  struct sockaddr_in6 sin6;
+	} from;
 	struct pollfd pfd[2];
 	int32_t oldmask;
 	pid_t pid;
@@ -274,14 +280,13 @@ poll: protocol failure in circuit setup\n")) >= 0))
 			(void)__close(s2);
 			goto bad;
 		}
-		s3 = TEMP_FAILURE_RETRY (accept(s2, (struct sockaddr *)&from,
-						&len));
-		switch (from.ss_family) {
+		s3 = TEMP_FAILURE_RETRY (accept(s2, &from.sa, &len));
+		switch (from.sa.sa_family) {
 		case AF_INET:
-			rport = ntohs(((struct sockaddr_in *)&from)->sin_port);
+			rport = ntohs(from.sin.sin_port);
 			break;
 		case AF_INET6:
-			rport = ntohs(((struct sockaddr_in6 *)&from)->sin6_port);
+			rport = ntohs(from.sin6.sin6_port);
 			break;
 		default:
 			rport = 0;
@@ -605,13 +610,13 @@ iruserok_af (raddr, superuser, ruser, luser, af)
   memset (&ra, '\0', sizeof(ra));
   switch (af){
   case AF_INET:
-    ((struct sockaddr_in *)&ra)->sin_family = AF_INET;
+    ra.ss_family = AF_INET;
     memcpy (&(((struct sockaddr_in *)&ra)->sin_addr), raddr,
 	    sizeof(struct in_addr));
     ralen = sizeof(struct sockaddr_in);
     break;
   case AF_INET6:
-    ((struct sockaddr_in6 *)&ra)->sin6_family = AF_INET6;
+    ra.ss_family = AF_INET6;
     memcpy (&(((struct sockaddr_in6 *)&ra)->sin6_addr), raddr,
             sizeof(struct in6_addr));
     ralen = sizeof(struct sockaddr_in6);
diff --git a/inet/rexec.c b/inet/rexec.c
index 07ddeeafea..75bb47082b 100644
--- a/inet/rexec.c
+++ b/inet/rexec.c
@@ -56,7 +56,7 @@ rexec_af(ahost, rport, name, pass, cmd, fd2p, af)
 	int *fd2p;
 	sa_family_t af;
 {
-	struct sockaddr_storage sa2, from;
+	struct sockaddr_storage from;
 	struct addrinfo hints, *res0;
 	const char *orig_name = name;
 	const char *orig_pass = pass;
@@ -115,6 +115,11 @@ retry:
 	} else {
 		char num[32];
 		int s2;
+		union
+		{
+		  struct sockaddr_storage ss;
+		  struct sockaddr sa;
+		} sa2;
 		socklen_t sa2len;
 
 		s2 = __socket(res0->ai_family, res0->ai_socktype, 0);
@@ -124,17 +129,17 @@ retry:
 		}
 		__listen(s2, 1);
 		sa2len = sizeof (sa2);
-		if (__getsockname(s2, (struct sockaddr *)&sa2, &sa2len) < 0) {
+		if (__getsockname(s2, &sa2.sa, &sa2len) < 0) {
 			perror("getsockname");
 			(void) __close(s2);
 			goto bad;
-		} else if (sa2len != SA_LEN((struct sockaddr *)&sa2)) {
+		} else if (sa2len != SA_LEN(&sa2.sa)) {
 			__set_errno(EINVAL);
 			(void) __close(s2);
 			goto bad;
 		}
 		port = 0;
-		if (!getnameinfo((struct sockaddr *)&sa2, sa2len,
+		if (!getnameinfo(&sa2.sa, sa2len,
 				 NULL, 0, servbuff, sizeof(servbuff),
 				 NI_NUMERICSERV))
 			port = atoi(servbuff);
diff --git a/nscd/nscd_helper.c b/nscd/nscd_helper.c
index 7db5d09845..cd3fa24196 100644
--- a/nscd/nscd_helper.c
+++ b/nscd/nscd_helper.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2007, 2008 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2007, 2008, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -318,7 +318,7 @@ get_mapping (request_type type, const char *key,
 
   /* This access is well-aligned since BUF is correctly aligned for an
      int and CMSG_DATA preserves this alignment.  */
-  *(int *) CMSG_DATA (cmsg) = -1;
+  memset (CMSG_DATA (cmsg), '\xff', sizeof (int));
 
   msg.msg_controllen = cmsg->cmsg_len;
 
@@ -335,7 +335,8 @@ get_mapping (request_type type, const char *key,
 			    != CMSG_LEN (sizeof (int))), 0))
     goto out_close2;
 
-  mapfd = *(int *) CMSG_DATA (cmsg);
+  int *ip = (void *) CMSG_DATA (cmsg);
+  mapfd = *ip;
 
   if (__builtin_expect (n != keylen && n != keylen + sizeof (mapsize), 0))
     goto out_close;
diff --git a/sunrpc/clnt_raw.c b/sunrpc/clnt_raw.c
index 44ea03efb7..74d90c8051 100644
--- a/sunrpc/clnt_raw.c
+++ b/sunrpc/clnt_raw.c
@@ -57,7 +57,11 @@ struct clntraw_private_s
     CLIENT client_object;
     XDR xdr_stream;
     char _raw_buf[UDPMSGSIZE];
-    char mashl_callmsg[MCALL_MSG_SIZE];
+    union
+    {
+      char msg[MCALL_MSG_SIZE];
+      u_long rm_xid;
+    } mashl_callmsg;
     u_int mcnt;
   };
 #ifdef _RPC_THREAD_SAFE_
@@ -111,7 +115,8 @@ clntraw_create (u_long prog, u_long vers)
   call_msg.rm_call.cb_rpcvers = RPC_MSG_VERSION;
   call_msg.rm_call.cb_prog = prog;
   call_msg.rm_call.cb_vers = vers;
-  INTUSE(xdrmem_create) (xdrs, clp->mashl_callmsg, MCALL_MSG_SIZE, XDR_ENCODE);
+  INTUSE(xdrmem_create) (xdrs, clp->mashl_callmsg.msg, MCALL_MSG_SIZE,
+			 XDR_ENCODE);
   if (!INTUSE(xdr_callhdr) (xdrs, &call_msg))
     {
       perror (_ ("clnt_raw.c: fatal header serialization error"));
@@ -156,8 +161,11 @@ call_again:
    */
   xdrs->x_op = XDR_ENCODE;
   XDR_SETPOS (xdrs, 0);
-  ((struct rpc_msg *) clp->mashl_callmsg)->rm_xid++;
-  if ((!XDR_PUTBYTES (xdrs, clp->mashl_callmsg, clp->mcnt)) ||
+  /* Just checking the union definition to access rm_xid is correct.  */
+  if (offsetof (struct rpc_msg, rm_xid) != 0)
+    abort ();
+  clp->mashl_callmsg.rm_xid++;
+  if ((!XDR_PUTBYTES (xdrs, clp->mashl_callmsg.msg, clp->mcnt)) ||
       (!XDR_PUTLONG (xdrs, (long *) &proc)) ||
       (!AUTH_MARSHALL (h->cl_auth, xdrs)) ||
       (!(*xargs) (xdrs, argsp)))
diff --git a/sysdeps/unix/sysv/linux/dl-osinfo.h b/sysdeps/unix/sysv/linux/dl-osinfo.h
index 415002b1b2..df07869bc5 100644
--- a/sysdeps/unix/sysv/linux/dl-osinfo.h
+++ b/sysdeps/unix/sysv/linux/dl-osinfo.h
@@ -29,7 +29,7 @@
 #ifdef SHARED
 /* This is the function used in the dynamic linker to print the fatal error
    message.  */
-static inline void
+static void
 __attribute__ ((__noreturn__))
 dl_fatal (const char *str)
 {
diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h
index 8c67b5b5f9..4444ae0a71 100644
--- a/sysdeps/x86_64/dl-machine.h
+++ b/sysdeps/x86_64/dl-machine.h
@@ -403,7 +403,9 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
 
 	      fmt = "\
 %s: Symbol `%s' causes overflow in R_X86_64_32 relocation\n";
+#  ifndef RESOLVE_CONFLICT_FIND_MAP
 	    print_err:
+#  endif
 	      strtab = (const char *) D_PTR (map, l_info[DT_STRTAB]);
 
 	      _dl_error_printf (fmt,