[GCC-XML] feature request: preprocessor output
Brad King
brad.king at kitware.com
Wed Mar 26 15:50:59 EDT 2008
Francesco Montorsi wrote:
> Hi,
> I'm using gccxml with success for the wxWidgets project.
>
> One thing I'd like to have in the XML output is the preprocessor
> internal "substitution table".
>
> I.e. if the C++ source I fetch to gccxml contains
>
>
> #define DEFAULT_VALUE_FOR_UTILITY "something"
> void utility(const char* whatsup = DEFAULT_VALUE_FOR_UTILITY);
>
>
> in the XML output I see the definition of a function called "utility"
> which takes a "const char*" argument with a default value "something"
> (and not DEFAULT_VALUE_FOR_UTILITY).
>
> I'd like in some way to know that the default value for utility() is the
> DEFAULT_VALUE_FOR_UTILITY symbol rather than the value to which
> DEFAULT_VALUE_FOR_UTILITY is defined.
>
> Modifying the sources (e.g. to use enums instead of defines)
> unfortunately is not an option... I think that if gccxml could output
> the "table" of the preprocessor, I would have solved my problems.
>
> Is it difficult to add this feature?
> Is someone working on it?
> Would you accept a patch which adds a new option to gccxml to add in the
> XML output such internal "table"? If so, where should I start to look to
> implement such feature?
It is not possible to add this feature. The xml dump is implemented
inside a patched GCC parser. All preprocessing is long since over
before the parser even sees it. There is no record left of how the code
was produced from the preprocessor.
The feature is fairly ill-defined anyway. Consider
#define DECL(x,y) \
void x(const char* whatsup = y);
DECL(utility, "something");
Until the preprocessor is done this makes no sense.
-Brad
More information about the gccxml
mailing list