From owner-svn-src-head@FreeBSD.ORG Fri Mar 30 19:49:46 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DE4F91065695; Fri, 30 Mar 2012 19:49:46 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id 9120A8FC23; Fri, 30 Mar 2012 19:49:46 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:5513:9c82:30fc:da6f] (unknown [IPv6:2001:7b8:3a7:0:5513:9c82:30fc:da6f]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id C68005C37; Fri, 30 Mar 2012 21:49:45 +0200 (CEST) Message-ID: <4F760E5F.5030300@FreeBSD.org> Date: Fri, 30 Mar 2012 21:49:51 +0200 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120321 Thunderbird/12.0 MIME-Version: 1.0 To: Stefan Farfeleder References: <201203301257.q2UCvE4l042042@svn.freebsd.org> <20120330133045.GD1423@mole.fafoe.narf.at> In-Reply-To: <20120330133045.GD1423@mole.fafoe.narf.at> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Scott Long , David Xu Subject: Re: svn commit: r233700 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Mar 2012 19:49:47 -0000 On 2012-03-30 15:30, Stefan Farfeleder wrote: > here are a few similar cases. Hm, what about this one that clang warns about: sys/dev/asr/asr.c:2420:57: warning: for loop has empty body [-Wempty-body] for (ha = &Asr_softc_list; *ha; ha = &((*ha)->ha_next)); ^ sys/dev/asr/asr.c:2420:57: note: put the semicolon on a separate line to silence this warning [-Wempty-body] I'm not sure about it though, the code looks like this: static int asr_attach(device_t dev) { [...] Asr_softc_t *sc, **ha; [...] LIST_INIT(&(sc->ha_ccb)); /* Link us into the HA list */ for (ha = &Asr_softc_list; *ha; ha = &((*ha)->ha_next)); *(ha) = sc; It seems the for loop walks the list until the end, then tacks 'sc' onto it. So to 'fix' the warning, and make the meaning more explicit, we should probably rewrite that fragment as: LIST_INIT(&(sc->ha_ccb)); /* Link us into the HA list */ for (ha = &Asr_softc_list; *ha; ha = &((*ha)->ha_next)) ; *(ha) = sc; Is this OK?