[aspectc-user] a minor bug with reporting syntax errors

Olaf Spinczyk Olaf.Spinczyk at informatik.uni-erlangen.de
Fri May 18 10:32:52 CEST 2007


Hi Panu,

thank you for reporting this problem. The reason seems to be the simplisitic
error handling in our recursive-decent parser, which can't find the closing
bracket until it reaches the end of the file. As ac++ internally appends some
generated code to each translation unit, this end is located within an
"anonymous unit".

I will add a bug report and try to fix this behavior as soon as possible.

Thanks again,

Olaf


Panu Bloigu wrote:
> Hello.
> 
> Just a small addition. The non-explanatory error message occurs also
> with switch, so
> 
> =============================================================================
> 
> aspect Error
> {
>       advice execution("void f()") : around()
>       {
>               int i = 0;
>                switch(i
>               {
>                  //
>               }
>       }
> };
> 
> void f(){}
> 
> int main()
> {
>       f();
>       return 0;
> }
> =============================================================================
> 
> 
> also gives:
> =============================================================================
> 
> <anonymous unit>:4: error: invalid member declaration near token `private'
> error: Execution failed: "ac++" --config "puma.config"  -k -p. -c
> "anonerr.cpp" -o "anonerr.acc"
> =============================================================================
> 
> 
> Panu.
> 
> Panu Bloigu wrote:
>> Hello.
>>
>> I think I have found a bug in ac++ 1.0pre3. It concerns reporting
>> errors in the syntax of the advice code. The case is, that ac++
>> doesn't output a proper error message when a particular type of syntax
>> error is seen in the the advice code. Please consider the following code:
>>
>> =============================================================================
>>
>> aspect Error
>> {
>>        advice execution("void f()") : around()
>>        {
>>                for(;;
>>                {
>>                   //
>>                }
>>        }
>> };
>>
>> void f(){}
>>
>> int main()
>> {
>>        f();
>>        return 0;
>> }
>> =============================================================================
>>
>>
>> As you can see, the tailing parenthesis is missing from the for
>> clause. This will cause the compiler simply say:
>>
>> =============================================================================
>>
>> <anonymous unit>:4: error: invalid member declaration near token
>> `private'
>> error: Execution failed: "ac++" --config "puma.config"  -k -p. -c
>> "anonerr.cpp" -o "anonerr.acc"
>> =============================================================================
>>
>>
>> Also note that if the obviously erroneous for clause is replaced with
>> a while clause with the tailing parenthesis also missing, e.g.
>> 'while(true', the exact same message is printed.
>>
>> Panu.
>>
>>
>>
>>
>> _______________________________________________
>> aspectc-user mailing list
>> aspectc-user at aspectc.org
>> http://www.aspectc.org/mailman/listinfo/aspectc-user
>>
> 
> 
> _______________________________________________
> 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