[CastXML] gccxml replacement wrapper?

Brad King brad.king at kitware.com
Thu Jul 23 10:43:54 EDT 2015


On 07/23/2015 10:00 AM, Steve M. Robbins wrote:
> into Debian and all architectures are building.

Great, thanks for packaging CastXML!

> the work begins to update packages that currently build using gccxml. 

ITK has been natively ported to CastXML.

What other packages use gccxml?

> GCC 5 is becoming the default compiler next week and gccxml doesn't support 
> it.  I'm assuming castxml does ... though to be honest, I didn't test)

Yes, CastXML should support gcc 5.  I just tested locally with
g++-5 5.1.1-14 on amd64 and it appears to work, though I did
not build anything "real" using it.

> In response Andreas Tille proposed:
>> To my opinion it would be great if castxml could provide a wrapper
>> script /usr/bin/gccxml that does the syntax translation above.
> 
> I've attached Andreas' wrapper for your comments.  Are there any "gotchas" 
> with this approach that come to mind?  

See below.

> To be extra-paranoid, I'd probably also check for any of the GCCXML_* 
> environment variables and error out if any are set

Yes, good idea.

> if [ $# -ne 2 ] ; then
>         echo "Usage: `basename $0` input_file.cc -fxml=output_file.xml"
[snip]
> castxml --castxml-gccxml "$1" -o "$output"

This only supports the most basic use case but gccxml and castxml
can be given many options like -I and -D that need to be honored.
There are a few --gccxml-* options that may or may not need to be
mapped.  For now I suggest error on them.  Pass all other options
through to castxml while translating

 -fxml=<file>        ==>  --castxml-gccxml -o <file>
 -fxml-start=<decl>  ==>  --castxml-start <decl>

You could also respond to --help with a message that this is a
wrapper script for Debian packaging.  More option mapping, like

 --gccxml-compiler <cc>    \
                            > --castxml-cc-gnu '(' <cc> <flags> ')'
 --gccxml-cxxflags <flags> /

could be added later if necessary.

-Brad



More information about the CastXML mailing list