Received: from eggs.gnu.org ([208.118.235.92]:57820) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SWX3o-0006Hv-Aj for qemu-devel@nongnu.org; Mon, 21 May 2012 14:10:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SWX3m-0000uP-6R for qemu-devel@nongnu.org; Mon, 21 May 2012 14:10:23 -0400 Received: from mx.meyering.net ([88.168.87.75]:58013) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SWX3l-0000tw-Tr for qemu-devel@nongnu.org; Mon, 21 May 2012 14:10:22 -0400 From: Jim Meyering In-Reply-To: (Blue Swirl's message of "Mon, 21 May 2012 17:51:39 +0000") References: <1337594591-19309-1-git-send-email-jim@meyering.net> Date: Mon, 21 May 2012 20:10:19 +0200 Message-ID: <87ehqdl81g.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 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. There were so many .o files, I assumed that all were at the top. Searching all .o files, I found many more: $ for i in $(nm -e $(find . -name '*.o')|sed -n 's/.* [BCDGRS] //p'|sort = -u);\ do test $(git grep -lw $i|wc -l) =3D 1 && echo $i;done BlockDeviceIoStatus_lookup DEFAULT_ATR SpiceQueryMouseMode_lookup __jit_debug_descriptor alpha_num_opcodes alpha_num_operands alpha_opcodes alpha_operands arg_table backend_enum_table bdrv_sheepdog bfd_mips_num_builtin_opcodes bfd_mips_num_opcodes bonito_state check_cpuid cris_cond15s cris_cores device_configs display_remote enforce_cpuid floatformat_arm_ext_big floatformat_arm_ext_littlebyte_bigword floatformat_i387_ext floatformat_i960_ext floatformat_ia64_quad_big floatformat_ia64_quad_little floatformat_ia64_spill_big floatformat_ia64_spill_little floatformat_ieee_double_big floatformat_ieee_double_little floatformat_ieee_double_littlebyte_bigword floatformat_ieee_single_big floatformat_ieee_single_little floatformat_m68881_ext floatformat_m88110_ext floatformat_m88110_harris_ext fsl_register_prefix fw_boot_order last_mapping_addr last_mapping_sym last_type leon3_generic_machine m68k_numaliases m68k_numopcodes m68k_opcode_aliases m68k_opcodes memory_region_transaction_depth mips_builtin_opcodes mips_fulong2e_machine mips_opcodes no_reboot num_powerpc_operands para_features powerpc_macros powerpc_num_macros powerpc_num_opcodes powerpc_operands pvr_register_prefix qemu_boot_opts qemu_global_mutex qemu_option_rom_opts register_prefix rtas_next s390_virtio_bus_info sh_table special_register_prefix test_image timers_state v9fs_synth_root virtcon_hds vmstate_bmdma_status vmstate_info_scsi_requests vmstate_rxtx_stats xen_platform_ioport xen_xcg > What about functions? ;-) I planned to check them separately, as I do in gnulib's sc_tight_scope syntax-check rule: http://git.sv.gnu.org/cgit/gnulib.git/tree/top/maint.mk#n1443