std.cfg: Added *experimental* support for math constants liken M_PI. These are *NOT* standard, but they are supported by GCC/Clang and VS.
This commit is contained in:
parent
728ac6ae2e
commit
a9bdf99e07
13
cfg/std.cfg
13
cfg/std.cfg
|
@ -36,6 +36,19 @@
|
|||
<define name="UINT_LEAST16_MAX" value="65535"/>
|
||||
<define name="UINT_LEAST32_MAX" value="4294967295"/>
|
||||
<define name="UINT_LEAST64_MAX" value="18446744073709551615"/>
|
||||
<define name="M_E" value="2.7182818284590452354"/>
|
||||
<define name="M_LOG2E" value="1.4426950408889634074"/>
|
||||
<define name="M_LOG10E" value="0.43429448190325182765"/>
|
||||
<define name="M_LN2" value="0.69314718055994530942"/>
|
||||
<define name="M_LN10" value="2.30258509299404568402"/>
|
||||
<define name="M_PI" value="3.14159265358979323846"/>
|
||||
<define name="M_PI_2" value="1.57079632679489661923"/>
|
||||
<define name="M_PI_4" value="0.78539816339744830962"/>
|
||||
<define name="M_1_PI" value="0.31830988618379067154"/>
|
||||
<define name="M_2_PI" value="0.63661977236758134308"/>
|
||||
<define name="M_2_SQRTPI" value="1.12837916709551257390"/>
|
||||
<define name="M_SQRT2" value="1.41421356237309504880"/>
|
||||
<define name="M_SQRT1_2" value="0.70710678118654752440"/>
|
||||
<!-- errno_t is a typedef for int -->
|
||||
<define name="errno_t" value="int"/>
|
||||
<!-- void abort(void); -->
|
||||
|
|
|
@ -3381,9 +3381,9 @@ void TemplateSimplifier::simplifyTemplates(
|
|||
unsigned int passCount = 0;
|
||||
const unsigned int passCountMax = 10;
|
||||
for (; passCount < passCountMax; ++passCount) {
|
||||
for (auto tok = mTokenizer->list.front(); tok; tok = tok->next()) tok->scopeInfo(nullptr);
|
||||
mTokenizer->calculateScopes();
|
||||
|
||||
for (auto tok = mTokenizer->list.front(); tok; tok = tok->next()) tok->scopeInfo(nullptr);
|
||||
mTokenizer->calculateScopes();
|
||||
|
||||
if (passCount) {
|
||||
// it may take more than one pass to simplify type aliases
|
||||
bool usingChanged = false;
|
||||
|
|
|
@ -1075,8 +1075,7 @@ void Token::insertToken(const std::string &tokenStr, const std::string &original
|
|||
} else {
|
||||
if (prepend && newToken->previous()) {
|
||||
newToken->mImpl->mScopeInfo = newToken->previous()->scopeInfo();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
newToken->mImpl->mScopeInfo = mImpl->mScopeInfo;
|
||||
}
|
||||
if (tokenStr == ";") {
|
||||
|
@ -1975,10 +1974,12 @@ std::string Token::typeStr(const Token* tok)
|
|||
return r.first->stringifyList(r.second, false);
|
||||
}
|
||||
|
||||
void Token::scopeInfo(std::shared_ptr<ScopeInfo2> newScopeInfo) {
|
||||
void Token::scopeInfo(std::shared_ptr<ScopeInfo2> newScopeInfo)
|
||||
{
|
||||
mImpl->mScopeInfo = newScopeInfo;
|
||||
}
|
||||
std::shared_ptr<ScopeInfo2> Token::scopeInfo() const {
|
||||
std::shared_ptr<ScopeInfo2> Token::scopeInfo() const
|
||||
{
|
||||
return mImpl->mScopeInfo;
|
||||
}
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ struct TokenImpl {
|
|||
|
||||
// Pointer to the object representing this token's scope
|
||||
std::shared_ptr<ScopeInfo2> mScopeInfo;
|
||||
|
||||
|
||||
// __cppcheck_in_range__
|
||||
struct CppcheckAttributes {
|
||||
enum Type {LOW,HIGH} type;
|
||||
|
@ -1200,7 +1200,7 @@ public:
|
|||
void printAst(bool verbose, bool xml, std::ostream &out) const;
|
||||
|
||||
void printValueFlow(bool xml, std::ostream &out) const;
|
||||
|
||||
|
||||
void scopeInfo(std::shared_ptr<ScopeInfo2> newScopeInfo);
|
||||
std::shared_ptr<ScopeInfo2> scopeInfo() const;
|
||||
};
|
||||
|
|
|
@ -2880,8 +2880,7 @@ void Tokenizer::calculateScopes()
|
|||
if (nextScopeNameAddition.length() > 0) nextScopeNameAddition = nextScopeNameAddition.substr(0, nextScopeNameAddition.length() - 1);
|
||||
}
|
||||
|
||||
if (Token::simpleMatch(tok, "{"))
|
||||
{
|
||||
if (Token::simpleMatch(tok, "{")) {
|
||||
// This might be the opening of a member function
|
||||
Token *tok1 = tok;
|
||||
while (Token::Match(tok1->previous(), "const|volatile|final|override|&|&&|noexcept"))
|
||||
|
|
Loading…
Reference in New Issue