Fix for #pragma asm
This commit is contained in:
parent
59335f80d2
commit
1f4b84379d
|
@ -212,6 +212,7 @@ unsigned int CppCheck::processFile(const std::string& filename, const std::strin
|
||||||
|
|
||||||
// Get directives
|
// Get directives
|
||||||
preprocessor.setDirectives(tokens1);
|
preprocessor.setDirectives(tokens1);
|
||||||
|
preprocessor.simplifyPragmaAsm(&tokens1);
|
||||||
|
|
||||||
preprocessor.setPlatformInfo(&tokens1);
|
preprocessor.setPlatformInfo(&tokens1);
|
||||||
|
|
||||||
|
|
|
@ -566,10 +566,6 @@ void Preprocessor::loadFiles(const simplecpp::TokenList &rawtokens, std::vector<
|
||||||
simplecpp::OutputList outputList;
|
simplecpp::OutputList outputList;
|
||||||
|
|
||||||
tokenlists = simplecpp::load(rawtokens, files, dui, &outputList);
|
tokenlists = simplecpp::load(rawtokens, files, dui, &outputList);
|
||||||
|
|
||||||
for (std::map<std::string, simplecpp::TokenList *>::iterator it = tokenlists.begin(); it != tokenlists.end(); ++it) {
|
|
||||||
Preprocessor::simplifyPragmaAsm(it->second);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Preprocessor::removeComments()
|
void Preprocessor::removeComments()
|
||||||
|
@ -886,6 +882,14 @@ unsigned int Preprocessor::calculateChecksum(const simplecpp::TokenList &tokens1
|
||||||
}
|
}
|
||||||
|
|
||||||
void Preprocessor::simplifyPragmaAsm(simplecpp::TokenList *tokenList)
|
void Preprocessor::simplifyPragmaAsm(simplecpp::TokenList *tokenList)
|
||||||
|
{
|
||||||
|
Preprocessor::simplifyPragmaAsmPrivate(tokenList);
|
||||||
|
for (std::map<std::string, simplecpp::TokenList *>::iterator it = tokenlists.begin(); it != tokenlists.end(); ++it) {
|
||||||
|
Preprocessor::simplifyPragmaAsmPrivate(it->second);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Preprocessor::simplifyPragmaAsmPrivate(simplecpp::TokenList *tokenList)
|
||||||
{
|
{
|
||||||
// assembler code..
|
// assembler code..
|
||||||
for (simplecpp::Token *tok = tokenList->front(); tok; tok = tok->next) {
|
for (simplecpp::Token *tok = tokenList->front(); tok; tok = tok->next) {
|
||||||
|
|
|
@ -171,10 +171,12 @@ public:
|
||||||
*/
|
*/
|
||||||
unsigned int calculateChecksum(const simplecpp::TokenList &tokens1, const std::string &toolinfo) const;
|
unsigned int calculateChecksum(const simplecpp::TokenList &tokens1, const std::string &toolinfo) const;
|
||||||
|
|
||||||
static void simplifyPragmaAsm(simplecpp::TokenList *tokenList);
|
void simplifyPragmaAsm(simplecpp::TokenList *tokenList);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
static void simplifyPragmaAsmPrivate(simplecpp::TokenList *tokenList);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove space that has new line character on left or right side of it.
|
* Remove space that has new line character on left or right side of it.
|
||||||
*
|
*
|
||||||
|
|
|
@ -253,7 +253,7 @@ private:
|
||||||
std::vector<std::string> files;
|
std::vector<std::string> files;
|
||||||
simplecpp::TokenList tokens(istr, files, filename, &outputList);
|
simplecpp::TokenList tokens(istr, files, filename, &outputList);
|
||||||
tokens.removeComments();
|
tokens.removeComments();
|
||||||
Preprocessor::simplifyPragmaAsm(&tokens);
|
preprocessor0.simplifyPragmaAsm(&tokens);
|
||||||
const std::set<std::string> configs(preprocessor0.getConfigs(tokens));
|
const std::set<std::string> configs(preprocessor0.getConfigs(tokens));
|
||||||
preprocessor0.setDirectives(tokens);
|
preprocessor0.setDirectives(tokens);
|
||||||
for (std::set<std::string>::const_iterator it = configs.begin(); it != configs.end(); ++it) {
|
for (std::set<std::string>::const_iterator it = configs.begin(); it != configs.end(); ++it) {
|
||||||
|
|
Loading…
Reference in New Issue