From owner-svn-src-all@freebsd.org Thu Feb 18 20:15:56 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 305DCAADEE2; Thu, 18 Feb 2016 20:15:56 +0000 (UTC) (envelope-from se@freebsd.org) Received: from mailout07.t-online.de (mailout07.t-online.de [194.25.134.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mailout00.t-online.de", Issuer "TeleSec ServerPass DE-1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B6B2817A6; Thu, 18 Feb 2016 20:15:55 +0000 (UTC) (envelope-from se@freebsd.org) Received: from fwd41.aul.t-online.de (fwd41.aul.t-online.de [172.20.27.139]) by mailout07.t-online.de (Postfix) with SMTP id 3A4CD5FB960; Thu, 18 Feb 2016 21:15:47 +0100 (CET) Received: from [192.168.119.22] (ZwsoZaZvrh3baDbPw+aEjq8hbylGK8eGV3HCVC+HzMkqkvPRYrx9eTzuSohREBcwrc@[87.151.212.124]) by fwd41.t-online.de with (TLSv1.2:ECDHE-RSA-AES256-SHA encrypted) esmtp id 1aWUzB-252KuW0; Thu, 18 Feb 2016 21:15:37 +0100 Subject: Re: svn commit: r295760 - head/usr.sbin/pciconf To: John Baldwin , Stefan Esser References: <201602181523.u1IFNQk8004338@repo.freebsd.org> <1865104.t06og7Ezta@ralph.baldwin.cx> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org From: Stefan Esser X-Enigmail-Draft-Status: N1110 Message-ID: <56C6265F.4050101@freebsd.org> Date: Thu, 18 Feb 2016 21:15:27 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <1865104.t06og7Ezta@ralph.baldwin.cx> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-ID: ZwsoZaZvrh3baDbPw+aEjq8hbylGK8eGV3HCVC+HzMkqkvPRYrx9eTzuSohREBcwrc X-TOI-MSGID: aaf13de5-7026-4dc2-b16d-d13db7207141 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2016 20:15:56 -0000 Am 18.02.2016 um 19:07 schrieb John Baldwin: > On Thursday, February 18, 2016 03:23:26 PM Stefan Esser wrote: >> Author: se >> Date: Thu Feb 18 15:23:25 2016 >> New Revision: 295760 >> URL: https://svnweb.freebsd.org/changeset/base/295760 >> >> Log: >> Make WARNS=6 safe. >> >> Tested with Clang 3.7.1, GCC 4.2.1 and GCC 4.8.5 on amd64. > > Thanks. > >> Modified: head/usr.sbin/pciconf/cap.c >> ============================================================================== >> --- head/usr.sbin/pciconf/cap.c Thu Feb 18 15:12:52 2016 (r295759) >> +++ head/usr.sbin/pciconf/cap.c Thu Feb 18 15:23:25 2016 (r295760) >> @@ -120,6 +120,9 @@ static void >> cap_vpd(int fd, struct pci_conf *p, uint8_t ptr) >> { >> >> + (void)fd; /* UNUSED */ >> + (void)p; /* UNUSED */ >> + (void)ptr; /* UNUSED */ >> printf("VPD"); >> } > > I think we prefer __unused in the parameter declaration instead? That is: Since I was not sure about the best way to silence this warning, I had looked at the mail archive and found a mail thread from July 2012 with subject "(void)foo or __unused foo ?". The cast to void seemed to be the most portable method, but in fact I prefer the __unused modifier myself. > cap_vpd(int fd __unused, struct pci_conf *p __unused, uint8_t ptr __unused) Yes, I'll commit that version in a minute. >> @@ -172,6 +175,7 @@ cap_pcix(int fd, struct pci_conf *p, uin >> } >> if ((p->pc_hdr & PCIM_HDRTYPE) == 1) >> return; >> + max_burst_read = 0; >> switch (status & PCIXM_STATUS_MAX_READ) { >> case PCIXM_STATUS_MAX_READ_512: >> max_burst_read = 512; > > Compilers are simply not smart enough. :-P Well, clang-3.7.1 in -CURRENT is ... But both gcc-4.2.1 and gcc-4.8.5 warn about a possibly uninitialized variable. I could have changed the last case selector into "default" to silence the warning without need for an initializer before the switch statement, but that would be too ugly and misleading. >> Modified: head/usr.sbin/pciconf/pciconf.c >> ============================================================================== >> --- head/usr.sbin/pciconf/pciconf.c Thu Feb 18 15:12:52 2016 (r295759) >> +++ head/usr.sbin/pciconf/pciconf.c Thu Feb 18 15:23:25 2016 (r295760) >> @@ -913,7 +915,8 @@ parsesel(const char *str) >> ep += 3; >> i = 0; >> do { >> - selarr[i++] = strtoul(ep, &ep, 10); >> + selarr[i++] = strtoul(ep, &eppos, 10); >> + ep = eppos; >> } while ((*ep == ':' || *ep == '.') && *++ep != '\0' && i < 4); > > This is now indented oddly (2 spaces instead of a tab?). Sorry, the pciconf sources do not comply with "style" and I'm to blame, since I committed the initial version nearly 20 years ago ... But you are correct, I got even the wrong indentation wrong ;-) Thank you for the review and your comments, I'll commit a fixed version now. Best regards, STefan