[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] RFC: Make xen's public headers a little friendlier for C++.

At 14:09 +0000 on 26 Feb (1424956161), Jan Beulich wrote:
> >>> On 26.02.15 at 14:11, <tim@xxxxxxx> 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.


Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.