MathLib::intsuffix: Added support for LLU and LU suffixes.

This commit is contained in:
Martin Ettl 2015-06-16 19:12:18 +02:00
parent 227b48212e
commit 9b14ab15eb
3 changed files with 21 additions and 5 deletions

View File

@ -547,11 +547,13 @@ static std::string intsuffix(const std::string & first, const std::string & seco
suffix2 = c + suffix2; suffix2 = c + suffix2;
} }
if (suffix1 == "ULL" || suffix2 == "ULL") if (suffix1 == "ULL" || suffix2 == "ULL"
|| suffix1 == "LLU" || suffix2 == "LLU")
return "ULL"; return "ULL";
if (suffix1 == "LL" || suffix2 == "LL") if (suffix1 == "LL" || suffix2 == "LL")
return "LL"; return "LL";
if (suffix1 == "UL" || suffix2 == "UL") if (suffix1 == "UL" || suffix2 == "UL"
|| suffix1 == "LU" || suffix2 == "LU")
return "UL"; return "UL";
if (suffix1 == "L" || suffix2 == "L") if (suffix1 == "L" || suffix2 == "L")
return "L"; return "L";

View File

@ -2036,7 +2036,7 @@ void Tokenizer::simplifySQL()
void Tokenizer::simplifyDebugNew() void Tokenizer::simplifyDebugNew()
{ {
if (isC()) if (isC())
return; return;
if (!_settings->isWindowsPlatform()) if (!_settings->isWindowsPlatform())
return; return;
@ -9694,7 +9694,7 @@ void Tokenizer::simplifyNamespaceStd()
// Remove Microsoft MFC 'DECLARE_MESSAGE_MAP()' // Remove Microsoft MFC 'DECLARE_MESSAGE_MAP()'
void Tokenizer::simplifyMicrosoftMFC() void Tokenizer::simplifyMicrosoftMFC()
{ {
if (isC()) if (isC())
return; return;
// skip if not Windows // skip if not Windows
if (!_settings->isWindowsPlatform()) if (!_settings->isWindowsPlatform())
@ -9890,7 +9890,7 @@ void Tokenizer::simplifyBorland()
// Remove Qt signals and slots // Remove Qt signals and slots
void Tokenizer::simplifyQtSignalsSlots() void Tokenizer::simplifyQtSignalsSlots()
{ {
if (isC()) if (isC())
return; return;
for (Token *tok = list.front(); tok; tok = tok->next()) { for (Token *tok = list.front(); tok; tok = tok->next()) {
// check for emit which can be outside of class // check for emit which can be outside of class

View File

@ -189,6 +189,13 @@ private:
ASSERT_EQUALS("2LL", MathLib::add("1LL", "1UL")); ASSERT_EQUALS("2LL", MathLib::add("1LL", "1UL"));
ASSERT_EQUALS("2ULL", MathLib::add("1ULL", "1UL")); ASSERT_EQUALS("2ULL", MathLib::add("1ULL", "1UL"));
ASSERT_EQUALS("2UL", MathLib::add("1", "1LU"));
ASSERT_EQUALS("2UL", MathLib::add("1U", "1LU"));
ASSERT_EQUALS("2UL", MathLib::add("1L", "1LU"));
ASSERT_EQUALS("2UL", MathLib::add("1UL", "1LU"));
ASSERT_EQUALS("2LL", MathLib::add("1LL", "1LU"));
ASSERT_EQUALS("2ULL", MathLib::add("1ULL", "1LU"));
ASSERT_EQUALS("2LL", MathLib::add("1", "1LL")); ASSERT_EQUALS("2LL", MathLib::add("1", "1LL"));
ASSERT_EQUALS("2LL", MathLib::add("1U", "1LL")); ASSERT_EQUALS("2LL", MathLib::add("1U", "1LL"));
ASSERT_EQUALS("2LL", MathLib::add("1L", "1LL")); ASSERT_EQUALS("2LL", MathLib::add("1L", "1LL"));
@ -202,6 +209,13 @@ private:
ASSERT_EQUALS("2ULL", MathLib::add("1UL", "1ULL")); ASSERT_EQUALS("2ULL", MathLib::add("1UL", "1ULL"));
ASSERT_EQUALS("2ULL", MathLib::add("1LL", "1ULL")); ASSERT_EQUALS("2ULL", MathLib::add("1LL", "1ULL"));
ASSERT_EQUALS("2ULL", MathLib::add("1ULL", "1ULL")); ASSERT_EQUALS("2ULL", MathLib::add("1ULL", "1ULL"));
ASSERT_EQUALS("2ULL", MathLib::add("1", "1LLU"));
ASSERT_EQUALS("2ULL", MathLib::add("1U", "1LLU"));
ASSERT_EQUALS("2ULL", MathLib::add("1L", "1LLU"));
ASSERT_EQUALS("2ULL", MathLib::add("1UL", "1LLU"));
ASSERT_EQUALS("2ULL", MathLib::add("1LL", "1LLU"));
ASSERT_EQUALS("2ULL", MathLib::add("1ULL", "1LLU"));
} }
void convert() const { void convert() const {