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:
orbitcowboy 2019-07-31 11:11:01 +02:00
parent 728ac6ae2e
commit a9bdf99e07
5 changed files with 24 additions and 11 deletions

View File

@ -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); -->

View File

@ -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;
}

View File

@ -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"))