diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index c57246d88..6adca82fb 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -1790,7 +1790,8 @@ void SymbolDatabase::printOut(const char *title) const } for (std::list::const_iterator type = typeList.begin(); type != typeList.end(); ++type) { - std::cout << "Type: " << type->name() << std::endl; + std::cout << "Type: " << &(*type) << std::endl; + std::cout << " name: " << type->name() << std::endl; std::cout << " classDef: " << _tokenizer->list.fileLine(type->classDef) << std::endl; std::cout << " classScope: " << type->classScope << std::endl; std::cout << " enclosingScope: " << type->enclosingScope << std::endl; @@ -1805,13 +1806,13 @@ void SymbolDatabase::printOut(const char *title) const if (type->derivedFrom[i].isVirtual) std::cout << "Virtual "; - std::cout << (type->derivedFrom[i].access == Public ? " Public " : - type->derivedFrom[i].access == Protected ? " Protected " : - type->derivedFrom[i].access == Private ? " Private " : + std::cout << (type->derivedFrom[i].access == Public ? " Public" : + type->derivedFrom[i].access == Protected ? " Protected" : + type->derivedFrom[i].access == Private ? " Private" : " Unknown"); if (type->derivedFrom[i].type) - std::cout << type->derivedFrom[i].type; + std::cout << " " << type->derivedFrom[i].type; else std::cout << " Unknown"; diff --git a/lib/token.cpp b/lib/token.cpp index 3f5300074..2327bb020 100644 --- a/lib/token.cpp +++ b/lib/token.cpp @@ -125,7 +125,7 @@ void Token::update_property_isStandardType() if (_str.size() < 3) return; - static const char * const stdtype[] = {"int", "char", "bool", "long", "short", "float", "double", "wchar_t", "size_t", 0}; + static const char * const stdtype[] = {"int", "char", "bool", "long", "short", "float", "double", "wchar_t", "size_t", "void", 0}; for (int i = 0; stdtype[i]; i++) { if (_str == stdtype[i]) { _isStandardType = true; diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index a0a4f1f98..2b52424aa 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -8880,7 +8880,7 @@ void Tokenizer::simplifyAttribute() void Tokenizer::simplifyKeyword() { for (Token *tok = list.front(); tok; tok = tok->next()) { - while (Token::Match(tok, "volatile|inline|__inline|__forceinline|register|__restrict|__restrict__")) { + while (Token::Match(tok, "volatile|inline|_inline|__inline|__forceinline|register|__restrict|__restrict__")) { tok->deleteThis(); } } @@ -9731,24 +9731,29 @@ void Tokenizer::simplifyReturnStrncat() void Tokenizer::printUnknownTypes() { - std::set unknowns; + std::multimap unknowns; for (unsigned int i = 1; i <= _varId; ++i) { const Variable *var = _symbolDatabase->getVariableFromVarId(i); // is unknown type? if (var && !var->type() && !var->typeStartToken()->isStandardType()) { - std::string name; + std::string name; + const Token * nameTok; // single token type? - if (var->typeStartToken() == var->typeEndToken()) + if (var->typeStartToken() == var->typeEndToken()) { name = var->typeStartToken()->str(); + nameTok = var->typeStartToken(); + } // complicated type else { const Token *tok = var->typeStartToken(); int level = 0; + nameTok = tok; + while (tok) { // skip pointer and reference part of type if (level == 0 && (tok->str() == "*" || tok->str() == "&")) @@ -9772,23 +9777,29 @@ void Tokenizer::printUnknownTypes() } } - unknowns.insert(name); + unknowns.insert(std::pair(name, nameTok)); } } if (!unknowns.empty()) { - std::ostringstream ss; + std::multimap::const_iterator it; + std::string last; + size_t count; - ss << unknowns.size() << " unknown types:" << std::endl; - - std::set::const_iterator it; - std::size_t count = 1; - - for (it = unknowns.begin(); it != unknowns.end(); ++it, ++count) - ss << count << ": " << *it << std::endl; - - if (_errorLogger) - _errorLogger->reportOut(ss.str()); + for (it = unknowns.begin(); it != unknowns.end(); ++it) { + // skip types is std namespace because they are not interesting + if (it->first.find("std::") != 0) { + if (it->first != last) { + last = it->first; + count = 1; + reportError(it->second, Severity::debug, "debug", "Unknown type \'" + it->first + "\'."); + } else { + if (count < 3) // limit same type to 3 + reportError(it->second, Severity::debug, "debug", "Unknown type \'" + it->first + "\'."); + count++; + } + } + } } } diff --git a/tools/reduce.cpp b/tools/reduce.cpp index bcff93407..909e42033 100644 --- a/tools/reduce.cpp +++ b/tools/reduce.cpp @@ -28,11 +28,7 @@ class ReduceSettings : public Settings { public: - ReduceSettings() : filename(0), linenr(0), hang(false), maxtime(0) { - addEnabled("all"); - inconclusive = true; - _force = true; - } + ReduceSettings() : filename(0), linenr(0), hang(false), maxtime(0) { } const char *filename; std::size_t linenr; @@ -582,6 +578,8 @@ int main(int argc, char *argv[]) bool print = false; ReduceSettings settings; settings.maxtime = 300; // default timeout = 5 minutes + bool def = false; + bool maxconfigs = false; for (int i = 1, includePathIndex = 0; i < argc; i++) { if (strcmp(argv[i], "--stdout") == 0) @@ -590,11 +588,12 @@ int main(int argc, char *argv[]) settings.hang = true; else if (strncmp(argv[i],"-D", 2) == 0) { if (!settings.userDefines.empty()) - settings.userDefines += " "; + settings.userDefines += ";"; if ((strcmp(argv[i], "-D") == 0) && (i+1] [--inconclusive] [--debug-warnings] [--max-configs=] filename [linenr]" << std::endl; return EXIT_FAILURE; }