Fix #1585 (--append doesn't work with TAB formating)

This commit is contained in:
firewave 2010-04-15 22:45:38 +02:00
parent 15e4b8dbd5
commit 43dd749cc6
3 changed files with 21 additions and 5 deletions

View File

@ -40,7 +40,7 @@
- rename "file" to "single"
- synchronise map access in multithreaded mode or disable timing
- add unit tests
- for --showtime
- for --showtime (needs input file)
- for Timer* classes
- move timer stuff to seperate source/header
*/
@ -669,7 +669,11 @@ unsigned int CppCheck::check()
if (_settings._errorsOnly == false && it != configurations.begin())
_errorLogger.reportOut(std::string("Checking ") + fname + ": " + cfg + std::string("..."));
checkFile(codeWithoutCfg + _settings.append(), _filenames[c].c_str());
std::string appendCode = _settings.append();
if( !appendCode.empty() )
Preprocessor::preprocessWhitespaces(appendCode);
checkFile(codeWithoutCfg + appendCode, _filenames[c].c_str());
++checkCount;
}
}

View File

@ -568,10 +568,8 @@ std::string Preprocessor::replaceIfDefined(const std::string &str)
return ret;
}
void Preprocessor::preprocess(std::istream &srcCodeStream, std::string &processedFile, std::list<std::string> &resultConfigurations, const std::string &filename, const std::list<std::string> &includePaths)
void Preprocessor::preprocessWhitespaces(std::string &processedFile)
{
processedFile = read(srcCodeStream, filename, _settings);
// Replace all tabs with spaces..
std::replace(processedFile.begin(), processedFile.end(), '\t', ' ');
@ -581,6 +579,14 @@ void Preprocessor::preprocess(std::istream &srcCodeStream, std::string &processe
// Remove space characters that are after or before new line character
processedFile = removeSpaceNearNL(processedFile);
}
void Preprocessor::preprocess(std::istream &srcCodeStream, std::string &processedFile, std::list<std::string> &resultConfigurations, const std::string &filename, const std::list<std::string> &includePaths)
{
processedFile = read(srcCodeStream, filename, _settings);
// normalize the whitespaces of the file
preprocessWhitespaces(processedFile);
// Remove asm(...)
removeAsm(processedFile);

View File

@ -91,6 +91,12 @@ public:
*/
static void simplifyCondition(const std::map<std::string, std::string> &variables, std::string &condition, bool match);
/**
* preprocess all whitespaces
* @param processedFile The data to be processed
*/
static void preprocessWhitespaces(std::string &processedFile);
protected:
/**