qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
Cc: Cornelia Huck <cohuck@redhat.com>, Thomas Huth <thuth@redhat.com>,
	"qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>,
	QEMU Trivial <qemu-trivial@nongnu.org>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Richard Henderson <rth@twiddle.net>,
	Eduardo Habkost <ehabkost@redhat.com>,
	Marcel Apfelbaum <marcel.apfelbaum@gmail.com>,
	Peter Maydell <peter.maydell@linaro.org>,
	"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
	Michael Walle <michael@walle.cc>,
	Laurent Vivier <laurent@vivier.eu>,
	Anthony Green <green@moxielogic.com>,
	Stafford Horne <shorne@gmail.com>,
	David Gibson <david@gibson.dropbear.id.au>,
	Alexander Graf <agraf@suse.de>,
	David Hildenbrand <david@redhat.com>,
	Max Filippov <jcmvbkbc@gmail.com>,
	"open list:ARM" <qemu-arm@nongnu.org>,
	"open list:PowerPC" <qemu-ppc@nongnu.org>,
	"open list:S390" <qemu-s390x@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH v4 09/21] target: Do not include "exec/exec-all.h" if it is not necessary
Date: Wed, 30 May 2018 15:55:12 +0300	[thread overview]
Message-ID: <20180530155301-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <CAAdtpL6eW5=djFE-k7bHUR6s_b=wAmMuOLM8Djb_CYPf54L8CA@mail.gmail.com>

On Wed, May 30, 2018 at 03:19:19AM -0300, Philippe Mathieu-Daudé wrote:
> Le mer. 30 mai 2018 02:50, Philippe Mathieu-Daudé <f4bug@amsat.org> a écrit :
> 
>     On Wed, May 30, 2018 at 1:42 AM, Michael S. Tsirkin <mst@redhat.com> wrote:
>     > On Wed, May 30, 2018 at 12:12:55AM -0300, Philippe Mathieu-Daudé wrote:
>     >> Hi Cornelia,
>     >>
>     >> On 05/29/2018 08:40 AM, Cornelia Huck wrote:
>     >> > On Mon, 28 May 2018 20:27:07 -0300
>     >> > Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>     >> >
>     >> >> Code change produced with:
>     >> >>     $ git grep '#include "exec/exec-all.h"' | \
>     >> >>       cut -d: -f-1 | \
>     >> >>       xargs egrep -L "(cpu_address_space_init|cpu_loop_|tlb_|tb_|
>     GETPC|singlestep|TranslationBlock)" | \
>     >> >
>     >> > Hm, does this expression catch all files that need to include
>     >> > exec-all.h? The resulting patch seems fine, though.
>     >>
>     >> No, not all :/
>     >> I started with "(cpu_loop_|tlb_|tb_)" then kept brutebuilding until no
>     >> more errors appear. In 2 more steps I added "cpu_address_space_init|"
>     >> then "|GETPC|singlestep|TranslationBlock". Quick and dirty enough for my
>     >> goal than trying to build a regex to explode function/struct names from
>     >> headers. This is a clever way to do it for long term command reuse taken
>     >> from commit messages...
>     >
>     > Brutebuilding isn't a good way to find unused includes, some other header
>     > might pull in an include you are trying to remove for its own purposes.
>     > If you want to try brutebuilding you must also verify that's
>     > not the case - e.g. look at the dependency file generated.
> 
> 
> I think I get it for headers, but here I'm only modifying .c source files. 

Same thing - if you call a function from a header, you should include
that header even if some other header happens to pull it in.
Otherwise someone might cleanup that other header and suddenly
your build breaks.



> I'll restrict the shell command to .c 

I don't think it matters.

> 
> 
>     Hmm you mean the .d files in the build dir?
> 
>     i.e.
>     $ find lm32-softmmu -name \*.d -exec fgrep -L exec-all.h {} \; | sed
>     -e 's/.*-softmmu\/\(.*\)d$/\1c/'
>     dump.c
>     numa.c
>     tcg/tcg-common.c
>     tcg/optimize.c
>     tcg/tcg-op-gvec.c
>     tcg/tcg-op-vec.c
>     accel/tcg/tcg-runtime-gvec.c
>     accel/tcg/tcg-all.c
>     accel/accel.c
>     accel/stubs/whpx-stub.c
>     accel/stubs/hvf-stub.c
>     accel/stubs/kvm-stub.c
>     accel/stubs/hax-stub.c
>     hw/lm32/milkymist.c
>     hw/lm32/lm32_boards.c
>     hw/core/generic-loader.c
>     ...
> 
>     Then look why each .c included it?
> 
>     >
>     >> >>       xargs sed -i.bak '/#include "exec\/exec-all.h"/d'
>     >> >>
>     >> >> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> 

  reply	other threads:[~2018-05-30 12:55 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-28 23:26 [Qemu-devel] [PATCH v4 00/21] Includes cleanup Philippe Mathieu-Daudé
2018-05-28 23:26 ` [Qemu-devel] [PATCH v4 01/21] vfio: Include "exec/address-spaces.h" directly in the source file Philippe Mathieu-Daudé
2018-05-28 23:48   ` Alex Williamson
2018-05-29  0:06     ` Michael S. Tsirkin
2018-05-29  0:36       ` Philippe Mathieu-Daudé
2018-05-29  9:53         ` Cornelia Huck
2018-05-29 10:45           ` Paolo Bonzini
2018-05-29 13:09             ` Alex Williamson
2018-05-28 23:27 ` [Qemu-devel] [PATCH v4 02/21] accel: Do not include "exec/address-spaces.h" if it is not necessary Philippe Mathieu-Daudé
2018-05-28 23:27 ` [Qemu-devel] [PATCH v4 03/21] target: " Philippe Mathieu-Daudé
2018-05-29 10:05   ` Cornelia Huck
2018-05-28 23:27 ` [Qemu-devel] [PATCH v4 04/21] memory: Do not include "exec/ioport.h" " Philippe Mathieu-Daudé
2018-05-28 23:27 ` [Qemu-devel] [PATCH v4 05/21] target/i386: " Philippe Mathieu-Daudé
2018-05-28 23:27 ` [Qemu-devel] [PATCH v4 06/21] target/xtensa: Include "qemu/timer.h" to use NANOSECONDS_PER_SECOND Philippe Mathieu-Daudé
2018-05-28 23:27 ` [Qemu-devel] [PATCH v4 07/21] target/ppc: Include "exec/exec-all.h" which provides tlb_flush() Philippe Mathieu-Daudé
2018-05-28 23:27 ` [Qemu-devel] [PATCH v4 08/21] target/hppa: Include "qemu/log.h" to use qemu_log() Philippe Mathieu-Daudé
2018-05-28 23:27 ` [Qemu-devel] [PATCH v4 09/21] target: Do not include "exec/exec-all.h" if it is not necessary Philippe Mathieu-Daudé
2018-05-29 11:40   ` Cornelia Huck
2018-05-30  3:12     ` Philippe Mathieu-Daudé
2018-05-30  4:42       ` Michael S. Tsirkin
2018-05-30  5:50         ` Philippe Mathieu-Daudé
2018-05-30  6:19           ` Philippe Mathieu-Daudé
2018-05-30 12:55             ` Michael S. Tsirkin [this message]
2018-05-30  9:32           ` Paolo Bonzini
2018-05-30 10:12   ` Cornelia Huck
2018-05-28 23:27 ` [Qemu-devel] [PATCH v4 10/21] hw: Do not include "exec/ioport.h" " Philippe Mathieu-Daudé
2018-05-29  7:59   ` Marcel Apfelbaum
2018-05-28 23:27 ` [Qemu-devel] [PATCH v4 11/21] hw: Do not include "exec/address-spaces.h" " Philippe Mathieu-Daudé
2018-05-28 23:27 ` [Qemu-devel] [PATCH v4 12/21] hw: Do not include "sysemu/block-backend.h" " Philippe Mathieu-Daudé
2018-05-29 10:14   ` Cornelia Huck
2018-05-28 23:27 ` [Qemu-devel] [PATCH v4 13/21] hw: Do not include "sysemu/blockdev.h" " Philippe Mathieu-Daudé
2018-05-28 23:27 ` [Qemu-devel] [PATCH v4 14/21] " Philippe Mathieu-Daudé
2018-05-29 11:03   ` Cornelia Huck
2018-05-28 23:27 ` [Qemu-devel] [PATCH v4 15/21] hw/block/nvme: Include "qemu/cutils.h" directly in the source file Philippe Mathieu-Daudé
2018-05-29  0:42   ` Philippe Mathieu-Daudé
2018-05-28 23:27 ` [Qemu-devel] [PATCH v4 16/21] hw/misc/mips_itu: Cleanup includes Philippe Mathieu-Daudé
2018-05-28 23:27 ` [Qemu-devel] [PATCH v4 17/21] hw/misc/sga: Use the correct ISA include Philippe Mathieu-Daudé
2018-05-29  7:58   ` Marcel Apfelbaum
2018-05-28 23:27 ` [Qemu-devel] [PATCH v4 18/21] hw/hppa: Remove unused include Philippe Mathieu-Daudé
2018-05-29 11:27   ` Thomas Huth
2018-05-28 23:27 ` [Qemu-devel] [PATCH v4 19/21] hw/i386/pc: " Philippe Mathieu-Daudé
2018-05-29  7:58   ` Marcel Apfelbaum
2018-05-28 23:27 ` [Qemu-devel] [PATCH v4 20/21] hw/ide: " Philippe Mathieu-Daudé
2018-05-29 11:35   ` Thomas Huth
2018-05-30 20:29   ` John Snow
2018-05-28 23:27 ` [Qemu-devel] [PATCH v4 21/21] hw: Clean "hw/devices.h" includes Philippe Mathieu-Daudé
2018-05-29  0:07 ` [Qemu-devel] [PATCH v4 00/21] Includes cleanup Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180530155301-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=agraf@suse.de \
    --cc=cohuck@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=david@redhat.com \
    --cc=edgar.iglesias@gmail.com \
    --cc=ehabkost@redhat.com \
    --cc=f4bug@amsat.org \
    --cc=green@moxielogic.com \
    --cc=jcmvbkbc@gmail.com \
    --cc=laurent@vivier.eu \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=michael@walle.cc \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=shorne@gmail.com \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).