Message ID | 1468484058-8719-1-git-send-email-thuth@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 07/14/2016 02:14 AM, Thomas Huth wrote: > No need to include error-report.h twice here. > > Signed-off-by: Thomas Huth <thuth@redhat.com> > --- > target-ppc/mmu-hash64.c | 1 - > 1 file changed, 1 deletion(-) Reviewed-by: Eric Blake <eblake@redhat.com> Markus, do your header cleanup scripts detect any other situations like this? > > diff --git a/target-ppc/mmu-hash64.c b/target-ppc/mmu-hash64.c > index 82c2186..f6ffe35 100644 > --- a/target-ppc/mmu-hash64.c > +++ b/target-ppc/mmu-hash64.c > @@ -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" >
On 14.07.2016 16:32, Eric Blake wrote: > On 07/14/2016 02:14 AM, Thomas Huth wrote: >> No need to include error-report.h twice here. >> >> Signed-off-by: Thomas Huth <thuth@redhat.com> >> --- >> target-ppc/mmu-hash64.c | 1 - >> 1 file changed, 1 deletion(-) > > Reviewed-by: Eric Blake <eblake@redhat.com> > > 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
Eric Blake <eblake@redhat.com> writes: > On 07/14/2016 02:14 AM, Thomas Huth wrote: >> No need to include error-report.h twice here. >> >> Signed-off-by: Thomas Huth <thuth@redhat.com> >> --- >> target-ppc/mmu-hash64.c | 1 - >> 1 file changed, 1 deletion(-) > > Reviewed-by: Eric Blake <eblake@redhat.com> > > 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.
diff --git a/target-ppc/mmu-hash64.c b/target-ppc/mmu-hash64.c index 82c2186..f6ffe35 100644 --- a/target-ppc/mmu-hash64.c +++ b/target-ppc/mmu-hash64.c @@ -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"
No need to include error-report.h twice here. Signed-off-by: Thomas Huth <thuth@redhat.com> --- target-ppc/mmu-hash64.c | 1 - 1 file changed, 1 deletion(-)