Date: Wed, 20 May 2015 00:11:08 -0700 From: Adrian Chadd <adrian@freebsd.org> To: freebsd-current <freebsd-current@freebsd.org> Subject: libc/gen: unused variables Message-ID: <CAJ-Vmok3-tDX-9X4NOjghoX40BQpF12XPL9S%2B=bsY5pkYuP39w@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
Hi, here's a patch against -head that eliminates gcc-4.9 complaining about set-but-unused variables. It just comments them out for now - are these okay to eliminate, or is there something else that's broken/missing? Thanks! -adrian adrian@lucy-11i386:~/work/freebsd/head-embedded/src/lib % svn diff Index: libc/gen/dlfcn.c =================================================================== --- libc/gen/dlfcn.c (revision 282934) +++ libc/gen/dlfcn.c (working copy) @@ -149,10 +149,10 @@ dl_init_phdr_info(void) { Elf_Auxinfo *auxp; - size_t phent; +// size_t phent; unsigned int i; - phent = 0; +// phent = 0; for (auxp = __elf_aux_vector; auxp->a_type != AT_NULL; auxp++) { switch (auxp->a_type) { case AT_BASE: @@ -166,7 +166,7 @@ (const Elf_Phdr *)auxp->a_un.a_ptr; break; case AT_PHENT: - phent = auxp->a_un.a_val; +// phent = auxp->a_un.a_val; break; case AT_PHNUM: phdr_info.dlpi_phnum = (Elf_Half)auxp->a_un.a_val; Index: libc/gen/getgrent.c =================================================================== --- libc/gen/getgrent.c (revision 282934) +++ libc/gen/getgrent.c (working copy) @@ -207,11 +207,11 @@ grp_marshal_func(char *buffer, size_t *buffer_size, void *retval, va_list ap, void *cache_mdata) { - char *name; - gid_t gid; +// char *name; +// gid_t gid; struct group *grp; - char *orig_buf; - size_t orig_buf_size; +// char *orig_buf; +// size_t orig_buf_size; struct group new_grp; size_t desired_size, size, mem_size; @@ -219,10 +219,10 @@ switch ((enum nss_lookup_type)cache_mdata) { case nss_lt_name: - name = va_arg(ap, char *); +// name = va_arg(ap, char *); break; case nss_lt_id: - gid = va_arg(ap, gid_t); +// gid = va_arg(ap, gid_t); break; case nss_lt_all: break; @@ -232,8 +232,8 @@ } grp = va_arg(ap, struct group *); - orig_buf = va_arg(ap, char *); - orig_buf_size = va_arg(ap, size_t); +// orig_buf = va_arg(ap, char *); +// orig_buf_size = va_arg(ap, size_t); desired_size = _ALIGNBYTES + sizeof(struct group) + sizeof(char *); @@ -302,8 +302,8 @@ grp_unmarshal_func(char *buffer, size_t buffer_size, void *retval, va_list ap, void *cache_mdata) { - char *name; - gid_t gid; +// char *name; +// gid_t gid; struct group *grp; char *orig_buf; size_t orig_buf_size; @@ -314,10 +314,10 @@ switch ((enum nss_lookup_type)cache_mdata) { case nss_lt_name: - name = va_arg(ap, char *); +// name = va_arg(ap, char *); break; case nss_lt_id: - gid = va_arg(ap, gid_t); +// gid = va_arg(ap, gid_t); break; case nss_lt_all: break; @@ -659,7 +659,7 @@ NS_FALLBACK_CB(getgroupmembership_fallback) { NULL, NULL, NULL } }; - int rv; +// int rv; assert(uname != NULL); /* groups may be NULL if just sizing when invoked with maxgrp = 0 */ @@ -666,7 +666,9 @@ assert(grpcnt != NULL); *grpcnt = 0; - rv = _nsdispatch(NULL, dtab, NSDB_GROUP, "getgroupmembership", + //rv = _nsdispatch(NULL, dtab, NSDB_GROUP, "getgroupmembership", + /* XXX TODO: check rv? */ + (void) _nsdispatch(NULL, dtab, NSDB_GROUP, "getgroupmembership", defaultsrc, uname, agroup, groups, maxgrp, grpcnt); /* too many groups found? */ Index: libc/gen/getpwent.c =================================================================== --- libc/gen/getpwent.c (revision 282934) +++ libc/gen/getpwent.c (working copy) @@ -257,11 +257,11 @@ pwd_marshal_func(char *buffer, size_t *buffer_size, void *retval, va_list ap, void *cache_mdata) { - char *name; - uid_t uid; +// char *name; +// uid_t uid; struct passwd *pwd; - char *orig_buf; - size_t orig_buf_size; +// char *orig_buf; +// size_t orig_buf_size; struct passwd new_pwd; size_t desired_size, size; @@ -269,10 +269,10 @@ switch ((enum nss_lookup_type)cache_mdata) { case nss_lt_name: - name = va_arg(ap, char *); +// name = va_arg(ap, char *); break; case nss_lt_id: - uid = va_arg(ap, uid_t); +// uid = va_arg(ap, uid_t); break; case nss_lt_all: break; @@ -282,8 +282,8 @@ } pwd = va_arg(ap, struct passwd *); - orig_buf = va_arg(ap, char *); - orig_buf_size = va_arg(ap, size_t); +// orig_buf = va_arg(ap, char *); +// orig_buf_size = va_arg(ap, size_t); desired_size = sizeof(struct passwd) + sizeof(char *) + strlen(pwd->pw_name) + 1; @@ -361,8 +361,8 @@ pwd_unmarshal_func(char *buffer, size_t buffer_size, void *retval, va_list ap, void *cache_mdata) { - char *name; - uid_t uid; +// char *name; +// uid_t uid; struct passwd *pwd; char *orig_buf; size_t orig_buf_size; @@ -372,10 +372,10 @@ switch ((enum nss_lookup_type)cache_mdata) { case nss_lt_name: - name = va_arg(ap, char *); +// name = va_arg(ap, char *); break; case nss_lt_id: - uid = va_arg(ap, uid_t); +// uid = va_arg(ap, uid_t); break; case nss_lt_all: break;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ-Vmok3-tDX-9X4NOjghoX40BQpF12XPL9S%2B=bsY5pkYuP39w>