[aspectc-user] slices in separate header files
Panu Bloigu
panu.bloigu at gmail.com
Tue Nov 20 11:54:25 CET 2007
Hello.
The ac++ 1.0pre3 change log says that slices can be implemented in
separate header files. What does that mean exactly and what's the
correct syntax for defining a class slice outside of an aspect header?
I have tried compiling the following files in Eclipse with the latest
AspectC++ plugin.
=======================================================
// File: Slice.h
#ifndef SLICE_H_
#define SLICE_H_
class Slice
{
public:
Slice();
virtual ~Slice();
void method(){}
//class Inner{};
};
#endif /*SLICE_H_*/
=======================================================
=======================================================
// File: TargetClass.h
#ifndef TARGETCLASS_H_
#define TARGETCLASS_H_
class TargetClass{};
#endif /*TARGETCLASS_H_*/
=======================================================
=======================================================
// File: AnAspect.ah
#ifndef ANASPECT_AH_
#define ANASPECT_AH_
#include "Slice.h"
aspect AnAspect
{
advice "TargetClass" : slice class Slice;
};
#endif /*ANASPECT_AH_*/
=======================================================
=======================================================
// File: main.cpp
#include "TargetClass.h"
int main()
{
TargetClass tg;
return 0;
}
=======================================================
Now the complier produces the following output at the maximum verbosity
level:
=======================================================
**** Build of configuration Debug for project Slices ****
make -k all
Building puma.config
"/usr/lib/eclipse/plugins/org.aspectc.compiler.linux_0.9.93/AC/ag++"
--gen_config -o "puma.config"
Building file: ../main.cpp
Invoking: GCC C++ Compiler
"/usr/lib/eclipse/plugins/org.aspectc.compiler.linux_0.9.93/AC/ag++" -r
repo.acp -p .. -I.. --c_compiler g++ -O0 -g3 -Wall -fmessage-length=0
-o"main.o" -c "../main.cpp" --Xweaver --keep_acc --keywords -v 9 && \
echo -n main.d ./ > main.d && \
g++ -MM -MG -P -w -include../AnAspect.ah -O0 -g3 -Wall -c
-fmessage-length=0 "../main.cpp" >> main.d
*
*
* AG++ Configuration:
* Create puma.config: 1
* Aspect C++ weaver:
/usr/lib/eclipse/plugins/org.aspectc.compiler.linux_0.9.93/AC/ac++
* C++ compiler: g++
* Files: ../main.cpp
* Options (G++): -I".." -O0 -g3 -Wall -fmessage-length=0 -c
-I"../" -v
* Options (AC++): -rrepo.acp -p".." -I".." --keywords -v9
* Options (total): -rrepo.acp -p".." -I".." -O0 -g3 -Wall
-fmessage-length=0 -c ../main.cpp -I"../" --keywords -v9 -v
* Weave: 1 Compile: 1 Link: 0
*
*
* Generating Puma configuration file
- Parsing output of g++ compiler
- Executing: "g++" -I".." -O0 -g3 -Wall -fmessage-length=0 -c -I"../"
-v -E -dM -v -x c++ "/dev/null" 2>main.cpp.err.out 1>main.cpp.std.out
- Exit: Success
- removing temporary file: main.cpp.std.out
- removing temporary file: main.cpp.err.out
- Writing puma configuration file
* Weaving
error: Execution failed:
"/usr/lib/eclipse/plugins/org.aspectc.compiler.linux_0.9.93/AC/ac++"
--config "puma.config" -rrepo.acp -p".." -I".." --keywords -v9 -c
"../main.cpp" -o "main.acc"
make: *** [main.o] Error 1
make: Target `all' not remade because of errors.
- Executing:
"/usr/lib/eclipse/plugins/org.aspectc.compiler.linux_0.9.93/AC/ac++"
--config "puma.config" -rrepo.acp -p".." -I".." --keywords -v9 -c
"../main.cpp" -o "main.acc"
- Exitcode: 11 (should be 0 )
Build complete for project Slices
=======================================================
As you can see there are no error messages printed, only this: "[main.o]
error 1". Could someone please shed some light on this? How do go about
defining slices in separate header files?
Thanks,
-- Panu.
More information about the aspectc-user
mailing list