From 5615eaf26469f20c2d8c3be5770e12564a1edfff Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Fri, 10 Jun 2011 12:45:09 -0700 Subject: Quash some new warnings from GCC 4.6. --- ChangeLog | 37 +++++++++++++++++++++++++++++++++++++ Makefile | 10 ++++++++-- catgets/gencat.c | 11 ++--------- elf/dl-open.c | 5 ++--- inet/getnetgrent_r.c | 7 ++----- io/fts.c | 7 ++----- locale/programs/ld-collate.c | 2 -- locale/programs/ld-ctype.c | 4 +--- locale/programs/locarchive.c | 3 --- misc/syslog.c | 4 ++-- nis/nis_print_group_entry.c | 5 +++-- nis/nss_compat/compat-pwd.c | 6 ++---- nis/nss_compat/compat-spwd.c | 5 ++--- nscd/hstcache.c | 4 ---- posix/bug-regex31.c | 1 + resolv/nss_dns/dns-network.c | 7 ++----- resolv/res_hconf.c | 5 +++-- stdio-common/printf_fp.c | 2 -- sunrpc/clnt_udp.c | 9 +++++---- 19 files changed, 74 insertions(+), 60 deletions(-) diff --git a/ChangeLog b/ChangeLog index c5dff27..8d30749 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,42 @@ 2011-06-10 Roland McGrath + * Makefile ($(common-objpfx)linkobj/libc.so): Break long lines with \. + Don't list ld.so twice in dependencies. + + * posix/bug-regex31.c: Include . + + * nscd/hstcache.c (cache_addhst): Remove unused variable. + + * nis/nss_compat/compat-spwd.c + (getspent_next_nss_netgr): Remove unused variable. + * nis/nss_compat/compat-pwd.c (getpwent_next_nss_netgr): Likewise. + + * nis/nis_print_group_entry.c (nis_print_group_entry): Fix "Implicit + nonmembers" output to use the right array. + + * resolv/nss_dns/dns-network.c (getanswer_r): Remove unused variable. + + * elf/dl-open.c (_dl_open): Quash warnings when DL_NNS==1. + + * locale/programs/ld-ctype.c (ctype_read): Remove unused variable. + * locale/programs/ld-collate.c (add_to_tablewc): Likewise. + * catgets/gencat.c (read_input_file): Likewise. + * locale/programs/locarchive.c (enlarge_archive): Likewise. + + * sunrpc/clnt_udp.c (__libc_clntudp_bufcreate): Move DONTBLOCK + variable definition inside #if's controlling its use. + + * inet/getnetgrent_r.c (innetgr): Remove unused variable. + + * resolv/res_hconf.c (_res_hconf_reorder_addrs): Fix errno restoration. + + * misc/syslog.c (__vsyslog_chk): Remove unused variable. + + * io/fts.c (fts_build): Use if (0 && ...) rather than #if 0 for + unreachable code. + + * stdio-common/printf_fp.c (___printf_fp): Remove unused variable. + * configure.in (nss-crypt check): Use AC_LANG_PROGRAM. * configure: Regenerated. diff --git a/Makefile b/Makefile index ea7a5b5..aac2557 100644 --- a/Makefile +++ b/Makefile @@ -138,10 +138,16 @@ lib: $(common-objpfx)libc.so lib: $(common-objpfx)linkobj/libc.so -$(common-objpfx)linkobj/libc.so: $(elfobjdir)/soinit.os $(common-objpfx)linkobj/libc_pic.a $(elfobjdir)/sofini.os $(elfobjdir)/interp.os $(elfobjdir)/ld.so $(common-objpfx)shlib.lds $(common-objpfx)elf/ld.so +$(common-objpfx)linkobj/libc.so: $(elfobjdir)/soinit.os \ + $(common-objpfx)linkobj/libc_pic.a \ + $(elfobjdir)/sofini.os \ + $(elfobjdir)/interp.os \ + $(elfobjdir)/ld.so \ + $(common-objpfx)shlib.lds $(build-shlib) -$(common-objpfx)linkobj/libc_pic.a: $(common-objpfx)libc_pic.a $(common-objpfx)sunrpc/librpc_compat_pic.a +$(common-objpfx)linkobj/libc_pic.a: $(common-objpfx)libc_pic.a \ + $(common-objpfx)sunrpc/librpc_compat_pic.a $(..)./scripts/mkinstalldirs $(common-objpfx)linkobj (cd $(common-objpfx)linkobj; \ $(AR) x ../libc_pic.a; \ diff --git a/catgets/gencat.c b/catgets/gencat.c index ad677a8..2a48122 100644 --- a/catgets/gencat.c +++ b/catgets/gencat.c @@ -467,7 +467,6 @@ this is the first definition")); else if (strncmp (&this_line[1], "delset", 6) == 0) { int cnt = sizeof ("delset"); - size_t set_number; while (isspace (this_line[cnt])) ++cnt; @@ -489,11 +488,8 @@ this is the first definition")); ++cnt; if (cnt == start) - { - error_at_line (0, 0, fname, start_line, - gettext ("illegal set number")); - set_number = 0; - } + error_at_line (0, 0, fname, start_line, + gettext ("illegal set number")); else { const char *symbol; @@ -506,7 +502,6 @@ this is the first definition")); /* We have a symbolic set name. This name must appear somewhere else in the catalogs read so far. */ - set_number = 0; for (runp = current->all_sets; runp != NULL; runp = runp->next) { @@ -657,12 +652,10 @@ this is the first definition")); else if (ident[0] != '\0') { struct message_list *runp; - struct message_list *lastp; /* Test whether the symbolic name was not used for another message in this message set. */ runp = current->current_set->messages; - lastp = NULL; while (runp != NULL) if (runp->symbol != NULL && strcmp (ident, runp->symbol) == 0) break; diff --git a/elf/dl-open.c b/elf/dl-open.c index 8d90b56..19fda91 100644 --- a/elf/dl-open.c +++ b/elf/dl-open.c @@ -516,7 +516,7 @@ _dl_open (const char *file, int mode, const void *caller_dlopen, Lmid_t nsid, if (__builtin_expect (nsid == LM_ID_NEWLM, 0)) { /* Find a new namespace. */ - for (nsid = 1; nsid < GL(dl_nns); ++nsid) + for (nsid = 1; DL_NNS > 1 && nsid < GL(dl_nns); ++nsid) if (GL(dl_ns)[nsid]._ns_loaded == NULL) break; @@ -528,8 +528,7 @@ _dl_open (const char *file, int mode, const void *caller_dlopen, Lmid_t nsid, _dl_signal_error (EINVAL, file, NULL, N_("\ no more namespaces available for dlmopen()")); } - - if (nsid == GL(dl_nns)) + else if (nsid == GL(dl_nns)) { __rtld_lock_initialize (GL(dl_ns)[nsid]._ns_unique_sym_table.lock); ++GL(dl_nns); diff --git a/inet/getnetgrent_r.c b/inet/getnetgrent_r.c index 3870185..0bac7b7 100644 --- a/inet/getnetgrent_r.c +++ b/inet/getnetgrent_r.c @@ -1,5 +1,5 @@ -/* Copyright (C) 1996, 1997, 1998, 1999, 2002, 2004, 2005, 2007 - Free Software Foundation, Inc. +/* Copyright (C) 1996,1997,1998,1999,2002,2004,2005,2007,2011 + Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -347,7 +347,6 @@ innetgr (const char *netgroup, const char *host, const char *user, struct __netgrent entry; int result = 0; const char *current_group = netgroup; - int real_entry = 0; memset (&entry, '\0', sizeof (entry)); @@ -404,8 +403,6 @@ innetgr (const char *netgroup, const char *host, const char *user, } else { - real_entry = 1; - if ((entry.val.triple.host == NULL || host == NULL || __strcasecmp (entry.val.triple.host, host) == 0) && (entry.val.triple.user == NULL || user == NULL diff --git a/io/fts.c b/io/fts.c index 8e628b4..5ba202b 100644 --- a/io/fts.c +++ b/io/fts.c @@ -748,20 +748,17 @@ mem1: saved_errno = errno; p->fts_flags |= FTS_ISW; #endif -#if 0 /* Unreachable code. cderrno is only ever set to a nonnull value if dirp is closed at the same time. But then we cannot enter this loop. */ - if (cderrno) { + if (0 && cderrno) { if (nlinks) { p->fts_info = FTS_NS; p->fts_errno = cderrno; } else p->fts_info = FTS_NSOK; p->fts_accpath = cur->fts_accpath; - } else -#endif - if (nlinks == 0 + } else if (nlinks == 0 #if defined DT_DIR && defined _DIRENT_HAVE_D_TYPE || (nostat && dp->d_type != DT_DIR && dp->d_type != DT_UNKNOWN) diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c index b30d1ac..a0a0159 100644 --- a/locale/programs/ld-collate.c +++ b/locale/programs/ld-collate.c @@ -1987,7 +1987,6 @@ add_to_tablewc (uint32_t ch, struct element_t *runp) { /* As for the singlebyte table, we recognize sequences and compress them. */ - struct element_t *lastp; collidx_table_add (atwc.tablewc, ch, -(obstack_object_size (atwc.extrapool) @@ -2087,7 +2086,6 @@ add_to_tablewc (uint32_t ch, struct element_t *runp) } /* Next entry. */ - lastp = runp; runp = runp->wcnext; } while (runp != NULL); diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c index 376a02c..36d0a99 100644 --- a/locale/programs/ld-ctype.c +++ b/locale/programs/ld-ctype.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-2006, 2007, 2009 Free Software Foundation, Inc. +/* Copyright (C) 1995-2006,2007,2009,2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1995. @@ -2209,7 +2209,6 @@ ctype_read (struct linereader *ldfile, struct localedef_t *result, struct token *now; enum token_t nowtok; size_t cnt; - struct charseq *last_seq; uint32_t last_wch = 0; enum token_t last_token; enum token_t ellipsis_token; @@ -2465,7 +2464,6 @@ ctype_read (struct linereader *ldfile, struct localedef_t *result, } else last_str = NULL; - last_seq = seq; last_wch = wch; memcpy (last_charcode, now->val.charcode.bytes, 16); last_charcode_len = now->val.charcode.nbytes; diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c index 943bc5a..770a731 100644 --- a/locale/programs/locarchive.c +++ b/locale/programs/locarchive.c @@ -300,7 +300,6 @@ enlarge_archive (struct locarhandle *ah, const struct locarhead *head) void *p; unsigned int cnt, loccnt; struct namehashent *oldnamehashtab; - struct locrecent *oldlocrectab; struct locarhandle new_ah; size_t prefix_len = output_prefix ? strlen (output_prefix) : 0; char archivefname[prefix_len + sizeof (ARCHIVE_NAME)]; @@ -431,8 +430,6 @@ enlarge_archive (struct locarhandle *ah, const struct locarhead *head) still referenced and transfer it into the new file. */ oldnamehashtab = (struct namehashent *) ((char *) ah->addr + head->namehash_offset); - oldlocrectab = (struct locrecent *) ((char *) ah->addr - + head->locrectab_offset); /* Sort the old locrec table in order of data position. */ struct oldlocrecent oldlocrecarray[head->namehash_size]; diff --git a/misc/syslog.c b/misc/syslog.c index 90cd3bf..7156b4f 100644 --- a/misc/syslog.c +++ b/misc/syslog.c @@ -141,7 +141,7 @@ __vsyslog_chk(int pri, int flag, const char *fmt, va_list ap) FILE *f; char *buf = 0; size_t bufsize = 0; - size_t prioff, msgoff; + size_t msgoff; #ifndef NO_SIGPIPE struct sigaction action, oldaction; int sigpipe; @@ -192,7 +192,7 @@ __vsyslog_chk(int pri, int flag, const char *fmt, va_list ap) else { __fsetlocking (f, FSETLOCKING_BYCALLER); - prioff = fprintf (f, "<%d>", pri); + fprintf (f, "<%d>", pri); (void) time (&now); f->_IO_write_ptr += __strftime_l (f->_IO_write_ptr, f->_IO_write_end diff --git a/nis/nis_print_group_entry.c b/nis/nis_print_group_entry.c index 11680ae..925c950 100644 --- a/nis/nis_print_group_entry.c +++ b/nis/nis_print_group_entry.c @@ -1,4 +1,5 @@ -/* Copyright (c) 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc. +/* Copyright (c) 1997,1998,2000,2004,2006,2011 + Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk , 1997. @@ -156,7 +157,7 @@ nis_print_group_entry (const_nis_name group) { fputs (_(" Implicit nonmembers:\n"), stdout); for (i = 0; i < nomem_imp_cnt; ++i) - printf ("\t%s\n", &mem_imp[i][3]); + printf ("\t%s\n", &nomem_imp[i][3]); } else fputs (_(" No implicit nonmembers\n"), stdout); diff --git a/nis/nss_compat/compat-pwd.c b/nis/nss_compat/compat-pwd.c index 669522f..6462a85 100644 --- a/nis/nss_compat/compat-pwd.c +++ b/nis/nss_compat/compat-pwd.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1996-1999, 2001-2006, 2007 Free Software Foundation, Inc. +/* Copyright (C) 1996-1999,2001-2006,2007,2011 + Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk , 1996. @@ -386,9 +387,6 @@ getpwent_next_nss_netgr (const char *name, struct passwd *result, ent_t *ent, while (1) { - char *saved_cursor; - - saved_cursor = ent->netgrdata.cursor; status = __internal_getnetgrent_r (&host, &user, &domain, &ent->netgrdata, buffer, buflen, errnop); diff --git a/nis/nss_compat/compat-spwd.c b/nis/nss_compat/compat-spwd.c index 95f7355..6699259 100644 --- a/nis/nss_compat/compat-spwd.c +++ b/nis/nss_compat/compat-spwd.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1996-1999, 2001-2006, 2007 Free Software Foundation, Inc. +/* Copyright (C) 1996-1999,2001-2006,2007,2011 + Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk , 1996. @@ -344,10 +345,8 @@ getspent_next_nss_netgr (const char *name, struct spwd *result, ent_t *ent, while (1) { - char *saved_cursor; enum nss_status status; - saved_cursor = ent->netgrdata.cursor; status = __internal_getnetgrent_r (&host, &user, &domain, &ent->netgrdata, buffer, buflen, errnop); diff --git a/nscd/hstcache.c b/nscd/hstcache.c index 101ad2a..1ab5860 100644 --- a/nscd/hstcache.c +++ b/nscd/hstcache.c @@ -190,7 +190,6 @@ cache_addhst (struct database_dyn *db, int fd, request_header *req, size_t h_aliases_cnt; uint32_t *h_aliases_len; size_t h_addr_list_cnt; - int addr_list_type; char *addresses; char *aliases; char *key_copy = NULL; @@ -409,9 +408,6 @@ cache_addhst (struct database_dyn *db, int fd, request_header *req, + total + req->key_len, MS_ASYNC); } - addr_list_type = (hst->h_length == NS_INADDRSZ - ? GETHOSTBYADDR : GETHOSTBYADDRv6); - /* NB: the following code is really complicated. It has seemlingly duplicated code paths which do the same. The problem is that we always must add the hash table entry diff --git a/posix/bug-regex31.c b/posix/bug-regex31.c index 974e860..fc48581 100644 --- a/posix/bug-regex31.c +++ b/posix/bug-regex31.c @@ -1,6 +1,7 @@ #include #include #include +#include #include int diff --git a/resolv/nss_dns/dns-network.c b/resolv/nss_dns/dns-network.c index c9969e0..b51db9e 100644 --- a/resolv/nss_dns/dns-network.c +++ b/resolv/nss_dns/dns-network.c @@ -1,5 +1,5 @@ -/* Copyright (C) 1996, 1997, 1998, 1999, 2002, 2004, 2007, 2008 - Free Software Foundation, Inc. +/* Copyright (C) 1996,1997,1998,1999,2002,2004,2007,2008,2011 + Free Software Foundation, Inc. This file is part of the GNU C Library. Extended from original form by Ulrich Drepper , 1996. @@ -293,7 +293,6 @@ getanswer_r (const querybuf *answer, int anslen, struct netent *result, const unsigned char *cp = &answer->buf[HFIXEDSZ]; char **alias_pointer; int have_answer; - char *ans; u_char packtmp[NS_MAXCDNAME]; if (question_count == 0) @@ -328,7 +327,6 @@ getanswer_r (const querybuf *answer, int anslen, struct netent *result, alias_pointer = result->n_aliases = &net_data->aliases[0]; *alias_pointer = NULL; have_answer = 0; - ans = NULL; while (--answer_count >= 0 && cp < end_of_message) { @@ -351,7 +349,6 @@ getanswer_r (const querybuf *answer, int anslen, struct netent *result, if (n < 0 || res_dnok (bp) == 0) break; cp += n; - ans = strdupa (bp); GETSHORT (type, cp); GETSHORT (class, cp); cp += INT32SZ; /* TTL */ diff --git a/resolv/res_hconf.c b/resolv/res_hconf.c index ed55bec..fc4b83f 100644 --- a/resolv/res_hconf.c +++ b/resolv/res_hconf.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1993, 1995-2006, 2007, 2009 Free Software Foundation, Inc. +/* Copyright (C) 1993,1995-2006,2007,2009,2011 + Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by David Mosberger (davidm@azstarnet.com). @@ -461,7 +462,7 @@ _res_hconf_reorder_addrs (struct hostent *hp) cleanup: /* Release lock, preserve error value, and close socket. */ - save = errno; + errno = save; num_ifs = new_num_ifs; diff --git a/stdio-common/printf_fp.c b/stdio-common/printf_fp.c index e9ff168..0a61147 100644 --- a/stdio-common/printf_fp.c +++ b/stdio-common/printf_fp.c @@ -640,7 +640,6 @@ ___printf_fp (FILE *fp, int exp10 = 0; int explog = LDBL_MAX_10_EXP_LOG; const struct mp_power *powers = &_fpioconst_pow10[explog + 1]; - mp_size_t used_limbs = fracsize - 1; /* Now shift the input value to its right place. */ cy = __mpn_lshift (frac, fp_input, fracsize, to_shift); @@ -762,7 +761,6 @@ ___printf_fp (FILE *fp, fracsize = tmpsize - (i - 1); } } - used_limbs = fracsize - 1; } } --explog; diff --git a/sunrpc/clnt_udp.c b/sunrpc/clnt_udp.c index 7aa86a6..83fdd8e 100644 --- a/sunrpc/clnt_udp.c +++ b/sunrpc/clnt_udp.c @@ -172,8 +172,6 @@ __libc_clntudp_bufcreate (struct sockaddr_in *raddr, u_long program, cu->cu_xdrpos = XDR_GETPOS (&(cu->cu_outxdrs)); if (*sockp < 0) { - int dontblock = 1; - #ifdef SOCK_NONBLOCK # ifndef __ASSUME_SOCK_CLOEXEC if (__have_sock_cloexec >= 0) @@ -212,8 +210,11 @@ __libc_clntudp_bufcreate (struct sockaddr_in *raddr, u_long program, # ifdef SOCK_CLOEXEC if (__have_sock_cloexec < 0) # endif - /* the sockets rpc controls are non-blocking */ - (void) __ioctl (*sockp, FIONBIO, (char *) &dontblock); + { + /* the sockets rpc controls are non-blocking */ + int dontblock = 1; + (void) __ioctl (*sockp, FIONBIO, (char *) &dontblock); + } #endif #ifdef IP_RECVERR { -- cgit v1.1