Merge branch 'master' of https://github.com/danmar/cppcheck
This commit is contained in:
commit
4bbe8c28cd
|
@ -683,7 +683,7 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[])
|
|||
_settings->platform(Settings::Unix64);
|
||||
else if (platform == "native")
|
||||
_settings->platform(Settings::Unspecified);
|
||||
else {
|
||||
else if (!_settings->platformFile(platform)) {
|
||||
std::string message("cppcheck: error: unrecognized platform: \"");
|
||||
message += platform;
|
||||
message += "\".";
|
||||
|
@ -898,8 +898,9 @@ void CmdLineParser::PrintHelp()
|
|||
" before skipping it. Default is '12'. If used together\n"
|
||||
" with '--force', the last option is the one that is\n"
|
||||
" effective.\n"
|
||||
" --platform=<type> Specifies platform specific types and sizes. The\n"
|
||||
" available platforms are:\n"
|
||||
" --platform=<type>, --platform=<file>\n"
|
||||
" Specifies platform specific types and sizes. The\n"
|
||||
" available builtin platforms are:\n"
|
||||
" * unix32\n"
|
||||
" 32 bit unix variant\n"
|
||||
" * unix64\n"
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "settings.h"
|
||||
#include "preprocessor.h" // Preprocessor
|
||||
#include "utils.h"
|
||||
#include "tinyxml2.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <set>
|
||||
|
@ -272,8 +273,40 @@ bool Settings::platform(PlatformType type)
|
|||
|
||||
bool Settings::platformFile(const std::string &filename)
|
||||
{
|
||||
(void)filename;
|
||||
/** @todo TBD */
|
||||
// open file..
|
||||
tinyxml2::XMLDocument doc;
|
||||
if (doc.LoadFile(filename.c_str()) != tinyxml2::XML_NO_ERROR)
|
||||
return false;
|
||||
|
||||
return false;
|
||||
const tinyxml2::XMLElement * const rootnode = doc.FirstChildElement();
|
||||
|
||||
if (!rootnode || std::strcmp(rootnode->Name(),"platform") != 0)
|
||||
return false;
|
||||
|
||||
for (const tinyxml2::XMLElement *node = rootnode->FirstChildElement(); node; node = node->NextSiblingElement()) {
|
||||
if (std::strcmp(node->Name(), "defaultSign") == 0)
|
||||
defaultSign = *node->GetText();
|
||||
else if (std::strcmp(node->Name(), "char_bit") == 0)
|
||||
char_bit = std::atoi(node->GetText());
|
||||
else if (std::strcmp(node->Name(), "sizeof") == 0) {
|
||||
for (const tinyxml2::XMLElement *sz = node->FirstChildElement(); sz; sz = sz->NextSiblingElement()) {
|
||||
if (std::strcmp(node->Name(), "short") == 0)
|
||||
sizeof_short = std::atoi(node->GetText());
|
||||
if (std::strcmp(node->Name(), "int") == 0)
|
||||
sizeof_int = std::atoi(node->GetText());
|
||||
if (std::strcmp(node->Name(), "long") == 0)
|
||||
sizeof_long = std::atoi(node->GetText());
|
||||
if (std::strcmp(node->Name(), "long-long") == 0)
|
||||
sizeof_long_long = std::atoi(node->GetText());
|
||||
if (std::strcmp(node->Name(), "float") == 0)
|
||||
sizeof_float = std::atoi(node->GetText());
|
||||
if (std::strcmp(node->Name(), "double") == 0)
|
||||
sizeof_double = std::atoi(node->GetText());
|
||||
if (std::strcmp(node->Name(), "pointer") == 0)
|
||||
sizeof_pointer = std::atoi(node->GetText());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue