From: Tim Deegan Subject: Re: [PATCH 3/3] xen: Add stdbool.h workaround for BSD. Date: Mon, 19 Aug 2013 15:16:10 +0100 Message-ID: <20130819141610.GA7622@ocelot.phlegethon.org> References: <1376573107-27249-1-git-send-email-tim@xen.org> <1376573107-27249-4-git-send-email-tim@xen.org> <21010.8759.61363.665860@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <21010.8759.61363.665860@mariner.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Jackson Cc: keir@xen.org, ian.campbell@citrix.com, chegger@amazon.de, xen-devel@lists.xen.org, prlw1@cam.ac.uk, stefano.stabellini@citrix.com, jbeulich@suse.com List-Id: xen-devel@lists.xenproject.org At 14:48 +0100 on 19 Aug (1376923719), Ian Jackson wrote: > Tim Deegan writes ("[PATCH 3/3] xen: Add stdbool.h workaround for BSD."): > > On *BSD, stdbool.h lives in /usr/include, but we don't want to have > > that on the search path in case we pick up any headers from the build > > host's C libraries. > > > > Copy the equivalent hack already in place for stdarg.h: on all > > supported compilers the contents of stdbool.h are trivial, so just > > supply the things we need in a xen/stdbool.h header. > > Acked-by: Ian Jackson > > The only alternative is to try to reconstruct the compiler-specific > include directory using gcc --print-libgcc-file-name and seddery. Sadly, not even that. In these BSD systems, the compiler's headers and libraries are bundled in with the rest of the system libraries, e.g.: ocelot:tjd$ gcc --print-libgcc-file-name /usr/lib/libgcc.a so it would be a matter of finding the headers we want in /usr/include and pulling on that string to grab all the headers they #include, and copying them somewhere on the Xen build's include path. Something like: ocelot:tjd$ gcc -E -include stdarg.h -x c /dev/null | grep '^# 1 "/usr' # 1 "/usr/include/stdarg.h" 1 3 4 # 1 "/usr/include/sys/cdefs.h" 1 3 4 # 1 "/usr/include/sys/_types.h" 1 3 4 # 1 "/usr/include/machine/_types.h" 1 3 4 Bleah. :( I don't feel too bad about just defining up the bits of stdarg and stdbool that we need; after all we do that for a bunch of other compiler-specific things. Another approach would be to put those definitions into compiler.h and stop including the compiler's headers altogether, even on linux -- after all we don't link against libgcc.a either. Tim.