From: Tim Deegan Subject: Re: [PATCH] RFC: Make xen's public headers a little friendlier for C++. Date: Thu, 26 Feb 2015 16:22:36 +0100 Message-ID: <20150226152236.GE43832@deinos.phlegethon.org> References: <1424956264-15271-1-git-send-email-tim@xen.org> <54EF3721020000780006419A@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <54EF3721020000780006419A@mail.emea.novell.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: Jan Beulich Cc: xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org At 14:09 +0000 on 26 Feb (1424956161), Jan Beulich wrote: > >>> On 26.02.15 at 14:11, wrote: > > -headers.chk: $(filter-out public/arch-% public/%ctl.h public/xsm/% public/%hvm/save.h, $(wildcard public/*.h public/*/*.h) $(public-y)) Makefile > > +PUBLIC_HEADERS_TO_CHECK := $(filter-out public/arch-% public/%ctl.h public/xsm/% public/%hvm/save.h, $(wildcard public/*.h public/*/*.h) $(public-y)) > > + > > +headers.chk: $(PUBLIC_HEADERS_TO_CHECK) Makefile > > for i in $(filter %.h,$^); do $(CC) -ansi -include stdint.h -Wall -W -Werror -S -o /dev/null -x c $$i || exit 1; echo $$i; done >$@.new > > mv $@.new $@ > > > > +headers++.chk: $(PUBLIC_HEADERS_TO_CHECK) Makefile > > ... I don't think limiting this to a subset of the headers is the right > thing here: C++ consumers are (most likely) going to be user space, > i.e. tools, and those would want to be able to use those excluded > headers. OK. I'll have a look through that list. I presume I'll still want to exclude e.g. the arch/ headers on the grounds that users shouldn't be including them directly (and we won't want cross-arch includes)? If I'm extending this to cover more headers than the ANSI-C check does, should I also relax the '-ansi' requirement to, e.g. '-std=gnu++98'? > > + if g++ -v >/dev/null; then for i in $(filter %.h,$^); do g++ -ansi -include stdint.h -Wall -W -Werror -S -o /dev/null -x c++ -Dprivate=private_is_a_keyword_in_c_plus_plus $$i || exit 1; echo $$i; done ; fi >$@.new > > You may want to define __XEN_TOOLS__ (and un-define __XEN__) > here. OK. I wonder how many more things will break when I do that. :) > Also g++ ought to by abstracted to $(CXX) Sure, I'll define up $(CXX) in StdGnu.mk. > and I don't see > how this step is being avoided when there's no C++ compiler there. if g++ isn't on the path, 'g++ -v' fails and we end up with an empty headers++.chk file. It doesn't deal with a present-but-broken g++ but that way lies autoconf. > > --- a/xen/include/public/platform.h > > +++ b/xen/include/public/platform.h > > These changes went in a few minutes ago. Good-oh; I'll drop them from a v2. Tim.