Skip to content

Commit f23df7d

Browse files
committed
nit
1 parent 6939e9c commit f23df7d

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

‎lib/symboldatabase.cpp‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8008,14 +8008,15 @@ void SymbolDatabase::setValueTypeInTokenList(bool reportDebugWarnings, Token *to
80088008
} else break;
80098009
}
80108010
if (mSettings.platform.type != Platform::Type::Unspecified) {
8011+
const bool isDecimal = MathLib::isDec(tokStr) && !MathLib::isOct(tokStr);
80118012
if (type <= ValueType::Type::INT && mSettings.platform.isIntValue(unsignedSuffix ? (value >> 1) : value))
80128013
type = ValueType::Type::INT;
8013-
else if (type <= ValueType::Type::INT && !MathLib::isDec(tokStr) && mSettings.platform.isIntValue(value >> 1)) {
8014+
else if (type <= ValueType::Type::INT && !isDecimal && mSettings.platform.isIntValue(value >> 1)) {
80148015
type = ValueType::Type::INT;
80158016
sign = ValueType::Sign::UNSIGNED;
80168017
} else if (type <= ValueType::Type::LONG && mSettings.platform.isLongValue(unsignedSuffix ? (value >> 1) : value))
80178018
type = ValueType::Type::LONG;
8018-
else if (type <= ValueType::Type::LONG && !MathLib::isDec(tokStr) && mSettings.platform.isLongValue(value >> 1)) {
8019+
else if (type <= ValueType::Type::LONG && !isDecimal && mSettings.platform.isLongValue(value >> 1)) {
80198020
type = ValueType::Type::LONG;
80208021
sign = ValueType::Sign::UNSIGNED;
80218022
} else if (mSettings.platform.isLongLongValue(unsignedSuffix ? (value >> 1) : value))

‎test/testsymboldatabase.cpp‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9929,6 +9929,11 @@ class TestSymbolDatabase : public TestFixture {
99299929
ASSERT_EQUALS("unsigned long long", typeOf("0x100000000U;\n", "0x100000000U", false, &s));
99309930
ASSERT_EQUALS("unsigned long long", typeOf("0x100000000UL;\n", "0x100000000UL", false, &s));
99319931
ASSERT_EQUALS("signed long long", typeOf("0x1FFFFFFFF;\n", "0x1FFFFFFFF", false, &s));
9932+
ASSERT_EQUALS("signed int", typeOf("077777;\n", "077777", false, &s));
9933+
ASSERT_EQUALS("unsigned int", typeOf("0177777;\n", "0177777", false, &s));
9934+
ASSERT_EQUALS("signed long", typeOf("0200000;\n", "0200000", false, &s));
9935+
ASSERT_EQUALS("unsigned long", typeOf("037777777777;\n", "037777777777", false, &s));
9936+
ASSERT_EQUALS("signed long long", typeOf("040000000000;\n", "040000000000", false, &s));
99329937

99339938
ASSERT_EQUALS("signed long", typeOf("2147483648;\n", "2147483648", false, &sSameSize));
99349939
ASSERT_EQUALS("unsigned long", typeOf("0xc000000000000000;\n", "0xc000000000000000", false, &sSameSize));

0 commit comments

Comments
 (0)