[aspectc-user] Problems with aspect inheritance
Panu Bloigu
panu.bloigu at mbnet.fi
Thu Nov 9 10:54:27 CET 2006
Hello again you all!
This time my question concerns aspect inheritance. I have hard time getting
a project with the following aspects to compile.
=================
File: AspectA0.ah
=================
aspect AspectA0
{
pointcut virtual pc() = 0;
};
=================
File: AspectA1.ah
=================
#include <iostream>
#include "AspectA0.ah"
aspect AspectA1 : public AspectA0
{
pointcut pc() = "% ClassA0::%(...)";
advice call(pc()) : around()
{
std::cout<<"Before...\n";
tjp->proceed();
std::cout<<"\nAfter...\n";
}
};
In addition to these I have the declaration of ClassA0 in ClassA0.h and and
the definition in ClassA0.cpp. Then, of course, I have a main.cpp in which I
call one of the ClassA0's methods. I'm trying to compile this project in
Eclipse 3.1.2 with the latest AspectC++ plugin. This is what the compiler
leaves me with:
=================
**** Full rebuild of configuration Debug for project Demo ****
make -k clean all
rm -rf ./ClassA0.o ./main.o ./ClassA0.d ./main.d Demo repo.acp puma.config
Building puma.config
"/opt/eclipse-3.1.2/plugins/org.aspectc.compiler.linux_0.9.93/AC/ag++"
--gen_config -o puma.config
Building file: ../ClassA0.cpp
Invoking: GCC C++ Compiler
/opt/eclipse-3.1.2/plugins/org.aspectc.compiler.linux_0.9.93/AC/ag++
--c_compiler g++ --keep_acc -k -r repo.acp -p .. -c ../ClassA0.cpp
--Xcompiler -o ClassA0.o -D_useAC -O0 -g3 -Wall -fmessage-length=0 -I..
.../AspectA0.ah:1: error: redefinition of `AspectA0'
.../AspectA0.ah:1: previously defined here
.../AspectA0.ah:1: error: wrong use of `AspectA0'
error: Execution failed:
"/opt/eclipse-3.1.2/plugins/org.aspectc.compiler.linux_0.9.93/AC/ac++"
--config "puma.config" -k -rrepo.acp -p".." -D"_useAC" -I".." -c
"../ClassA0.cpp" -o "ClassA0.acc"
make: *** [ClassA0.o] Error 1
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++ --keep_acc -k -r repo.acp -p .. -c ../main.cpp --Xcompiler
-o main.o -D_useAC -O0 -g3 -Wall -fmessage-length=0 -I..
.../AspectA0.ah:1: error: redefinition of `AspectA0'
.../AspectA0.ah:1: previously defined here
.../AspectA0.ah:1: error: wrong use of `AspectA0'
error: Execution failed:
"/opt/eclipse-3.1.2/plugins/org.aspectc.compiler.linux_0.9.93/AC/ac++"
--config "puma.config" -k -rrepo.acp -p".." -D"_useAC" -I".." -c
"../main.cpp" -o "main.acc"
make: *** [main.o] Error 1
make: Target `all' not remade because of errors.
Build complete for project Demo
=================
What is the problem here? I presume there's probably just some little detail
I'm missing, but I just don't seem to be able to figure it out.
Also, what it the exact semantics of virtual, pure virtual and regular
pointcuts in relation to aspect inheritance? I understand that in C++ the
essence of virtual methods lies in dynamic binding, but I fail to see how
dynamic binding would relate to pointcut definitions. After all, they seem
like something that does not exist in runtime, no? Or do I understand some
very basic thing very wrong here?
Thank you for your answers.
Panu.
More information about the aspectc-user
mailing list