From owner-svn-src-all@FreeBSD.ORG Sat Mar 31 11:10:15 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 383CC106566B for ; Sat, 31 Mar 2012 11:10:15 +0000 (UTC) (envelope-from joerg@britannica.bec.de) Received: from mo-p00-ob6.rzone.de (mo-p00-ob6.rzone.de [IPv6:2a01:238:20a:202:53f0::1]) by mx1.freebsd.org (Postfix) with ESMTP id 9211A8FC14 for ; Sat, 31 Mar 2012 11:10:14 +0000 (UTC) X-RZG-AUTH: :JiIXek6mfvEEUpFQdo7Fj1/zg48CFjWjQv0cW+St/nW/afoqryxplnvYriQqpYxxjQ== X-RZG-CLASS-ID: mo00 Received: from britannica.bec.de (p4202-ipbfp905osakakita.osaka.ocn.ne.jp [124.101.175.202]) by smtp.strato.de (fruni mo27) (RZmta 28.5 AUTH) with (DHE-RSA-AES128-SHA encrypted) ESMTPA id k0635eo2VAJhjo for ; Sat, 31 Mar 2012 13:10:10 +0200 (MEST) Received: by britannica.bec.de (sSMTP sendmail emulation); Sat, 31 Mar 2012 20:10:07 +0900 Date: Sat, 31 Mar 2012 20:10:07 +0900 From: Joerg Sonnenberger To: svn-src-all@freebsd.org Message-ID: <20120331111007.GB6658@britannica.bec.de> References: <201203301257.q2UCvE4l042042@svn.freebsd.org> <20120330133045.GD1423@mole.fafoe.narf.at> <4F760E5F.5030300@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4F760E5F.5030300@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: svn commit: r233700 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 31 Mar 2012 11:10:15 -0000 On Fri, Mar 30, 2012 at 09:49:51PM +0200, Dimitry Andric wrote: > 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; I would really just move the ha = into the loop body -- same semantic and no such issue as a dangling ;. Joerg