Compiling DMD parser?

davidl davidl at 126.com
Tue Jul 15 08:04:09 PDT 2008


在 Tue, 15 Jul 2008 22:37:56 +0800,Markus Koskimies  
<markus at reaaliaika.net> 写道:

> On Tue, 15 Jul 2008 10:29:01 -0300, Leandro Lucarella wrote:
>
>>> I'll put the full sources available somewhere (to my home pages, at
>>> least), and continue developing walking & warning thing.
>>
>> That would be very useful.
>
> I'm currently hacking more scanners:
>
> - Scanning/warning, if function return value is discarded, i.e.
>
> 	int f() { ... }
>
> 	f(); // Warn
>
> 	cast(void)f();	// Don't warn
>
> - Warning for suspicious looking infinite loops, i.e.
>
> 	for(;3.1415926535894;) { ... }	// Warn
>
> 	for(;;) { }	// Don't warn
>
>
> There are some problems to make them correct, since DParser does not
> always store all necessary information, e.g. "for(;true;)" = "for(;;)"
>
> I probably include scanning of constant if/switch values with the loop
> scanning... That general purpose walking class makes implementation of
> these kinds of checkings relatively easy.
>
> There will surely missing / wrongly working pieces in the code, but those
> can be corrected later :)

The unused variable bug has been appeared in the bugzilla, and yes, i did  
think about it a bit.
The way I think is modify the VarDeclaration to have a member flag to show  
this var is used or not.
But this require a more complicated way of coding, your walker might be  
the better way to code. If
we can balance the performance issue, I think we open something really  
interesting in balancing of
design pattern and performance.

-- 
使用 Opera 革命性的电子邮件客户程序: http://www.opera.com/mail/



More information about the Digitalmars-d mailing list