From owner-freebsd-current@FreeBSD.ORG Wed May 20 07:11:09 2015 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EDA168E7 for ; Wed, 20 May 2015 07:11:08 +0000 (UTC) Received: from mail-ie0-x22b.google.com (mail-ie0-x22b.google.com [IPv6:2607:f8b0:4001:c03::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B6A5C1A57 for ; Wed, 20 May 2015 07:11:08 +0000 (UTC) Received: by iepj10 with SMTP id j10so32371087iep.3 for ; Wed, 20 May 2015 00:11:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:message-id:subject:from:to:content-type; bh=054qd6YVAW6l76uFMeayyPNzioKrRXDEOyQTdkmtJGw=; b=dtaS9z2MxTpzcUhVLVIUVHuXgSyu2T69ZN7kDpCELXTab9r06/Azb5tqumZVoWo8WR Ofkar0sgIWDiwGHvIxS7Q9Y7o+ZuBXSZ3vy9GaXnxsBgBudEi5IkzdsQ2N5Zn9TWg4VK LnCsMzLHtnLNGzoGu8bAdKGnbvADuBmFrn2JuF2Hr8/NsSxDdlqfexAb4UUdcpyZPxnU 6setCK69nx4lhgGeAfH0aNQKV5ws62XGqGXYhH2WB8mQhTGs0ezRm9CqHrVqw37lU3J6 Zl0Xunug/viPPP8FXx+GMdIeyIfAEwv0bP5CZk07+setHZf8grdZZn0c8vOc7f5dyXck x4Wg== MIME-Version: 1.0 X-Received: by 10.43.58.201 with SMTP id wl9mr44718721icb.37.1432105868162; Wed, 20 May 2015 00:11:08 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.36.38.133 with HTTP; Wed, 20 May 2015 00:11:08 -0700 (PDT) Date: Wed, 20 May 2015 00:11:08 -0700 X-Google-Sender-Auth: Ug-vJ9Iee4g6l7IEQg_VAmOf5Sc Message-ID: Subject: libc/gen: unused variables From: Adrian Chadd To: freebsd-current Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 May 2015 07:11:09 -0000 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;