Received: from eggs.gnu.org ([208.118.235.92]:35466) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SWXXY-0006KP-AM for qemu-devel@nongnu.org; Mon, 21 May 2012 14:41:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SWXXW-0002Kk-9W for qemu-devel@nongnu.org; Mon, 21 May 2012 14:41:07 -0400 Received: from mx.meyering.net ([88.168.87.75]:58095) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SWXXW-0002KO-2j for qemu-devel@nongnu.org; Mon, 21 May 2012 14:41:06 -0400 From: Jim Meyering In-Reply-To: (Blue Swirl's message of "Mon, 21 May 2012 18:34:31 +0000") References: <1337594591-19309-1-git-send-email-jim@meyering.net> <87ehqdl81g.fsf@rho.meyering.net> Date: Mon, 21 May 2012 20:41:03 +0200 Message-ID: <877gw5l6m8.fsf@rho.meyering.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 0/3] tighten scope of accidentally global variables List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Blue Swirl Cc: qemu-devel@nongnu.org Blue Swirl wrote: > On Mon, May 21, 2012 at 6:10 PM, Jim Meyering wrote: >> Blue Swirl wrote: >>> On Mon, May 21, 2012 at 10:03 AM, Jim Meyering wrote: >>>> From: Jim Meyering >>>> >>>> I noticed this commit, >>>> >>>> =A0 =A0virtio-pci: add missing 'static' >>>> >>>> which made this change: >>>> >>>> =A0 =A0> -const MemoryRegionPortio virtio_portio[] =3D { >>>> =A0 =A0> +static const MemoryRegionPortio virtio_portio[] =3D { >>>> >>>> and wondered if there were other variables like that. >>>> The following command shows that there are: >>>> [note that there are probably more: this finds only those >>>> =A0for which the variable name appears in only one source file. ] >>> >>> Also, only for files at the top level. >> >> Thanks. =A0There were so many .o files, I assumed that all were at the t= op. >> Searching all .o files, I found many more: >> >> =A0$ for i in $(nm -e $(find . -name '*.o')|sed -n 's/.* [BCDGRS] //p'|s= ort -u);\ >> =A0 =A0do test $(git grep -lw $i|wc -l) =3D 1 && echo $i;done > > How about just checking the executables (*-softmmu/qemu-system-xyz and > linux-user/qemu-xyz)? If I understood what you suggest, that would seem to miss only "test_image": (README-scope-vars is the result of the one above using find and *.o) $ for i in $(nm -e *-softmmu/qemu-system-* linux-user/qemu-*|sed -n 's/.* [= BCDGRS] //p'|sort -u); do test $(git grep -lw $i|wc -l) =3D 1 && echo $i;do= ne > k nm: linux-user/qemu-types.h: File format not recognized [Exit 1] $ diff -u k README-scope-vars --- k 2012-05-21 20:38:15.912149444 +0200 +++ README-scope-vars 2012-05-21 20:12:13.270023293 +0200 @@ -53,6 +62,7 @@ rtas_next s390_virtio_bus_info sh_table special_register_prefix +test_image timers_state v9fs_synth_root virtcon_hds