www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Add static code analyzing to dmd

IMHO it's an important enhancement as I see no reasons for the compiler 
to not inform about may-be-an-error situations if the user asks as it 
will save a lot people time.

Original issue:
http://d.puremagic.com/issues/show_bug.cgi?id=9811

Description:
There are things which may or may not indicate and error. Current 
compiler behavior is: "I'm a compiler, I can't even give a warning if 
there is a chance for false positive, there are only warnings and 
errors". But it looks inconsistent with the fact a compiler tries to 
help the developer by doing code coverage, documentation etc. Static 
code analyzing is an essential task a compiler could also do and do 
good. Also, IMHO, compilers should do static analyzing instead of 
external tools.

So I propose to add "-diagnostic" flag to the compiler for things Walter 
is "a bit uncomfortable in declaring it as always wrong" and also for 
things that are definitely not always wrong. There also could be 
different levels of such analyzing and ability to treat diagnostic 
warnings as errors.


See also:
[1] Interview of Walter Bright by Andrey Karpov
http://www.viva64.com/en/b/0182/
[2] NG thread about the interview
http://forum.dlang.org/thread/nnzzbsafuwwzuotvlkpu forum.dlang.org

-- 
Денис В. Шеломовский
Denis V. Shelomovskij
Jun 29 2013