From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48545) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZL9pJ-00010n-BR for qemu-devel@nongnu.org; Fri, 31 Jul 2015 08:54:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZL9pG-00025L-54 for qemu-devel@nongnu.org; Fri, 31 Jul 2015 08:54:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37223) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZL9pG-00025C-02 for qemu-devel@nongnu.org; Fri, 31 Jul 2015 08:54:14 -0400 Date: Fri, 31 Jul 2015 13:54:09 +0100 From: "Daniel P. Berrange" Message-ID: <20150731125409.GO2392@redhat.com> References: <1437583451-9677-1-git-send-email-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1437583451-9677-1-git-send-email-peter.maydell@linaro.org> Subject: Re: [Qemu-devel] [PATCH 00/12] qemu-common.h/osdep.h refactoring Reply-To: "Daniel P. Berrange" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: qemu-devel@nongnu.org, patches@linaro.org On Wed, Jul 22, 2015 at 05:43:59PM +0100, Peter Maydell wrote: > This series makes a start at cleaning up some of our headers > to avoid the common problem of header files including qemu-common.h > (which then in turn can lead to awkward circular includes). > > One common cause of this is that we don't have any header > which will include the basic things most header files require, > except for qemu-common.h. This series fixes that by making > 'osdep.h' that "common basic stuff" header. The idea is that: > * osdep.h can be included from anywhere, since it doesn't > include any other QEMU headers itself except a few very > restricted special purpose ones (config-host.h, compiler.h, etc) > * osdep.h provides: > + things everybody needs, like NULL, int32_t, container_of, > the CONFIG_* defines, etc > + things that will cause subtle problems if they're not > present everywhere (eg directly using system headers and > not getting the portability fixups will result in something > that builds on most but not all hosts) > > So most places can just include osdep.h, not the full qemu-common.h. > > (I initially thought about defining a new header for this > purpose, "qemu/basics.h" or some such, but in fact osdep.h > was already very close to what I wanted so it didn't really > seem like it was very useful to switch everything over.) > > The series has some minor cleanups, some shuffling around of > things between qemu-common.h, osdep.h and compiler.h, and > a couple of patches at the end that use osdep.h to allow > dropping a qemu-common.h include from various header files, > as a demonstration. > > The real question here I guess is whether people like the > direction I'm trying to go with this. If so, we can further > reduce the number of qemu-common.h includes without too much > difficulty with further patches. I broadly like the direction of this change. I think it is probably worth being strict about requiring #include of osdep.h as the first header in every .c file. And validating such a rule programmatically at make check time or equiv. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|