Fixed #6229 (Move Windows builtin types __intXX to library)
This commit is contained in:
parent
d8b50e73df
commit
42f709c09d
|
@ -1,5 +1,26 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<def format="1">
|
<def format="1">
|
||||||
|
<platformtype name="__int8" value="char">
|
||||||
|
<platform type="win32A"/>
|
||||||
|
<platform type="win32W"/>
|
||||||
|
<platform type="win64"/>
|
||||||
|
</platformtype>
|
||||||
|
<platformtype name="__int16" value="short">
|
||||||
|
<platform type="win32A"/>
|
||||||
|
<platform type="win32W"/>
|
||||||
|
<platform type="win64"/>
|
||||||
|
</platformtype>
|
||||||
|
<platformtype name="__int32" value="int">
|
||||||
|
<platform type="win32A"/>
|
||||||
|
<platform type="win32W"/>
|
||||||
|
<platform type="win64"/>
|
||||||
|
</platformtype>
|
||||||
|
<platformtype name="__int64" value="long">
|
||||||
|
<platform type="win32A"/>
|
||||||
|
<platform type="win32W"/>
|
||||||
|
<platform type="win64"/>
|
||||||
|
<long/>
|
||||||
|
</platformtype>
|
||||||
<platformtype name="ACCESS_MASK" value="long">
|
<platformtype name="ACCESS_MASK" value="long">
|
||||||
<platform type="win32A"/>
|
<platform type="win32A"/>
|
||||||
<platform type="win32W"/>
|
<platform type="win32W"/>
|
||||||
|
|
|
@ -5662,8 +5662,6 @@ void Tokenizer::simplifyPlatformTypes()
|
||||||
for (Token *tok = list.front(); tok; tok = tok->next()) {
|
for (Token *tok = list.front(); tok; tok = tok->next()) {
|
||||||
if (tok->type() != Token::eType && tok->type() != Token::eName)
|
if (tok->type() != Token::eType && tok->type() != Token::eName)
|
||||||
continue;
|
continue;
|
||||||
if (!tok->isUpperCaseName()) // All WinAPI types are uppercase. Reduce number of Token::Match calls by this condition.
|
|
||||||
continue;
|
|
||||||
|
|
||||||
const Library::PlatformType * const platformtype = _settings->library.platform_type(tok->str(), platform_type);
|
const Library::PlatformType * const platformtype = _settings->library.platform_type(tok->str(), platform_type);
|
||||||
|
|
||||||
|
@ -5712,14 +5710,14 @@ void Tokenizer::simplifyStdType()
|
||||||
{
|
{
|
||||||
for (Token *tok = list.front(); tok; tok = tok->next()) {
|
for (Token *tok = list.front(); tok; tok = tok->next()) {
|
||||||
// long unsigned => unsigned long
|
// long unsigned => unsigned long
|
||||||
if (Token::Match(tok, "char|short|int|long|__int8|__int16|__int32|__int64 unsigned|signed")) {
|
if (Token::Match(tok, "char|short|int|long unsigned|signed")) {
|
||||||
bool isUnsigned = tok->next()->str() == "unsigned";
|
bool isUnsigned = tok->next()->str() == "unsigned";
|
||||||
tok->deleteNext();
|
tok->deleteNext();
|
||||||
tok->isUnsigned(isUnsigned);
|
tok->isUnsigned(isUnsigned);
|
||||||
tok->isSigned(!isUnsigned);
|
tok->isSigned(!isUnsigned);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (!Token::Match(tok, "unsigned|signed|char|short|int|long|__int8|__int16|__int32|__int64"))
|
else if (!Token::Match(tok, "unsigned|signed|char|short|int|long"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// check if signed or unsigned specified
|
// check if signed or unsigned specified
|
||||||
|
@ -5727,7 +5725,7 @@ void Tokenizer::simplifyStdType()
|
||||||
bool isUnsigned = tok->str() == "unsigned";
|
bool isUnsigned = tok->str() == "unsigned";
|
||||||
|
|
||||||
// unsigned i => unsigned int i
|
// unsigned i => unsigned int i
|
||||||
if (!Token::Match(tok->next(), "char|short|int|long|__int8|__int16|__int32|__int64"))
|
if (!Token::Match(tok->next(), "char|short|int|long"))
|
||||||
tok->str("int");
|
tok->str("int");
|
||||||
else
|
else
|
||||||
tok->deleteThis();
|
tok->deleteThis();
|
||||||
|
@ -5735,20 +5733,7 @@ void Tokenizer::simplifyStdType()
|
||||||
tok->isSigned(!isUnsigned);
|
tok->isSigned(!isUnsigned);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tok->str() == "__int8") {
|
if (tok->str() == "int") {
|
||||||
tok->originalName(tok->str());
|
|
||||||
tok->str("char");
|
|
||||||
} else if (tok->str() == "__int16") {
|
|
||||||
tok->originalName(tok->str());
|
|
||||||
tok->str("short");
|
|
||||||
} else if (tok->str() == "__int32") {
|
|
||||||
tok->originalName(tok->str());
|
|
||||||
tok->str("int");
|
|
||||||
} else if (tok->str() == "__int64") {
|
|
||||||
tok->originalName(tok->str());
|
|
||||||
tok->str("long");
|
|
||||||
tok->isLong(true);
|
|
||||||
} else if (tok->str() == "int") {
|
|
||||||
if (tok->strAt(1) == "long") {
|
if (tok->strAt(1) == "long") {
|
||||||
tok->str("long");
|
tok->str("long");
|
||||||
tok->deleteNext();
|
tok->deleteNext();
|
||||||
|
|
|
@ -5459,16 +5459,16 @@ private:
|
||||||
ASSERT_EQUALS("struct A { long x ; } ;", tokenizeAndStringify(code5,false));
|
ASSERT_EQUALS("struct A { long x ; } ;", tokenizeAndStringify(code5,false));
|
||||||
|
|
||||||
const char code6[] = "struct A { __int8 x : 3; };";
|
const char code6[] = "struct A { __int8 x : 3; };";
|
||||||
ASSERT_EQUALS("struct A { char x ; } ;", tokenizeAndStringify(code6,false));
|
ASSERT_EQUALS("struct A { char x ; } ;", tokenizeAndStringifyWindows(code6,false, true, Settings::Win32A));
|
||||||
|
|
||||||
const char code7[] = "struct A { __int16 x : 3; };";
|
const char code7[] = "struct A { __int16 x : 3; };";
|
||||||
ASSERT_EQUALS("struct A { short x ; } ;", tokenizeAndStringify(code7,false));
|
ASSERT_EQUALS("struct A { short x ; } ;", tokenizeAndStringifyWindows(code7,false, true, Settings::Win32A));
|
||||||
|
|
||||||
const char code8[] = "struct A { __int32 x : 3; };";
|
const char code8[] = "struct A { __int32 x : 3; };";
|
||||||
ASSERT_EQUALS("struct A { int x ; } ;", tokenizeAndStringify(code8,false));
|
ASSERT_EQUALS("struct A { int x ; } ;", tokenizeAndStringifyWindows(code8,false, true, Settings::Win32A));
|
||||||
|
|
||||||
const char code9[] = "struct A { __int64 x : 3; };";
|
const char code9[] = "struct A { __int64 x : 3; };";
|
||||||
ASSERT_EQUALS("struct A { long long x ; } ;", tokenizeAndStringify(code9,false));
|
ASSERT_EQUALS("struct A { long long x ; } ;", tokenizeAndStringifyWindows(code9,false, true, Settings::Win32A));
|
||||||
|
|
||||||
const char code10[] = "struct A { unsigned char x : 3; };";
|
const char code10[] = "struct A { unsigned char x : 3; };";
|
||||||
ASSERT_EQUALS("struct A { unsigned char x ; } ;", tokenizeAndStringify(code10,false));
|
ASSERT_EQUALS("struct A { unsigned char x ; } ;", tokenizeAndStringify(code10,false));
|
||||||
|
@ -5483,16 +5483,16 @@ private:
|
||||||
ASSERT_EQUALS("struct A { unsigned long x ; } ;", tokenizeAndStringify(code13,false));
|
ASSERT_EQUALS("struct A { unsigned long x ; } ;", tokenizeAndStringify(code13,false));
|
||||||
|
|
||||||
const char code14[] = "struct A { unsigned __int8 x : 3; };";
|
const char code14[] = "struct A { unsigned __int8 x : 3; };";
|
||||||
ASSERT_EQUALS("struct A { unsigned char x ; } ;", tokenizeAndStringify(code14,false));
|
ASSERT_EQUALS("struct A { unsigned char x ; } ;", tokenizeAndStringifyWindows(code14,false, true, Settings::Win32A));
|
||||||
|
|
||||||
const char code15[] = "struct A { unsigned __int16 x : 3; };";
|
const char code15[] = "struct A { unsigned __int16 x : 3; };";
|
||||||
ASSERT_EQUALS("struct A { unsigned short x ; } ;", tokenizeAndStringify(code15,false));
|
ASSERT_EQUALS("struct A { unsigned short x ; } ;", tokenizeAndStringifyWindows(code15,false, true, Settings::Win32A));
|
||||||
|
|
||||||
const char code16[] = "struct A { unsigned __int32 x : 3; };";
|
const char code16[] = "struct A { unsigned __int32 x : 3; };";
|
||||||
ASSERT_EQUALS("struct A { unsigned int x ; } ;", tokenizeAndStringify(code16,false));
|
ASSERT_EQUALS("struct A { unsigned int x ; } ;", tokenizeAndStringifyWindows(code16,false, true, Settings::Win32A));
|
||||||
|
|
||||||
const char code17[] = "struct A { unsigned __int64 x : 3; };";
|
const char code17[] = "struct A { unsigned __int64 x : 3; };";
|
||||||
ASSERT_EQUALS("struct A { unsigned long long x ; } ;", tokenizeAndStringify(code17,false));
|
ASSERT_EQUALS("struct A { unsigned long long x ; } ;", tokenizeAndStringifyWindows(code17,false, true, Settings::Win32A));
|
||||||
|
|
||||||
const char code18[] = "struct A { signed char x : 3; };";
|
const char code18[] = "struct A { signed char x : 3; };";
|
||||||
ASSERT_EQUALS("struct A { signed char x ; } ;", tokenizeAndStringify(code18,false));
|
ASSERT_EQUALS("struct A { signed char x ; } ;", tokenizeAndStringify(code18,false));
|
||||||
|
@ -5504,19 +5504,19 @@ private:
|
||||||
ASSERT_EQUALS("struct A { signed int x ; } ;", tokenizeAndStringify(code20,false));
|
ASSERT_EQUALS("struct A { signed int x ; } ;", tokenizeAndStringify(code20,false));
|
||||||
|
|
||||||
const char code21[] = "struct A { signed long x : 3; };";
|
const char code21[] = "struct A { signed long x : 3; };";
|
||||||
ASSERT_EQUALS("struct A { signed long x ; } ;", tokenizeAndStringify(code21,false));
|
ASSERT_EQUALS("struct A { signed long x ; } ;", tokenizeAndStringifyWindows(code21,false));
|
||||||
|
|
||||||
const char code22[] = "struct A { signed __int8 x : 3; };";
|
const char code22[] = "struct A { signed __int8 x : 3; };";
|
||||||
ASSERT_EQUALS("struct A { signed char x ; } ;", tokenizeAndStringify(code22,false));
|
ASSERT_EQUALS("struct A { signed char x ; } ;", tokenizeAndStringifyWindows(code22,false, true, Settings::Win32A));
|
||||||
|
|
||||||
const char code23[] = "struct A { signed __int16 x : 3; };";
|
const char code23[] = "struct A { signed __int16 x : 3; };";
|
||||||
ASSERT_EQUALS("struct A { signed short x ; } ;", tokenizeAndStringify(code23,false));
|
ASSERT_EQUALS("struct A { signed short x ; } ;", tokenizeAndStringifyWindows(code23,false, true, Settings::Win32A));
|
||||||
|
|
||||||
const char code24[] = "struct A { signed __int32 x : 3; };";
|
const char code24[] = "struct A { signed __int32 x : 3; };";
|
||||||
ASSERT_EQUALS("struct A { signed int x ; } ;", tokenizeAndStringify(code24,false));
|
ASSERT_EQUALS("struct A { signed int x ; } ;", tokenizeAndStringifyWindows(code24,false, true, Settings::Win32A));
|
||||||
|
|
||||||
const char code25[] = "struct A { signed __int64 x : 3; };";
|
const char code25[] = "struct A { signed __int64 x : 3; };";
|
||||||
ASSERT_EQUALS("struct A { signed long long x ; } ;", tokenizeAndStringify(code25,false));
|
ASSERT_EQUALS("struct A { signed long long x ; } ;", tokenizeAndStringifyWindows(code25,false, true, Settings::Win32A));
|
||||||
}
|
}
|
||||||
|
|
||||||
void bitfields2() {
|
void bitfields2() {
|
||||||
|
|
Loading…
Reference in New Issue