diff --git a/cfg/cppcheck-cfg.rng b/cfg/cppcheck-cfg.rng index 7af29dfdf..fd269c63e 100644 --- a/cfg/cppcheck-cfg.rng +++ b/cfg/cppcheck-cfg.rng @@ -442,6 +442,18 @@ + + + + bool + char + short + int + long + long long + + + diff --git a/cfg/std.cfg b/cfg/std.cfg index bf0091e40..0f95f26a1 100644 --- a/cfg/std.cfg +++ b/cfg/std.cfg @@ -7833,21 +7833,21 @@ initializer list (7) string& replace (const_iterator i1, const_iterator i2, init - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + diff --git a/lib/library.cpp b/lib/library.cpp index 4b6951fe0..0f2e0b37c 100644 --- a/lib/library.cpp +++ b/lib/library.cpp @@ -513,6 +513,22 @@ Library::Error Library::load(const tinyxml2::XMLDocument &doc) if (!name) return Error(MISSING_ATTRIBUTE, "name"); PodType podType = {0}; + podType.stdtype = PodType::NO; + const char * const stdtype = node->Attribute("stdtype"); + if (stdtype) { + if (std::strcmp(stdtype, "bool") == 0) + podType.stdtype = PodType::BOOL; + else if (std::strcmp(stdtype, "char") == 0) + podType.stdtype = PodType::CHAR; + else if (std::strcmp(stdtype, "short") == 0) + podType.stdtype = PodType::SHORT; + else if (std::strcmp(stdtype, "int") == 0) + podType.stdtype = PodType::INT; + else if (std::strcmp(stdtype, "long") == 0) + podType.stdtype = PodType::LONG; + else if (std::strcmp(stdtype, "long long") == 0) + podType.stdtype = PodType::LONGLONG; + } const char * const size = node->Attribute("size"); if (size) podType.size = atoi(size); diff --git a/lib/library.h b/lib/library.h index 685dd23bb..f195ed500 100644 --- a/lib/library.h +++ b/lib/library.h @@ -412,6 +412,7 @@ public: struct PodType { unsigned int size; char sign; + enum { NO, BOOL, CHAR, SHORT, INT, LONG, LONGLONG } stdtype; }; const struct PodType *podtype(const std::string &name) const { const std::map::const_iterator it = mPodTypes.find(name); diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index 276b93e27..ac6f9a94f 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -5682,6 +5682,18 @@ bool ValueType::fromLibraryType(const std::string &typestr, const Settings *sett type = ValueType::Type::LONG; else if (podtype->size == settings->sizeof_long_long) type = ValueType::Type::LONGLONG; + else if (podtype->stdtype == Library::PodType::BOOL) + type = ValueType::Type::BOOL; + else if (podtype->stdtype == Library::PodType::CHAR) + type = ValueType::Type::CHAR; + else if (podtype->stdtype == Library::PodType::SHORT) + type = ValueType::Type::SHORT; + else if (podtype->stdtype == Library::PodType::INT) + type = ValueType::Type::INT; + else if (podtype->stdtype == Library::PodType::LONG) + type = ValueType::Type::LONG; + else if (podtype->stdtype == Library::PodType::LONGLONG) + type = ValueType::Type::LONGLONG; else type = ValueType::Type::UNKNOWN_INT; sign = (podtype->sign == 'u') ? ValueType::UNSIGNED : ValueType::SIGNED;