[GCC-XML] Encoding of init values

Brad King brad.king at kitware.com
Fri Feb 18 14:35:22 EST 2005


Thomas Heller wrote:
> If the init value starts with a '0' character, it is a hex value.  If
> the init value start with another digit, it's a decimal value.  If it
> starts with ", it's a string.  If it starts with ', it's a character.
> If the string *type* is 'wchar_t *', the init value seems to be a utf-16
> encoded string, with an additional NUL byte appended:
> 
> (source file)
> #define SERVICES_ACTIVE_DATABASEW      L"ServicesActive"
> 
> (xml output)
> <Variable id="_5456"
>  name="ACCESS_DS_SOURCE_W"
>  type="_14999" init=""D\000S\000\000""
>  context="_1" location="f0:4283" file="f0" line="4283"/>
> 
> Is this interpretation basically correct?

It looks reasonable.  I've never decoded it.

> While I have your attention, please allow another question.
> 
> (source file)
> typedef void * HANDLE;
> extern HANDLE GetModuleHandleA(HANDLE);
[snip]
> So, the xml file refers to HANDLE with id="_5", and to 'void *' with
> id="_4".  So, it looks like the function would have been declared as
> 
> typedef void * HANDLE;
> extern HANDLE GetModuleHandleA(void *);
> 
> 
> Could this be fixed somehow?

This is a common problem.  Basically GCC has thrown out the information 
for function arguments before GCC-XML gets it.  It can't be fixed 
without hacking GCC, and I suspect it is a non-trivial change.

-Brad



More information about the gccxml mailing list