Received: from eggs.gnu.org ([209.51.188.92]:36667) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gk3ab-0003D7-IM for qemu-devel@nongnu.org; Thu, 17 Jan 2019 04:03:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gk3aZ-0004Lg-Mx for qemu-devel@nongnu.org; Thu, 17 Jan 2019 04:03:53 -0500 From: Markus Armbruster References: <20190111140857.4211-1-philmd@redhat.com> <20190111140857.4211-4-philmd@redhat.com> <875zuqjea7.fsf@dusky.pond.sub.org> <403ad2e4-3282-051c-1ff5-8a3a23899293@redhat.com> <87sgxtatod.fsf@dusky.pond.sub.org> <4b24723e-5a27-f25f-76c1-f2f4e94757ba@redhat.com> Date: Thu, 17 Jan 2019 10:03:24 +0100 In-Reply-To: <4b24723e-5a27-f25f-76c1-f2f4e94757ba@redhat.com> (Paolo Bonzini's message of "Wed, 16 Jan 2019 11:03:15 +0100") Message-ID: <87ef9b64gz.fsf@dusky.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH 03/15] hw/ssi: Remove SSIBus from "qemu/typedefs.h" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Peter Maydell , Thomas Huth , Alistair Francis , Xiao Guangrong , qemu-block@nongnu.org, Peter Crosthwaite , Laszlo Ersek , "Michael S. Tsirkin" , qemu-devel@nongnu.org, Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Greg Kurz , qemu-arm@nongnu.org, Gerd Hoffmann , Igor Mammedov , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , =?utf-8?Q?C=C3=A9dric?= Le Goater Paolo Bonzini writes: > On 16/01/19 09:33, Markus Armbruster wrote: >> What problem exactly are we trying to solve here? >> To the best of my knowledge, typedefs.h has been working just fine for >> us, and I can't see why it shouldn't continue to work just fine. > > Patches don't have to solve problems. They can just help long-term > maintainability, highlight code smells, etc. Nobody is saying > typedefs.h doesn't work. But it's a tool, and including headers from > headers is also a tool. Each tool has its purpose and it is useful to > question what are the exact purposes of the tools. > > typedefs.h is useful to avoid rebuilding the world too often if a type > is used many times as a pointer, but rarely as a struct and rarely has > functions called on its instances. This is already a relatively rare > case, but here we're talking about files that are included less than 20 > times; many of which also already include hw/ssi/ssi.h for their own > business. So we're hardly rebuilding anything more often, also because > hw/ssi/ssi.h is not really changing fast. > > typedefs.h is also useful to avoid circular header inclusions. Here > hw/ssi/ssi.h is clearly a toplevel include for the SSI subsystem. I > agree that includes in a headers _can_ be painful, but sometimes they > also tell you a hierarchy of what uses what. typedefs.h doesn't; > forward struct declarations also do, and I all but dislike using them in > headers (Thomas, can you send v2 of the HACKING patch?). > > Therefore, typedefs.h is not particularly useful for SSIBus. It doesn't > hurt much, if at all, to leave it in. On the other hand, it also > doesn't hurt much if at all to remove it; it makes the SSI code a very > tiny little bit more self contained. > > It may be that it's not particularly useful just because SSI is small; > for example I2CBus is also in typedefs.h and it's used a lot more, maybe > one day SSIBus will be the same. In doubt, let's drop the patch---but I > think it's useful to have the discussion and there are cases that are > not controversial at all in Philippe's series. I fully agree having the discussion is useful, and I also like many of the patches in Philippe's series.