Skip to content

Commit c586ae8

Browse files
committed
Revert 'project' - it is not ready yet
1 parent 09a83f2 commit c586ae8

14 files changed

+278
-661
lines changed

cli/cmdlineparser.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -480,10 +480,6 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[])
480480
if (!CppCheckExecutor::tryLoadLibrary(_settings->library, argv[0], argv[i]+10))
481481
return false;
482482
}
483-
// experimental --project
484-
else if (std::strncmp(argv[i], "--project=", 10) == 0) {
485-
_settings->project.load(argv[i]+10);
486-
}
487483

488484
// Report progress
489485
else if (std::strcmp(argv[i], "--report-progress") == 0) {
@@ -770,7 +766,7 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[])
770766
}
771767

772768
// Print error only if we have "real" command and expect files
773-
if (!_exitAfterPrint && _pathnames.empty() && _settings->project.fileSettings.empty()) {
769+
if (!_exitAfterPrint && _pathnames.empty()) {
774770
PrintMessage("cppcheck: No C or C++ source files found.");
775771
return false;
776772
}

cli/cppcheckexecutor.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ bool CppCheckExecutor::parseFromArgs(CppCheck *cppcheck, int argc, const char* c
154154
FileLister::recursiveAddFiles(_files, Path::toNativeSeparators(*iter), _settings->library.markupExtensions(), matcher);
155155
}
156156

157-
if (_files.empty() && settings.project.fileSettings.empty()) {
157+
if (_files.empty()) {
158158
std::cout << "cppcheck: error: could not find or open any of the paths given." << std::endl;
159159
if (!ignored.empty())
160160
std::cout << "cppcheck: Maybe all paths were ignored?" << std::endl;
@@ -825,15 +825,6 @@ int CppCheckExecutor::check_internal(CppCheck& cppcheck, int /*argc*/, const cha
825825
}
826826
}
827827

828-
// filesettings
829-
c = 0;
830-
for (std::list<Project::FileSettings>::const_iterator fs = settings.project.fileSettings.begin(); fs != settings.project.fileSettings.end(); ++fs) {
831-
returnValue += cppcheck.check((Project::FileSettings)*fs);
832-
++c;
833-
if (!settings.quiet)
834-
reportStatus(c, settings.project.fileSettings.size(), c, settings.project.fileSettings.size());
835-
}
836-
837828
// second loop to parse all markup files which may not work until all
838829
// c/cpp files have been parsed and checked
839830
for (std::map<std::string, std::size_t>::const_iterator i = _files.begin(); i != _files.end(); ++i) {

cli/threadexecutor.cpp

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -352,11 +352,10 @@ unsigned int ThreadExecutor::check()
352352
HANDLE *threadHandles = new HANDLE[_settings.jobs];
353353

354354
_itNextFile = _files.begin();
355-
_itNextFileSettings = _settings.project.fileSettings.begin();
356355

357356
_processedFiles = 0;
358357
_processedSize = 0;
359-
_totalFiles = _files.size() + _settings.project.fileSettings.size();
358+
_totalFiles = _files.size();
360359
_totalFileSize = 0;
361360
for (std::map<std::string, std::size_t>::const_iterator i = _files.begin(); i != _files.end(); ++i) {
362361
_totalFileSize += i->second;
@@ -416,8 +415,7 @@ unsigned int __stdcall ThreadExecutor::threadProc(void *args)
416415
unsigned int result = 0;
417416

418417
ThreadExecutor *threadExecutor = static_cast<ThreadExecutor*>(args);
419-
std::map<std::string, std::size_t>::const_iterator &itFile = threadExecutor->_itNextFile;
420-
std::list<Project::FileSettings>::const_iterator &itFileSettings = threadExecutor->_itNextFileSettings;
418+
std::map<std::string, std::size_t>::const_iterator &it = threadExecutor->_itNextFile;
421419

422420
// guard static members of CppCheck against concurrent access
423421
EnterCriticalSection(&threadExecutor->_fileSync);
@@ -426,32 +424,24 @@ unsigned int __stdcall ThreadExecutor::threadProc(void *args)
426424
fileChecker.settings() = threadExecutor->_settings;
427425

428426
for (;;) {
429-
if (itFile == threadExecutor->_files.end() && itFileSettings == threadExecutor->_settings.project.fileSettings.end()) {
427+
if (it == threadExecutor->_files.end()) {
430428
LeaveCriticalSection(&threadExecutor->_fileSync);
431429
break;
432-
}
433430

434-
std::size_t fileSize = 0;
435-
if (itFile != threadExecutor->_files.end()) {
436-
const std::string &file = itFile->first;
437-
fileSize = itFile->second;
438-
++itFile;
431+
}
432+
const std::string &file = it->first;
433+
const std::size_t fileSize = it->second;
434+
++it;
439435

440-
LeaveCriticalSection(&threadExecutor->_fileSync);
436+
LeaveCriticalSection(&threadExecutor->_fileSync);
441437

442-
std::map<std::string, std::string>::const_iterator fileContent = threadExecutor->_fileContents.find(file);
443-
if (fileContent != threadExecutor->_fileContents.end()) {
444-
// File content was given as a string
445-
result += fileChecker.check(file, fileContent->second);
446-
} else {
447-
// Read file from a file
448-
result += fileChecker.check(file);
449-
}
450-
} else { // file settings..
451-
const Project::FileSettings &fs = *itFileSettings;
452-
++itFileSettings;
453-
LeaveCriticalSection(&threadExecutor->_fileSync);
454-
result += fileChecker.check(fs);
438+
std::map<std::string, std::string>::const_iterator fileContent = threadExecutor->_fileContents.find(file);
439+
if (fileContent != threadExecutor->_fileContents.end()) {
440+
// File content was given as a string
441+
result += fileChecker.check(file, fileContent->second);
442+
} else {
443+
// Read file from a file
444+
result += fileChecker.check(file);
455445
}
456446

457447
EnterCriticalSection(&threadExecutor->_fileSync);

cli/threadexecutor.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include <string>
2424
#include <list>
2525
#include "errorlogger.h"
26-
#include "project.h"
2726

2827
#if (defined(__GNUC__) || defined(__sun)) && !defined(__MINGW32__)
2928
#define THREADING_MODEL_FORK
@@ -110,7 +109,6 @@ class ThreadExecutor : public ErrorLogger {
110109

111110
std::map<std::string, std::string> _fileContents;
112111
std::map<std::string, std::size_t>::const_iterator _itNextFile;
113-
std::list<Project::FileSettings>::const_iterator _itNextFileSettings;
114112
std::size_t _processedFiles;
115113
std::size_t _totalFiles;
116114
std::size_t _processedSize;

lib/cppcheck.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,6 @@ unsigned int CppCheck::check(const std::string &path, const std::string &content
8080
return processFile(path, iss);
8181
}
8282

83-
unsigned int CppCheck::check(const Project::FileSettings &fs)
84-
{
85-
CppCheck temp(*this, _useGlobalSuppressions);
86-
temp._settings.userDefines = fs.defines;
87-
temp._settings.userIncludes = fs.includePaths;
88-
// TODO: temp._settings.userUndefs = fs.undefs;
89-
if (fs.platformType != Settings::Unspecified) {
90-
temp._settings.platformType = fs.platformType;
91-
}
92-
return temp.check(fs.filename);
93-
}
94-
9583
unsigned int CppCheck::processFile(const std::string& filename, std::istream& fileStream)
9684
{
9785
exitcode = 0;

lib/cppcheck.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ class CPPCHECKLIB CppCheck : ErrorLogger {
6868
* settings()).
6969
*/
7070
unsigned int check(const std::string &path);
71-
unsigned int check(const Project::FileSettings &fs);
7271

7372
/**
7473
* @brief Check the file.

lib/cppcheck.vcxproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,7 @@
7878
<ClCompile Include="library.cpp" />
7979
<ClCompile Include="mathlib.cpp" />
8080
<ClCompile Include="path.cpp" />
81-
<ClCompile Include="platform.cpp" />
8281
<ClCompile Include="preprocessor.cpp" />
83-
<ClCompile Include="project.cpp" />
8482
<ClCompile Include="settings.cpp" />
8583
<ClCompile Include="suppressions.cpp" />
8684
<ClCompile Include="symboldatabase.cpp" />
@@ -127,9 +125,7 @@
127125
<ClInclude Include="library.h" />
128126
<ClInclude Include="mathlib.h" />
129127
<ClInclude Include="path.h" />
130-
<ClInclude Include="platform.h" />
131128
<ClInclude Include="preprocessor.h" />
132-
<ClInclude Include="project.h" />
133129
<ClInclude Include="settings.h" />
134130
<ClInclude Include="suppressions.h" />
135131
<ClInclude Include="symboldatabase.h" />

lib/cppcheck.vcxproj.filters

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,6 @@
143143
<ClCompile Include="..\externals\simplecpp\simplecpp.cpp">
144144
<Filter>Source Files</Filter>
145145
</ClCompile>
146-
<ClCompile Include="project.cpp">
147-
<Filter>Source Files</Filter>
148-
</ClCompile>
149-
<ClCompile Include="platform.cpp">
150-
<Filter>Source Files</Filter>
151-
</ClCompile>
152146
</ItemGroup>
153147
<ItemGroup>
154148
<ClInclude Include="checkbufferoverrun.h">
@@ -292,12 +286,6 @@
292286
<ClInclude Include="..\externals\simplecpp\simplecpp.h">
293287
<Filter>Header Files</Filter>
294288
</ClInclude>
295-
<ClInclude Include="project.h">
296-
<Filter>Header Files</Filter>
297-
</ClInclude>
298-
<ClInclude Include="platform.h">
299-
<Filter>Header Files</Filter>
300-
</ClInclude>
301289
</ItemGroup>
302290
<ItemGroup>
303291
<ResourceCompile Include="version.rc" />

0 commit comments

Comments
 (0)