資源簡介
Cppcheck是一種C/C++代碼缺陷靜態檢查工具。不同于C/C++編譯器及其它分析工具,Cppcheck只檢查編譯器檢查不出來的bug,不檢查語法錯誤。她是開源的.
代碼片段和文件信息
/*
?*?Cppcheck?-?A?tool?for?static?C/C++?code?analysis
?*?Copyright?(C)?2007-2012?Daniel?Marjam?ki?and?Cppcheck?team.
?*
?*?This?program?is?free?software:?you?can?redistribute?it?and/or?modify
?*?it?under?the?terms?of?the?GNU?General?Public?License?as?published?by
?*?the?Free?Software?Foundation?either?version?3?of?the?License?or
?*?(at?your?option)?any?later?version.
?*
?*?This?program?is?distributed?in?the?hope?that?it?will?be?useful
?*?but?WITHOUT?ANY?WARRANTY;?without?even?the?implied?warranty?of
?*?MERCHANTABILITY?or?FITNESS?FOR?A?PARTICULAR?PURPOSE.??See?the
?*?GNU?General?Public?License?for?more?details.
?*
?*?You?should?have?received?a?copy?of?the?GNU?General?Public?License
?*?along?with?this?program.??If?not?see? .
?*/
#include?
#include?
#include?
#include?
#include?
#include??//?EXIT_FAILURE
#include?“cppcheck.h“
#include?“timer.h“
#include?“settings.h“
#include?“cmdlineparser.h“
#include?“path.h“
#include?“filelister.h“
#ifdef?HAVE_RULES
//?xml?is?used?in?rules
#include?l.h>
#endif
static?void?AddFilesToList(const?std::string&?FileList?std::vector&?PathNames)
{
????//?to?keep?things?initially?simple?if?the?file?can‘t?be?opened?just?be
????//?silent?and?move?on
????//?ideas?:?we?could?also?require?this?should?be?an?xml?file?with?the?filenames
????//?specified?in?an?xml?structure
????//?we?could?elaborate?this?then?to?also?include?the?I-paths?...
????//?basically?for?everything?that?makes?the?command?line?very?long
????//?xml?is?a?bonus?then?since?we?can?easily?extend?it
????//?we?need?a?good?parser?then?->?suggestion?:?Tinyxml
????//?drawback?:?creates?a?dependency
????std::istream?*Files;
????std::ifstream?Infile;
????if?(FileList.compare(“-“)?==?0)?{?//?read?from?stdin
????????Files?=?&std::cin;
????}?else?{
????????Infile.open(FileList.c_str());
????????Files?=?&Infile;
????}
????if?(Files)?{
????????std::string?FileName;
????????while?(std::getline(*Files?FileName))?{?//?next?line
????????????if?(!FileName.empty())?{
????????????????PathNames.push_back(FileName);
????????????}
????????}
????}
}
static?void?AddInclPathsToList(const?std::string&?FileList?std::list&?PathNames)
{
????//?to?keep?things?initially?simple?if?the?file?can‘t?be?opened?just?be
????//?silent?and?move?on
????std::ifstream?Files(FileList.c_str());
????if?(Files)?{
????????std::string?PathName;
????????while?(std::getline(Files?PathName))?{?//?next?line
????????????if?(!PathName.empty())?{
????????????????PathName?=?Path::fromNativeSeparators(PathName);
????????????????PathName?=?Path::removeQuotationMarks(PathName);
????????????????PathNames.push_back(PathName);
????????????}
????????}
????}
}
CmdLineParser::CmdLineParser(Settings?*settings)
????:?_settings(settings)
?????_showHelp(false)
?????_showVersion(false)
?????_showErrorMessages(fa
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????326??2012-01-01?13:29??cppcheckSourceCode\.git\config
?????文件?????????73??2012-01-01?13:24??cppcheckSourceCode\.git\desc
?????文件?????????23??2012-01-01?13:29??cppcheckSourceCode\.git\HEAD
?????文件????????452??2012-01-01?13:24??cppcheckSourceCode\.git\hooks\applypatch-msg.sample
?????文件????????896??2012-01-01?13:24??cppcheckSourceCode\.git\hooks\commit-msg.sample
?????文件????????160??2012-01-01?13:24??cppcheckSourceCode\.git\hooks\post-commit.sample
?????文件????????552??2012-01-01?13:24??cppcheckSourceCode\.git\hooks\post-receive.sample
?????文件????????189??2012-01-01?13:24??cppcheckSourceCode\.git\hooks\post-update.sample
?????文件????????398??2012-01-01?13:24??cppcheckSourceCode\.git\hooks\pre-applypatch.sample
?????文件???????1704??2012-01-01?13:24??cppcheckSourceCode\.git\hooks\pre-commit.sample
?????文件???????4951??2012-01-01?13:24??cppcheckSourceCode\.git\hooks\pre-reba
?????文件???????1239??2012-01-01?13:24??cppcheckSourceCode\.git\hooks\prepare-commit-msg.sample
?????文件???????3611??2012-01-01?13:24??cppcheckSourceCode\.git\hooks\update.sample
?????文件??????31680??2012-01-01?13:29??cppcheckSourceCode\.git\index
?????文件????????240??2012-01-01?13:24??cppcheckSourceCode\.git\info\exclude
?????文件????????195??2012-01-01?13:29??cppcheckSourceCode\.git\logs\HEAD
?????文件????????195??2012-01-01?13:29??cppcheckSourceCode\.git\logs\refs\heads\master
?????文件????1171948??2012-01-01?13:29??cppcheckSourceCode\.git\ob
?????文件????9837460??2012-01-01?13:29??cppcheckSourceCode\.git\ob
?????文件???????1734??2012-01-01?13:29??cppcheckSourceCode\.git\packed-refs
?????文件?????????41??2012-01-01?13:29??cppcheckSourceCode\.git\refs\heads\master
?????文件?????????32??2012-01-01?13:29??cppcheckSourceCode\.git\refs\remotes\origin\HEAD
?????文件????????706??2012-01-01?13:29??cppcheckSourceCode\.gitignore
?????文件????????392??2012-01-01?13:29??cppcheckSourceCode\AUTHORS
?????文件???????1604??2012-01-01?13:29??cppcheckSourceCode\build-pcre.txt
?????文件???????1554??2012-01-01?13:29??cppcheckSourceCode\build.bat
?????文件????1356651??2012-01-01?13:29??cppcheckSourceCode\Changelog
?????文件???????1278??2012-01-01?13:29??cppcheckSourceCode\cli\cli.pro
?????文件??????35430??2012-01-01?13:29??cppcheckSourceCode\cli\cmdlineparser.cpp
?????文件???????3089??2012-01-01?13:29??cppcheckSourceCode\cli\cmdlineparser.h
............此處省略405個文件信息
評論
共有 條評論