From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39038) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c6fDj-0006xS-Gp for qemu-devel@nongnu.org; Tue, 15 Nov 2016 10:00:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c6fDf-0002w3-Lx for qemu-devel@nongnu.org; Tue, 15 Nov 2016 10:00:23 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38942) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c6fDf-0002um-Fv for qemu-devel@nongnu.org; Tue, 15 Nov 2016 10:00:19 -0500 Date: Tue, 15 Nov 2016 23:00:16 +0800 From: Fam Zheng Message-ID: <20161115150016.GD9226@lemon> References: <1478566785-4002-2-git-send-email-ashish.mittal@veritas.com> <20161114150701.GD26198@stefanha-x1.localdomain> <20161114154906.GC2373@lemon> <20161114165034.GA1352@stefanha-x1.localdomain> <20161114180359.GA24217@lemon> <20161115020405.GB9226@lemon> <20161115101850.GA4836@stefanha-x1.localdomain> <20161115124417.GC9226@lemon> <20161115144551.GB17672@stefanha-x1.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161115144551.GB17672@stefanha-x1.localdomain> Subject: Re: [Qemu-devel] [PATCH v6 1/2] block/vxhs.c: Add support for a new block device type called "vxhs" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Peter Maydell , Eric Blake , kwolf@redhat.com, Venkatesha.Mg@veritas.com, ashish.mittal@veritas.com, jcody@redhat.com, qemu-devel@nongnu.org, Rakesh.Ranjan@veritas.com, armbru@redhat.com, Ketan.Nilangekar@veritas.com, Abhijit.Dey@veritas.com, pbonzini@redhat.com, Buddhi.Madhav@veritas.com, Ashish Mittal On Tue, 11/15 14:45, Stefan Hajnoczi wrote: > On Tue, Nov 15, 2016 at 08:44:17PM +0800, Fam Zheng wrote: > > On Tue, 11/15 10:18, Stefan Hajnoczi wrote: > > > Fam, Markus: Unfortunately neither the clean-includes script nor its > > > patch series cover letter explains *why* osdep.h should be included > > > before system headers. > > > > I don't know Peter's exact intention either, but AFAICT it is about the few > > quirks in osdep.h: > > > > > > /* Older versions of C++ don't get definitions of various macros from > > * stdlib.h unless we define these macros before first inclusion of > > * that system header. > > */ > > #ifndef __STDC_CONSTANT_MACROS > > #define __STDC_CONSTANT_MACROS > > #endif > > #ifndef __STDC_LIMIT_MACROS > > #define __STDC_LIMIT_MACROS > > #endif > > #ifndef __STDC_FORMAT_MACROS > > #define __STDC_FORMAT_MACROS > > #endif > > > > /* The following block of code temporarily renames the daemon() function so the > > * compiler does not see the warning associated with it in stdlib.h on OSX > > */ > > #ifdef __APPLE__ > > #define daemon qemu_fake_daemon_function > > #include > > #undef daemon > > extern int daemon(int, int); > > #endif > > > > <...> > > > > > > /* Mac OSX has a bug that incorrectly defines SIZE_MAX with > > * the wrong type. Our replacement isn't usable in preprocessor > > * expressions, but it is sufficient for our needs. */ > > #if defined(HAVE_BROKEN_SIZE_MAX) && HAVE_BROKEN_SIZE_MAX > > #undef SIZE_MAX > > #define SIZE_MAX ((size_t)-1) > > #endif > > This is exactly the kind of stuff we should not be doing to the libqnio > header file! > > Those redefinitions are useful for QEMU code. They should not be done > to third-party system headers though. But we still want to include osdep.h before libqnio pulls in stdint.h. If we don't make osdep.h the very first, that cannot be guaranteed. Fam