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 |
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... | |
nonneg int | sizeof_bool |
bits in long long More... | |
nonneg int | sizeof_short |
nonneg int | sizeof_int |
nonneg int | sizeof_long |
nonneg int | sizeof_long_long |
nonneg int | sizeof_float |
nonneg int | sizeof_double |
nonneg int | sizeof_long_double |
nonneg int | sizeof_wchar_t |
nonneg int | sizeof_size_t |
nonneg int | sizeof_pointer |
char | defaultSign |
Type | type |
platform type 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.
Enumerator | |
---|---|
Unspecified | |
Native | |
Win32A | |
Win32W | |
Win64 | |
Unix32 | |
Unix64 | |
File |
Definition at line 103 of file platform.h.
Platform::Platform | ( | ) |
Definition at line 30 of file platform.cpp.
References set().
|
inline |
Definition at line 59 of file platform.h.
Referenced by CheckType::checkLongCast(), getEnumType(), and SymbolDatabase::setValueTypeInTokenList().
|
inline |
Definition at line 63 of file platform.h.
|
inline |
Definition at line 77 of file platform.h.
Referenced by SymbolDatabase::setValueTypeInTokenList().
|
inline |
Definition at line 68 of file platform.h.
Referenced by getEnumType(), and SymbolDatabase::setValueTypeInTokenList().
|
inline |
Definition at line 72 of file platform.h.
|
inline |
Returns true if platform type is Windows.
Definition at line 139 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(), and Path::getPathFromFilename().
Referenced by MainWindow::getCppcheckSettings(), and ProjectFileDialog::ProjectFileDialog().
bool Platform::loadFromXmlDocument | ( | const tinyxml2::XMLDocument * | doc | ) |
load platform from xml document, primarily for testing
Definition at line 243 of file platform.cpp.
References error, and xmlTextAsUInt().
|
inlinestaticprivate |
Definition at line 51 of file platform.h.
|
inlinestaticprivate |
Definition at line 45 of file platform.h.
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.
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.
Referenced by CppCheck::check(), MainWindow::getCppcheckSettings(), CmdLineParser::parseFromArgs(), and Platform().
|
inline |
Definition at line 176 of file platform.h.
Referenced by setTokenValueCast().
|
inline |
Definition at line 180 of file platform.h.
Referenced by CheckFunctions::memsetInvalid2ndParam(), and setTokenValueCast().
|
inline |
Definition at line 145 of file platform.h.
References toString().
Referenced by CppCheck::checkFile(), createDumpFile(), ValueType::fromLibraryType(), MainWindow::getCppcheckSettings(), ProjectFileDialog::loadFromProjectFile(), and ProjectFileDialog::saveToProjectFile().
|
inlinestatic |
Definition at line 149 of file platform.h.
|
inline |
Definition at line 172 of file platform.h.
Referenced by CheckFunctions::memsetInvalid2ndParam().
nonneg int cppcheck::Platform::char_bit |
Definition at line 82 of file platform.h.
Referenced by CheckCondition::checkCompareValueOutOfTypeRange(), CheckType::checkFloatToIntegerOverflow(), createDumpFile(), getMinMaxValues(), SymbolDatabase::setArrayDimensionsUsingValueFlow(), and setTokenValueCast().
char cppcheck::Platform::defaultSign |
Definition at line 101 of file platform.h.
Referenced by ValueType::parseDecl(), and SymbolDatabase::SymbolDatabase().
nonneg int cppcheck::Platform::int_bit |
bits in short
Definition at line 84 of file platform.h.
Referenced by CheckCondition::checkCompareValueOutOfTypeRange(), CheckType::checkFloatToIntegerOverflow(), CheckType::checkIntegerOverflow(), CheckType::checkTooBigBitwiseShift(), createDumpFile(), getMinMaxValues(), SymbolDatabase::setArrayDimensionsUsingValueFlow(), setTokenValueCast(), and valueFlowRightShift().
nonneg int cppcheck::Platform::long_bit |
bits in int
Definition at line 85 of file platform.h.
Referenced by CheckCondition::checkCompareValueOutOfTypeRange(), CheckType::checkFloatToIntegerOverflow(), CheckType::checkIntegerOverflow(), CheckType::checkTooBigBitwiseShift(), createDumpFile(), getMinMaxValues(), SymbolDatabase::setArrayDimensionsUsingValueFlow(), setTokenValueCast(), and valueFlowRightShift().
nonneg int cppcheck::Platform::long_long_bit |
bits in long
Definition at line 86 of file platform.h.
Referenced by CheckCondition::checkCompareValueOutOfTypeRange(), CheckType::checkFloatToIntegerOverflow(), CheckType::checkIntegerOverflow(), CheckType::checkTooBigBitwiseShift(), createDumpFile(), getMinMaxValues(), SymbolDatabase::setArrayDimensionsUsingValueFlow(), setTokenValueCast(), and valueFlowRightShift().
nonneg int cppcheck::Platform::short_bit |
bits in char
Definition at line 83 of file platform.h.
Referenced by CheckCondition::checkCompareValueOutOfTypeRange(), CheckType::checkFloatToIntegerOverflow(), createDumpFile(), getMinMaxValues(), SymbolDatabase::setArrayDimensionsUsingValueFlow(), and setTokenValueCast().
nonneg int cppcheck::Platform::sizeof_bool |
bits in long long
size of standard types
Definition at line 89 of file platform.h.
Referenced by Tokenizer::fillTypeSizes(), Preprocessor::setPlatformInfo(), and ValueType::typeSize().
nonneg int cppcheck::Platform::sizeof_double |
Definition at line 95 of file platform.h.
Referenced by Tokenizer::fillTypeSizes(), ValueFlow::getSizeOf(), Preprocessor::setPlatformInfo(), and ValueType::typeSize().
nonneg int cppcheck::Platform::sizeof_float |
Definition at line 94 of file platform.h.
Referenced by Tokenizer::fillTypeSizes(), ValueFlow::getSizeOf(), Preprocessor::setPlatformInfo(), and ValueType::typeSize().
nonneg int cppcheck::Platform::sizeof_int |
Definition at line 91 of file platform.h.
Referenced by Tokenizer::fillTypeSizes(), ValueType::fromLibraryType(), ValueFlow::getSizeOf(), Preprocessor::setPlatformInfo(), SymbolDatabase::sizeOfType(), ValueType::typeSize(), and valueFlowSetConstantValue().
nonneg int cppcheck::Platform::sizeof_long |
Definition at line 92 of file platform.h.
Referenced by CheckIO::ArgumentInfo::ArgumentInfo(), Tokenizer::fillTypeSizes(), ValueType::fromLibraryType(), ValueFlow::getSizeOf(), Preprocessor::setPlatformInfo(), and ValueType::typeSize().
nonneg int cppcheck::Platform::sizeof_long_double |
Definition at line 96 of file platform.h.
Referenced by Tokenizer::fillTypeSizes(), ValueFlow::getSizeOf(), Preprocessor::setPlatformInfo(), Tokenizer::sizeOfType(), and ValueType::typeSize().
nonneg int cppcheck::Platform::sizeof_long_long |
Definition at line 93 of file platform.h.
Referenced by Tokenizer::fillTypeSizes(), ValueType::fromLibraryType(), ValueFlow::getSizeOf(), Preprocessor::setPlatformInfo(), Tokenizer::sizeOfType(), and ValueType::typeSize().
nonneg int cppcheck::Platform::sizeof_pointer |
Definition at line 99 of file platform.h.
Referenced by CheckMemoryLeakNoVar::checkForUnreleasedInputArgument(), CheckOther::checkIncompleteArrayFill(), CheckOther::checkPassByReference(), createDumpFile(), estimateSize(), Tokenizer::fillTypeSizes(), CheckBufferOverrun::getBufferSize(), ValueFlow::getSizeOf(), CheckLeakAutoVar::ret(), Preprocessor::setPlatformInfo(), and ValueType::typeSize().
nonneg int cppcheck::Platform::sizeof_short |
Definition at line 90 of file platform.h.
Referenced by Tokenizer::fillTypeSizes(), ValueType::fromLibraryType(), ValueFlow::getSizeOf(), Preprocessor::setPlatformInfo(), and ValueType::typeSize().
nonneg int cppcheck::Platform::sizeof_size_t |
Definition at line 98 of file platform.h.
Referenced by CheckIO::ArgumentInfo::ArgumentInfo(), Tokenizer::fillTypeSizes(), and ValueType::fromLibraryType().
nonneg int cppcheck::Platform::sizeof_wchar_t |
Definition at line 97 of file platform.h.
Referenced by Tokenizer::fillTypeSizes(), ValueFlow::getSizeOf(), ValueType::typeSize(), and valueFlowSetConstantValue().
Type cppcheck::Platform::type |
platform type
Definition at line 115 of file platform.h.
Referenced by CheckCondition::checkCompareValueOutOfTypeRange(), CheckType::checkFloatToIntegerOverflow(), CheckType::checkIntegerOverflow(), CheckType::checkTooBigBitwiseShift(), MainWindow::getCppcheckSettings(), CmdLineParser::parseFromArgs(), SymbolDatabase::setValueTypeInTokenList(), valueFlowSafeFunctions(), and valueFlowSetConstantValue().