Cppcheck
|
#include <platform.h>
Public Types | |
enum | Type { Unspecified , Native , Win32A , Win32W , Win64 , Unix32 , Unix64 , File } |
Public Member Functions | |
Platform () | |
bool | isIntValue (long long value) const |
bool | isIntValue (unsigned long long value) const |
bool | isLongValue (long long value) const |
bool | isLongValue (unsigned long long value) const |
bool | isLongLongValue (unsigned long long value) const |
bool | set (Type t) |
set the platform type for predefined platforms - deprecated use set(const std::string&, std::string&) instead More... | |
bool | set (const std::string &platformstr, std::string &errstr, const std::vector< std::string > &paths={}, bool verbose=false) |
set the platform type More... | |
bool | loadFromFile (const char exename[], const std::string &filename, bool verbose=false) |
load platform file More... | |
bool | loadFromXmlDocument (const tinyxml2::XMLDocument *doc) |
load platform from xml document, primarily for testing More... | |
bool | isWindows () const |
Returns true if platform type is Windows. More... | |
const char * | toString () const |
long long | unsignedCharMax () const |
long long | signedCharMax () const |
long long | signedCharMin () const |
std::string | getLimitsDefines (Standards::cstd_t cstd) const |
provides list of defines specified by the limit.h/climits includes More... | |
std::string | getLimitsDefines (Standards::cppstd_t cppstd) const |
provides list of defines specified by the limit.h/climits includes More... | |
Static Public Member Functions | |
static const char * | toString (Type pt) |
Public Attributes | |
nonneg int | char_bit |
nonneg int | short_bit |
bits in char More... | |
nonneg int | int_bit |
bits in short More... | |
nonneg int | long_bit |
bits in int More... | |
nonneg int | long_long_bit |
bits in long More... | |
std::size_t | sizeof_bool |
bits in long long More... | |
std::size_t | sizeof_short |
std::size_t | sizeof_int |
std::size_t | sizeof_long |
std::size_t | sizeof_long_long |
std::size_t | sizeof_float |
std::size_t | sizeof_double |
std::size_t | sizeof_long_double |
std::size_t | sizeof_wchar_t |
std::size_t | sizeof_size_t |
std::size_t | sizeof_pointer |
char | defaultSign |
Type | type |
platform type More... | |
Private Member Functions | |
std::string | getLimitsDefines (bool c99) const |
provides list of defines specified by the limit.h/climits includes More... | |
Static Private Member Functions | |
static long long | min_value (int bit) |
static long long | max_value (int bit) |
Platform settings.
Definition at line 43 of file platform.h.
enum Platform::Type |
Enumerator | |
---|---|
Unspecified | |
Native | |
Win32A | |
Win32W | |
Win64 | |
Unix32 | |
Unix64 | |
File |
Definition at line 106 of file platform.h.
Platform::Platform | ( | ) |
Definition at line 30 of file platform.cpp.
References set().
|
private |
provides list of defines specified by the limit.h/climits includes
Definition at line 298 of file platform.cpp.
References char_bit, defaultSign, int_bit, long_bit, long_long_bit, max_value(), min_value(), and short_bit.
Referenced by createDUI(), and getLimitsDefines().
std::string Platform::getLimitsDefines | ( | Standards::cppstd_t | cppstd | ) | const |
provides list of defines specified by the limit.h/climits includes
Definition at line 443 of file platform.cpp.
References getLimitsDefines().
std::string Platform::getLimitsDefines | ( | Standards::cstd_t | cstd | ) | const |
provides list of defines specified by the limit.h/climits includes
Definition at line 438 of file platform.cpp.
References getLimitsDefines().
|
inline |
Definition at line 62 of file platform.h.
Referenced by CheckType::checkLongCast(), getEnumType(), and SymbolDatabase::setValueTypeInTokenList().
|
inline |
Definition at line 66 of file platform.h.
|
inline |
Definition at line 80 of file platform.h.
Referenced by SymbolDatabase::setValueTypeInTokenList().
|
inline |
Definition at line 71 of file platform.h.
Referenced by getEnumType(), and SymbolDatabase::setValueTypeInTokenList().
|
inline |
Definition at line 75 of file platform.h.
|
inline |
Returns true if platform type is Windows.
Definition at line 142 of file platform.h.
Referenced by CheckIO::checkFileUsage(), CheckIO::checkFormatString(), CheckOther::checkInterlockedDecrement(), CheckIO::checkWrongPrintfScanfArguments(), and Tokenizer::combineStringAndCharLiterals().
bool Platform::loadFromFile | ( | const char | exename[], |
const std::string & | filename, | ||
bool | verbose = false |
||
) |
load platform file
exename | application path |
filename | platform filename |
verbose | log verbose information about the lookup |
Definition at line 192 of file platform.cpp.
References Path::fromNativeSeparators(), Path::getPathFromFilename(), and loadFromXmlDocument().
Referenced by MainWindow::getCppcheckSettings(), ProjectFileDialog::ProjectFileDialog(), and set().
bool Platform::loadFromXmlDocument | ( | const tinyxml2::XMLDocument * | doc | ) |
load platform from xml document, primarily for testing
Definition at line 244 of file platform.cpp.
References char_bit, defaultSign, error, int_bit, long_bit, long_long_bit, short_bit, sizeof_bool, sizeof_double, sizeof_float, sizeof_int, sizeof_long, sizeof_long_double, sizeof_long_long, sizeof_pointer, sizeof_short, sizeof_size_t, sizeof_wchar_t, type, and xmlTextAsUInt().
Referenced by loadFromFile().
|
inlinestaticprivate |
Definition at line 51 of file platform.h.
Referenced by getLimitsDefines().
|
inlinestaticprivate |
Definition at line 45 of file platform.h.
Referenced by getLimitsDefines().
bool Platform::set | ( | const std::string & | platformstr, |
std::string & | errstr, | ||
const std::vector< std::string > & | paths = {} , |
||
bool | verbose = false |
||
) |
set the platform type
Definition at line 153 of file platform.cpp.
References loadFromFile(), and set().
bool Platform::set | ( | Type | t | ) |
set the platform type for predefined platforms - deprecated use set(const std::string&, std::string&) instead
Definition at line 36 of file platform.cpp.
References char_bit, defaultSign, int_bit, long_bit, long_long_bit, short_bit, sizeof_bool, sizeof_double, sizeof_float, sizeof_int, sizeof_long, sizeof_long_double, sizeof_long_long, sizeof_pointer, sizeof_short, sizeof_size_t, sizeof_wchar_t, and type.
Referenced by CppCheck::check(), MainWindow::getCppcheckSettings(), CmdLineParser::parseFromArgs(), Platform(), and set().
|
inline |
Definition at line 179 of file platform.h.
Referenced by setTokenValueCast().
|
inline |
Definition at line 183 of file platform.h.
Referenced by CheckFunctions::memsetInvalid2ndParam(), and setTokenValueCast().
|
inline |
Definition at line 148 of file platform.h.
References toString().
Referenced by CppCheck::checkFile(), createDumpFile(), ValueType::fromLibraryType(), MainWindow::getCppcheckSettings(), ProjectFileDialog::loadFromProjectFile(), and ProjectFileDialog::saveToProjectFile().
|
inlinestatic |
Definition at line 152 of file platform.h.
|
inline |
Definition at line 175 of file platform.h.
Referenced by CheckFunctions::memsetInvalid2ndParam().
nonneg int Platform::char_bit |
Definition at line 85 of file platform.h.
Referenced by CheckCondition::checkCompareValueOutOfTypeRange(), CheckType::checkFloatToIntegerOverflow(), createDumpFile(), getLimitsDefines(), getMinMaxValues(), loadFromXmlDocument(), set(), SymbolDatabase::setArrayDimensionsUsingValueFlow(), and setTokenValueCast().
char Platform::defaultSign |
Definition at line 104 of file platform.h.
Referenced by getLimitsDefines(), loadFromXmlDocument(), ValueType::parseDecl(), CmdLineParser::parseFromArgs(), set(), and SymbolDatabase::SymbolDatabase().
nonneg int Platform::int_bit |
bits in short
Definition at line 87 of file platform.h.
Referenced by CheckCondition::checkCompareValueOutOfTypeRange(), CheckType::checkFloatToIntegerOverflow(), CheckType::checkIntegerOverflow(), CheckType::checkTooBigBitwiseShift(), createDumpFile(), getLimitsDefines(), getMinMaxValues(), loadFromXmlDocument(), set(), SymbolDatabase::setArrayDimensionsUsingValueFlow(), setTokenValueCast(), and valueFlowRightShift().
nonneg int Platform::long_bit |
bits in int
Definition at line 88 of file platform.h.
Referenced by CheckCondition::checkCompareValueOutOfTypeRange(), CheckType::checkFloatToIntegerOverflow(), CheckType::checkIntegerOverflow(), CheckType::checkTooBigBitwiseShift(), createDumpFile(), getLimitsDefines(), getMinMaxValues(), loadFromXmlDocument(), set(), SymbolDatabase::setArrayDimensionsUsingValueFlow(), setTokenValueCast(), and valueFlowRightShift().
nonneg int Platform::long_long_bit |
bits in long
Definition at line 89 of file platform.h.
Referenced by CheckCondition::checkCompareValueOutOfTypeRange(), CheckType::checkFloatToIntegerOverflow(), CheckType::checkIntegerOverflow(), CheckType::checkTooBigBitwiseShift(), createDumpFile(), getLimitsDefines(), getMinMaxValues(), loadFromXmlDocument(), set(), SymbolDatabase::setArrayDimensionsUsingValueFlow(), setTokenValueCast(), and valueFlowRightShift().
nonneg int Platform::short_bit |
bits in char
Definition at line 86 of file platform.h.
Referenced by CheckCondition::checkCompareValueOutOfTypeRange(), CheckType::checkFloatToIntegerOverflow(), createDumpFile(), getLimitsDefines(), getMinMaxValues(), loadFromXmlDocument(), set(), SymbolDatabase::setArrayDimensionsUsingValueFlow(), and setTokenValueCast().
std::size_t Platform::sizeof_bool |
bits in long long
size of standard types
Definition at line 92 of file platform.h.
Referenced by Tokenizer::fillTypeSizes(), loadFromXmlDocument(), set(), Preprocessor::setPlatformInfo(), and ValueType::typeSize().
std::size_t Platform::sizeof_double |
Definition at line 98 of file platform.h.
Referenced by Tokenizer::fillTypeSizes(), ValueFlow::getSizeOf(), loadFromXmlDocument(), set(), Preprocessor::setPlatformInfo(), and ValueType::typeSize().
std::size_t Platform::sizeof_float |
Definition at line 97 of file platform.h.
Referenced by Tokenizer::fillTypeSizes(), ValueFlow::getSizeOf(), loadFromXmlDocument(), set(), Preprocessor::setPlatformInfo(), and ValueType::typeSize().
std::size_t Platform::sizeof_int |
Definition at line 94 of file platform.h.
Referenced by Tokenizer::fillTypeSizes(), ValueType::fromLibraryType(), ValueFlow::getSizeOf(), loadFromXmlDocument(), set(), Preprocessor::setPlatformInfo(), SymbolDatabase::sizeOfType(), ValueType::typeSize(), and valueFlowSetConstantValue().
std::size_t Platform::sizeof_long |
Definition at line 95 of file platform.h.
Referenced by CheckIO::ArgumentInfo::ArgumentInfo(), Tokenizer::fillTypeSizes(), ValueType::fromLibraryType(), ValueFlow::getSizeOf(), loadFromXmlDocument(), set(), Preprocessor::setPlatformInfo(), and ValueType::typeSize().
std::size_t Platform::sizeof_long_double |
Definition at line 99 of file platform.h.
Referenced by Tokenizer::fillTypeSizes(), ValueFlow::getSizeOf(), loadFromXmlDocument(), set(), Preprocessor::setPlatformInfo(), Tokenizer::sizeOfType(), and ValueType::typeSize().
std::size_t Platform::sizeof_long_long |
Definition at line 96 of file platform.h.
Referenced by Tokenizer::fillTypeSizes(), ValueType::fromLibraryType(), ValueFlow::getSizeOf(), loadFromXmlDocument(), set(), Preprocessor::setPlatformInfo(), Tokenizer::sizeOfType(), and ValueType::typeSize().
std::size_t Platform::sizeof_pointer |
Definition at line 102 of file platform.h.
Referenced by CheckMemoryLeakNoVar::checkForUnreleasedInputArgument(), CheckOther::checkIncompleteArrayFill(), CheckOther::checkPassByReference(), CheckOther::checkRedundantCopy(), CheckClass::checkReturnByReference(), createDumpFile(), Tokenizer::fillTypeSizes(), getAlignOf(), CheckBufferOverrun::getBufferSize(), ValueFlow::getSizeOf(), loadFromXmlDocument(), CheckLeakAutoVar::ret(), set(), Preprocessor::setPlatformInfo(), and ValueType::typeSize().
std::size_t Platform::sizeof_short |
Definition at line 93 of file platform.h.
Referenced by Tokenizer::fillTypeSizes(), ValueType::fromLibraryType(), ValueFlow::getSizeOf(), loadFromXmlDocument(), set(), Preprocessor::setPlatformInfo(), and ValueType::typeSize().
std::size_t Platform::sizeof_size_t |
Definition at line 101 of file platform.h.
Referenced by CheckIO::ArgumentInfo::ArgumentInfo(), Tokenizer::fillTypeSizes(), ValueType::fromLibraryType(), loadFromXmlDocument(), and set().
std::size_t Platform::sizeof_wchar_t |
Definition at line 100 of file platform.h.
Referenced by Tokenizer::fillTypeSizes(), ValueFlow::getSizeOf(), loadFromXmlDocument(), set(), ValueType::typeSize(), and valueFlowSetConstantValue().
Type Platform::type |
platform type
Definition at line 118 of file platform.h.
Referenced by CheckCondition::checkCompareValueOutOfTypeRange(), CheckType::checkFloatToIntegerOverflow(), CheckType::checkIntegerOverflow(), CheckType::checkTooBigBitwiseShift(), MainWindow::getCppcheckSettings(), loadFromXmlDocument(), CmdLineParser::parseFromArgs(), set(), SymbolDatabase::setValueTypeInTokenList(), valueFlowSafeFunctions(), and valueFlowSetConstantValue().