[aspectc-user] A bug in JoinPoint method generation?

Panu Bloigu panu.bloigu at mbnet.fi
Thu Dec 14 17:04:31 CET 2006


Hello.

I think I have found a bug in the weaver. I have the following two files:

================
File main.cpp
================
template<class TJP> static void no_access(TJP* tjp)
{
tjp->result();
tjp->arg(TJP::ARGS-1); // or tjp->arg(0) or ...
}

int m1(){return 0;}
void m2(int i){}
int main()
{
m1();
m2(1);
return 0;
}

================
File AnAspect.ah
================
#ifndef ANASPECT_AH_
#define ANASPECT_AH_
aspect AnAspect
{
advice execution("int m1()" || "void m2(int)") : around()
{
tjp->proceed();
// tjp->result();
// tjp->arg(JoinPoint::ARGS-1);
no_access(tjp);
}
};
#endif /*ANASPECT_AH_*/

Now the compiler tells me the following:

==============================================================================

**** Incremental build of configuration Debug for project ContextAccess ****

make -k all
Building file: ../main.cpp
Invoking: GCC C++ Compiler
/opt/eclipse-3.1.2/plugins/org.aspectc.compiler.linux_0.9.93/AC/ag++ 
--c_compiler g++ -k -r repo.acp -p .. -c ../main.cpp --Xcompiler -o 
main.o -D_useAC -O0 -g3 -Wall -fmessage-length=0 -I..
../main.cpp: In function ‘void no_access(TJP*) [with TJP = TJP__ZN2m1Ev_0]’:
../AnAspect.ah:10: instantiated from ‘void 
AnAspect::__a0_around(JoinPoint*) [with JoinPoint = TJP__ZN2m1Ev_0]’
main.acc:233: instantiated from ‘void 
AC::invoke_AnAspect_AnAspect_a0_around(JoinPoint*) [with JoinPoint = 
TJP__ZN2m1Ev_0]’
main.acc:107: instantiated from here
../main.cpp:4: error: ‘struct TJP__ZN2m1Ev_0’ has no member named ‘arg’
../main.cpp: In function ‘void no_access(TJP*) [with TJP = TJP__ZN2m2Ei_0]’:
../AnAspect.ah:10: instantiated from ‘void 
AnAspect::__a0_around(JoinPoint*) [with JoinPoint = TJP__ZN2m2Ei_0]’
main.acc:233: instantiated from ‘void 
AC::invoke_AnAspect_AnAspect_a0_around(JoinPoint*) [with JoinPoint = 
TJP__ZN2m2Ei_0]’
main.acc:159: instantiated from here
../main.cpp:3: error: ‘struct TJP__ZN2m2Ei_0’ has no member named ‘result’
error: Execution failed: "g++" -c -xc++ "main.acc" -xnone -I"../" 
-D"_useAC" -O0 -g3 -Wall -fmessage-length=0 -I".." -o "main.o"
make: *** [main.o] Error 1
make: Target `all' not remade because of errors.
Build complete for project ContextAccess
=============================================================================

Obviously the case is that result() is not generated for the structure 
representating the join point at method m2() and respectively arg() is 
not generated for the structure representating the context of m1(). 
However, if I uncomment the two lines in the advice code, compilation 
goes just fine. I guess that all I'm asking is that whether this is a 
bug or not? If it's not a bug, could someone please elaborate a little 
on what's going on here. Of course, one might ask that why do I need 
methods for getting non-existing result/arguments, but in the document 
"Advances in AOP with AspectC++" it is said that tjp->result() should 
return 0 if the function has no return value (I take "no return value" 
meaning that the function is declared as returning void). Or maybe there 
is something wrong with my code that causes this behaviour?


Panu.






More information about the aspectc-user mailing list