Signed-off-by: Günther Makulik <g-makulik@t-online.de>

This commit is contained in:
makulik 2011-10-23 11:15:12 +02:00
parent abf25fcc69
commit c7ed1de419
2 changed files with 7 additions and 13 deletions

View File

@ -68,13 +68,10 @@ static void AddInclPathsToList(const std::string& FileList, std::list<std::strin
// to keep things initially simple, if the file can't be opened, just be // to keep things initially simple, if the file can't be opened, just be
// silent and move on // silent and move on
std::ifstream Files(FileList.c_str()); std::ifstream Files(FileList.c_str());
if (Files) if (Files) {
{
std::string PathName; std::string PathName;
while (std::getline(Files, PathName)) // next line while (std::getline(Files, PathName)) { // next line
{ if (!PathName.empty()) {
if (!PathName.empty())
{
PathName = Path::fromNativeSeparators(PathName); PathName = Path::fromNativeSeparators(PathName);
PathName = Path::removeQuotationMarks(PathName); PathName = Path::removeQuotationMarks(PathName);
PathNames.push_back(PathName); PathNames.push_back(PathName);
@ -349,9 +346,7 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[])
path += '/'; path += '/';
_settings->_includePaths.push_back(path); _settings->_includePaths.push_back(path);
} } else if (strncmp(argv[i], "--includes-file=", 16) == 0) {
else if (strncmp(argv[i], "--includes-file=", 16) == 0)
{
// open this file and read every input file (1 file name per line) // open this file and read every input file (1 file name per line)
AddInclPathsToList(16 + argv[i], _settings->_includePaths); AddInclPathsToList(16 + argv[i], _settings->_includePaths);
} }
@ -708,8 +703,8 @@ void CmdLineParser::PrintHelp()
" -I <dir> Give include path. Give several -I parameters to give\n" " -I <dir> Give include path. Give several -I parameters to give\n"
" several paths. First given path is checked first. If\n" " several paths. First given path is checked first. If\n"
" paths are relative to source files, this is not needed.\n" " paths are relative to source files, this is not needed.\n"
" --includes-file=<file>\n" " --includes-file=<file>\n"
" Specify the include paths to check in a text file. Add\n" " Specify the include paths to check in a text file. Add\n"
" one include path per line.\n" " one include path per line.\n"
" -i <dir or file> Give a source file or source file directory to exclude\n" " -i <dir or file> Give a source file or source file directory to exclude\n"
" from the check. This applies only to source files so\n" " from the check. This applies only to source files so\n"

View File

@ -366,8 +366,7 @@ private:
ASSERT_EQUALS("framework/", settings._includePaths.front()); ASSERT_EQUALS("framework/", settings._includePaths.front());
} }
void includesFile() void includesFile() {
{
// TODO: Fails since cannot open the file // TODO: Fails since cannot open the file
REDIRECT; REDIRECT;
const char *argv[] = {"cppcheck", "--includes-file=inclpaths.txt", "file.cpp"}; const char *argv[] = {"cppcheck", "--includes-file=inclpaths.txt", "file.cpp"};