[GCC-XML]Function args

James Michael DuPont mdupont777 at yahoo.com
Wed Sep 11 02:22:07 EDT 2002

--- Brad King <brad.king at kitware.com> wrote:
> > void Read_Time_Int (long unsigned int *upper_rtc, long unsigned int
> > *lower_rtc);
> [snip]
> > This is similar to my last posting but still...
> > We seemed to have lost the Argument names for the function...
> The argument names are not part of the function type:
> void (*)(int x)
> is the same as
> void (*)(int y)
> GCC-XML dumps only one node for each unique type.  Therefore, the
> argument
> names cannot be included, or it would conflict if more than one had
> the
> same type.
Thats right.

let me add some more details, if I may.

The Identifier nodes are stored in the name field of the parameter
objects. The function decls which has a list of param_decls.

As brad said, you can have many decls for one type, lots of older
modules have decls for common functions lying around.

The function type just contains a list of the types in the parmeters,
not the param_decls. This is a big difference.

When you have an forward/external function type, like in the type of a
parameter to some other function, the compiler might just discard the
parameters names. They done matters, because the function (that is
pointed to) is not declared here, just referenced as a type.

Even if you a declaring a real function that takes a parameter of a
function pointer, the  parmeter names have no meaning in the caller

You dont need to know the names of a parameter to call the function,
just the number of and types of parameters.  And therefore it does not
matter at all what the name are.

You know that you can define the entire struct that contains  other
function pointers as the parameter. 
You can even forward_decl a function or external decl a function
pointer and define an entire object hierachy in such a way.

Very nasty stuff.

The objstack is a nasty example in the compiler itself. In that case,
the types are complex and could be hard to dump. The protoize tool is
quite interesting and handles alot of cases. I dont have time right now
but will look into this some day.

So, I would say that you only need the parameter names inside of
function decl of the body of the function. If you find that body, you
can link them togeather yourself. If you dont have it you don't need


James Michael DuPont

Yahoo! - We Remember
9-11: A tribute to the more than 3,000 lives lost

More information about the gccxml mailing list