Skip to contentSkip to conversation

ppc/mmu-hash64: Remove duplicated #include statement

PATCH In review Thomas Huth 3 participants 4 messages Jul 14, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ppc/mmu-hash64: Remove duplicated #include statement

No need to include error-report.h twice here.

---
 target-ppc/mmu-hash64.c | 1 -
 1 file changed, 1 deletion(-)
target-ppc/mmu-hash64.c +0 -1
index 82c2186..f6ffe35 100644
@@ -24,7 +24,6 @@
 #include "exec/helper-proto.h"
 #include "qemu/error-report.h"
 #include "sysemu/kvm.h"
-#include "qemu/error-report.h"
 #include "kvm_ppc.h"
 #include "mmu-hash64.h"
 #include "exec/log.h"
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Thomas Huth

No need to include error-report.h twice here.

---
 target-ppc/mmu-hash64.c | 1 -
 1 file changed, 1 deletion(-)

Markus, do your header cleanup scripts detect any other situations like this?

Quoted 14 lines
target-ppc/mmu-hash64.c +0 -1
index 82c2186..f6ffe35 100644
@@ -24,7 +24,6 @@
 #include "exec/helper-proto.h"
 #include "qemu/error-report.h"
 #include "sysemu/kvm.h"
-#include "qemu/error-report.h"
 #include "kvm_ppc.h"
 #include "mmu-hash64.h"
 #include "exec/log.h"
Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#2 lore raw
Quoted 8 lines · Eric Blake
Quoted 6 lines · Thomas Huth

No need to include error-report.h twice here.

---
 target-ppc/mmu-hash64.c | 1 -
 1 file changed, 1 deletion(-)
Quoted 4 lines

Markus, do your header cleanup scripts detect any other situations like this?

There are indeed other files that include headers twice. You can get an inaccurate list with following shell magic:

for i in find include/ -name \*.h ; do \

 grep -r '#include.*'`echo -n $i | sed s,include/,,` * \
      | sed s/:.*$// | sort > /tmp/dups1.txt ; \
 sort -u </tmp/dups1.txt >/tmp/dups2.txt; \
 DIF=`diff /tmp/dups?.txt | grep '\.[ch]' | tr \< \-` ; \
 if [ "x$DIF" != x ] ; then \
    echo '***' $i '***': ; echo $DIF ; echo; \

fi ; \
done

Note that there are also valid cases where a file is including a header multiple times (e.g. the way include/exec/cpu_ldst.h is including cpu_ldst_template.h multiple times), so there are also false-positives in this list.

But for the others ... feel free to send some patches ;-)

Thomas

#3 lore raw
In reply to Eric Blake
Quoted 8 lines · Eric Blake
Quoted 6 lines · Thomas Huth

No need to include error-report.h twice here.

---
 target-ppc/mmu-hash64.c | 1 -
 1 file changed, 1 deletion(-)
Quoted 4 lines

Markus, do your header cleanup scripts detect any other situations like this?

Not yet.

Here's how I'd eliminate double inclusion. Step 1: make our own headers includable in any order. Step 2: include them in alphabetical order. The duplicates become obvious, and get dropped. Step 3: tell the lazy bums adding includes in the wrong place to mend their ways.

I'm knee-deep in step 1.