qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 0/3] tighten scope of accidentally global variab


From: Jim Meyering
Subject: Re: [Qemu-devel] [PATCH 0/3] tighten scope of accidentally global variables
Date: Mon, 21 May 2012 20:41:03 +0200

Blue Swirl wrote:
> On Mon, May 21, 2012 at 6:10 PM, Jim Meyering <address@hidden> wrote:
>> Blue Swirl wrote:
>>> On Mon, May 21, 2012 at 10:03 AM, Jim Meyering <address@hidden> wrote:
>>>> From: Jim Meyering <address@hidden>
>>>>
>>>> I noticed this commit,
>>>>
>>>>    virtio-pci: add missing 'static'
>>>>
>>>> which made this change:
>>>>
>>>>    > -const MemoryRegionPortio virtio_portio[] = {
>>>>    > +static const MemoryRegionPortio virtio_portio[] = {
>>>>
>>>> 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
>>>>  for 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) = 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) = 1 && echo $i;done > 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]