论文部分内容阅读
C++ language is a development language of software which is widely used at present .The developers using C++ language pursuit efficiency and flexibility of the language. So they ignore the safety of the language in varying degrees. And because of limited capacity and carelessness of programmers, the safety of software is under serious threat.The development of C++ static safety rule checking tool is studied in this paper. Static code checking tool is software which is used to help programmers to automatically detect whether there are potential safety defect in source code. Through line by line it analyses the source code and finds the potential safety defect in software. The formulation of safety rules based on "MISRA C++ 2008", with summarizing other books about C++ security, is integrated its own set of standards for software development in the aerospace. According to static analysis of C++ program, the code which is detected non-compliance with safety standards is warned. The purpose is to detect potential safety defect in C++ program by application of static analysis.Rule checking tool is based on open source compiler GCC and the code which is used to check rules is added on the base of the frontend of GCC. Therefore firstly this article introduces the theory of achieving the frontend of compiler, and then it introduces the internal structure and implementation of the frontend of GCC through reversely analysis of source code of GCC. Finally the methods to develop checking tool are discussed totally according to GCC source code.