[aspectc-user] Help Needed

Olaf Spinczyk olaf at ivs.cs.uni-magdeburg.de
Mon Feb 4 09:53:46 CET 2002


Hi Thiruna,

I'm glad to see that you are experimenting with our prototype. Now, let's see 
what your problem is...

The generated code looks bad:

>    static methodfunctions::__Tjps__advice_0 __tjp_methodfunctions__advice_0
> (, 0);

Here the first argument is missing. I will now try to reproduce the problem 
and fix it (or at least tell you a workaround).

Best regards,

Olaf


On Monday,  4. February 2002 06:11, you wrote:
> Hi,
>
> I wrote an aspect file and a cc file whose code is given below:
>
> aspect file
>
> #include<stdio.h>
>
> aspect methodfunctions
> {
> 	pointcut move() = execution("%  Maths::calladd(...)");
>
> 	public:
>
> 		advice move() : void before()
> 		{
> 			printf("ID OF THE JOIN POINT = %d ",
> thisJoinPoint->id());
> 		}
> };
>
> cc file
>
> # include<stdio.h>
>
> class Maths
> {
> 	public:
>
> 	int tmpNum1;
> 	int tmpNum2;
>
> 	public:
>
> 	Maths(int Num1, int Num2)
> 	{
> 	  	tmpNum1 = Num1;
> 		tmpNum2 = Num2;
> 	}
>
> 	int calladd()
> 	{
> 		return(tmpNum1+tmpNum2);
> 	}
>
> 	int callsub()
> 	{
> 		return(tmpNum1 - tmpNum2);
> 	}
>
> 	int callmul()
> 	{
> 		return(tmpNum1*tmpNum2);
> 	}
> };
>
> int main()
> {
>
> 	Maths math(4,3);
> 	int add1;
> 	int sub1;
> 	int mul1;
>
> 	add1 = math.calladd();
> 	sub1 = math.callsub();
> 	mul1 = math.callmul();
>
> 	printf("%d %d %d", add1, sub1, mul1 );
> }
>
> Using the ac++ compiler weaving happens, but when I run the transformed cc
> file, it fails. I have given the transformed code generated by the ac++
> compiler.
>
> Transformed cc code
>
> #include "methodfunctions.ah"
> # include<stdio.h>
>
> class Maths
> {
> 	public:
>
> 	int tmpNum1;
> 	int tmpNum2;
>
> 	public:
>
> 	Maths(int Num1, int Num2)
> 	{
> 	  	tmpNum1 = Num1;
> 		tmpNum2 = Num2;
> 	}
>
> 	int __old_calladd()
> 	{
> 		return(tmpNum1+tmpNum2);
> 	}
> int calladd ()
>  {
>    static methodfunctions::__Tjps__advice_0 __tjp_methodfunctions__advice_0
> (, 0);
>    methodfunctions::aspectOf ()->methodfunctions::__advice_0
> (&__tjp_methodfunctions__advice_0);
>    int result = __old_calladd ();
>    return result;
>  }
>
>
> 	int callsub()
> 	{
> 		return(tmpNum1 - tmpNum2);
> 	}
>
> 	int callmul()
> 	{
> 		return(tmpNum1*tmpNum2);
> 	}
> };
>
> int main()
> {
>
> 	Maths math(4,3);
> 	int add1;
> 	int sub1;
> 	int mul1;
>
> 	add1 = math.calladd();
> 	sub1 = math.callsub();
> 	mul1 = math.callmul();
>
> 	printf("%d %d %d", add1, sub1, mul1 );
> }
>
> The errors reported are:
>
> methodfunctions.cc: In method `int Maths::calladd()':
> methodfunctions.cc:27: parse error before `,'
> methodfunctions.cc:27: cannot declare static function inside another
> function
> methodfunctions.cc:28: no matching function for call to
> `methodfunctions::__advi
> ce_0 (methodfunctions::__Tjps__advice_0 (*)(...))'
> methodfunctions.ah:30: candidates are:
> methodfunctions::__advice_0(methodfunctio
> ns::__Tjps__advice_0 *)
> make: *** [trace] Error 1
>
> Can anyone help me tracing what the problem could be ?
>
> Thanks in advance,
> Thiruna
> _______________________________________________
> 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