[aspectc-user] Execution advice for variable argument list functions

Olaf Spinczyk os at aspectc.org
Tue May 13 12:43:31 CEST 2008

Hello Stefan,

the bug is not fixed yet. The reason is that it is not very easy to fix it.

The problem is that execution advice is woven by generating a wrapper 
function. Now consider that the intercepted function has a variable 
argument list. In this case the wrapper functions also has a variable 
argument list and needs to pass the arguments to the intercepted 
function. The actual argument types are unknown. The only chance to 
accomplish this is to call va_start and va_end in the wrapper function 
and to pass the va_list object to the intercepted function. This could 
be done by the proceed code as well. However, the intercepted function 
will also create a va_list and uses it to access the arguments. All this 
code would have to be found and removed. It is not impossible but difficult.

BTW, you can turn off the "annoying warnings" if you know what they mean 
and have decided that it is not relevant for you.

Best regards,


Stefan Marr wrote:
> Hello,
> I'm currently using AspectC++ to modularize a C program.
> After some small adjustments it compiles fine with g++ and fortunately 
> even with Ag++ :)
> First, I got some problems with the used macros which emulate object 
> orientation in C with virtual tables and stuff, but now I switched to 
> the latest SVN source of AspectC++ and it work except some annoying 
> warnings, cause the object layout is defined using macros.
> But, now I'm trying to use aspects on functions with variable number 
> of arguments and I got into trouble.
> Have found the following bug report
> http://www.aspectc.org/bugzilla/show_bug.cgi?id=106
> mentioning that execution advices for functions with variable argument 
> lists is not working.
> Is this still true? And if so, would it be easy to fix? If you give me 
> a helping hand I would try to fix this.
> At the moment I would need this feature, since some of the functions 
> we are using have variable argument list and are called through our OO 
> emulation and function pointers in a vtable. Call advices aren't 
> applied there.
> The execution advice seams to be applied in the right place, but the 
> generated code is wrong. Main problem is, that tjp seams to be defined 
> as an "int" and therefore tjp->proceed(); fails.
> Kind Regards
> Stefan Marr
> _______________________________________________
> aspectc-user mailing list
> aspectc-user at aspectc.org
> http://www.aspectc.org/mailman/listinfo/aspectc-user

More information about the aspectc-user mailing list