[aspectc-user] ag++

Olaf Spinczyk os at aspectc.org
Wed Feb 18 09:57:21 CET 2009


Exactly. The "special parameter" is -k. The reason is compatibility. We 
want that ac++ can also compile ordinary C++ code. Therefore, the 
aspect-specifc keywords 'aspect', 'pointcut', and 'advice' are treated 
as normal identifiers in files that don't have the extension .ah. With 
-k these keywords are treated as keywords everywhere.

- Olaf

Stefan Marr wrote:
> Hi,
>
> your aspect definition has to be in a .ah file to be recognized. 
> Otherwise you have to give a special parameter to ag++.
>
> Regards
> Stefan
>
> On 18 Feb 2009, at 07:20, Yang Zhang wrote:
>
>> Hi, I can't seem to get started with the apt-installed ag++.  I'm 
>> basically trying to compile the example given in the quick reference. 
>> Thanks in advance for any hints.
>>
>> yang at yang-xps410 ~/sandbox/cc
>> $ ag++ --version
>> ag++ 0.7  built: May 11 2008
>>
>> yang at yang-xps410 ~/sandbox/cc
>> $ cat acpp.cc
>> #include <iostream>
>> using namespace std;
>> aspect Trace {
>>  pointcut functions() = "% main(...)";
>>  advice execution(functions()) : around() {
>>    cout << "before" << JoinPoint::signature() << "(";
>>    for (size_t i = 0; i < JoinPoint::ARGS; ++i)
>>      cout << (i ? ", " : "") << JoinPoint::argtype(i);
>>    cout << ")" << endl;
>>    tjp->proceed();
>>    cout << "after" << endl;
>>  }
>> };
>> int main() {
>>  return 0;
>> }
>>
>> yang at yang-xps410 ~/sandbox/cc
>> $ ag++ acpp.cc -o acpp
>> acpp.cc:1: error: invalid declaration near token `aspect'
>> error: Execution failed: "ac++" --config "/tmp/agxx_pcfg4Qy53f"  -p. 
>> -c "acpp.cc" -o "/tmp/acpp.cc_agxx_knLdsM"
>> -- 
>> Yang Zhang
>> http://www.mit.edu/~y_z/
>> _______________________________________________
>> 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