| Due to the ever-changing of the computer technology,the scale and complexity of software is increasing,relying on manually source code analysis becomes unrealistic,so it is necessary to use a computer to detect source code defect.The static code test tool in this paper is Defect Testing System(DTS),however,with the C/C ++ programming language development and change in their own language standards,compilers and operating systems,the developers also expend them in actual life,the language parser in DTS always produces abnormal in daily testing case in front-end of language,so that the analysis may aborted or the result of testing may be not accurate.This paper is based on the current ability of DTS,expends the language parser in front-end level,and presents a general defect detection method of pretreatment.Firstly,this paper analyzes the current ability to parser C/C++language of DTS.Secondly,it describes the anomalies which are encountered during the testing,classifies them to grammatical abnormal and lexical abnormal,then analyzes the reason and solution of grammatical abnormal and lexical abnormal,verifies the solution by practical examples.Finally,this paper tests the solution in large projects which encountered abnormal before,through the analysis of the experiment data before and after,the experiment confirms correctness of the common defect detection pretreatment method which is proposed in research and implementation on support of multiple compilers based on defect testing system,it is of great significance in the front-end processing grammar. |