[aspectc-user] Compiler Error - Related Error being fixed in (Version 1.0pre1: 10/2005)?

Olaf Spinczyk Olaf.Spinczyk at informatik.uni-erlangen.de
Wed Oct 19 09:24:39 CEST 2005


Hi John,

there is no general problem with around/call and before/execution advice 
for the same function. I tried the following example without any 
problems (version 0.9.3):

--
void f1 () {
}

void f2 () {
   f1 ();
}

int main () {
   f2 ();
}

aspect Foo {
   advice call("% f1(...)") && within("% f2(...)") : around() {
     tjp->proceed ();
     printf ("after\n");
   }
   advice execution("% f1(...)") : before() {
     printf ("before\n");
   }
};
--

What is the difference between your code and this test program? Are any 
recursive functions involved? Is f2() declared in a separate header file 
that does not belong to your project?

The (HUGE) problem with version 0.9.3 is a different one. It is related 
to introductions.

Best regards,

Olaf


John C. Weicher wrote:
> I am running into an odd error during compilation that only crops up 
> when I provide two separate advice calls which affect the same function.
> 
>  
> 
> Simplified scenario exists where there is
> 
>  
> 
> someFunctionA(){
> 
>  
> 
>   //blah blah
> 
>  
> 
>   someFunctionB();
> 
>  
> 
>   //blah blah
> 
> }
> 
>  
> 
> I have already defined an aspect with advice as follows:
> 
>  
> 
> advice call("% %someFunctionB(...)") && within("% %someFunctionA(...)") 
> : around() {  //blah blah }
> 
>  
> 
> Obviously I am trying to call around function B when called from within 
> A (I do some other stuff, and then let it proceed).  This weaves, 
> parses, compiles and runs beautifully.  I’ve been using this in a 
> working application for some time now.
> 
>  
> 
> A new situation has arisen for me now where in addition to the above 
> (situation is the same, and the previous advice block is also still 
> needed and in place), I ALSO want to define an additional advice block 
> to perform some operations before the execution of function A, done as 
> follows:
> 
>  
> 
> advice execution("% %someFunctionA(...)") : before() {  // blah blah }
> 
>  
> 
> This is causing problems.  Weaving still occurs without error, but when 
> I then try to compile weaved code, I receive the following error 
> (changed the function names to match my fake example above, so it makes 
> sense):
> 
>  
> 
> : In function `int someFunctionA(args args args…)':
> 
> :4: `__exec_old_someFunctionA' undeclared (first use this function)
> 
> :4: (Each undeclared identifier is reported only once for each function it
> 
>    appears in.)
> 
> ./thefile.c: In function `int __exec_old_someFunctionA(args arg args)':
> 
> ./thefile.c:280: `int __exec_old_someFunctionA(args args args)
> 
>    ' used prior to declaration
> 
>  
> 
> And sure enough, when I go into the file the inline definition for 
> __exec_old_someFunctionA is coming after the modified call to it.  But I 
> didn’t think this mattered with inline functions.
> 
>  
> 
> I apologize for the lengthy post, but I am definitely confused.  If I 
> take the new additional advice block back out, everything compiles fine 
> again.
> 
>  
> 
> I also noticed that although that it specifically mentions only classes, 
> this sounds very similar to the issue that is supposed to be fixed in 
> the new release mentioned on the Roadmap page: “fix for the HUGE problem 
> of ac++ 0.9.3 that causes parse errors, when an aspect defines code 
> advice for a class into which it also introduces new functions/members”. 
> 
>  
> 
> Is this the case, and if so is there a workaround in the meantime?
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> 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