add some common windows pointer type conversions to standard types
This commit is contained in:
parent
b349d36c50
commit
e234e8cc5b
|
@ -6667,6 +6667,61 @@ void Tokenizer::simplifyPlatformTypes()
|
||||||
}
|
}
|
||||||
else if (tok->str() == "LONG")
|
else if (tok->str() == "LONG")
|
||||||
tok->str("long");
|
tok->str("long");
|
||||||
|
else if (Token::Match(tok, "LPBOOL|PBOOL"))
|
||||||
|
{
|
||||||
|
tok->str("int");
|
||||||
|
tok->insertToken("*");
|
||||||
|
}
|
||||||
|
else if (Token::Match(tok, "LPBYTE|PBOOLEAN|PBYTE"))
|
||||||
|
{
|
||||||
|
tok->str("unsigned");
|
||||||
|
tok->insertToken("*");
|
||||||
|
tok->insertToken("char");
|
||||||
|
}
|
||||||
|
else if (Token::Match(tok, "LPCSTR|PCSTR"))
|
||||||
|
{
|
||||||
|
tok->str("const");
|
||||||
|
tok->insertToken("*");
|
||||||
|
tok->insertToken("char");
|
||||||
|
}
|
||||||
|
else if (tok->str() == "LPCVOID")
|
||||||
|
{
|
||||||
|
tok->str("const");
|
||||||
|
tok->insertToken("*");
|
||||||
|
tok->insertToken("void");
|
||||||
|
}
|
||||||
|
else if (tok->str() == "LPDWORD")
|
||||||
|
{
|
||||||
|
tok->str("unsigned");
|
||||||
|
tok->insertToken("*");
|
||||||
|
tok->insertToken("long");
|
||||||
|
}
|
||||||
|
else if (Token::Match(tok, "LPINT|PINT"))
|
||||||
|
{
|
||||||
|
tok->str("int");
|
||||||
|
tok->insertToken("*");
|
||||||
|
}
|
||||||
|
else if (Token::Match(tok, "LPLONG|PLONG"))
|
||||||
|
{
|
||||||
|
tok->str("long");
|
||||||
|
tok->insertToken("*");
|
||||||
|
}
|
||||||
|
else if (Token::Match(tok, "LPSTR|PSTR|PCHAR"))
|
||||||
|
{
|
||||||
|
tok->str("char");
|
||||||
|
tok->insertToken("*");
|
||||||
|
}
|
||||||
|
else if (Token::Match(tok, "LPVOID|PVOID"))
|
||||||
|
{
|
||||||
|
tok->str("void");
|
||||||
|
tok->insertToken("*");
|
||||||
|
}
|
||||||
|
else if (Token::Match(tok, "LPWORD|PWORD"))
|
||||||
|
{
|
||||||
|
tok->str("unsigned");
|
||||||
|
tok->insertToken("*");
|
||||||
|
tok->insertToken("short");
|
||||||
|
}
|
||||||
else if (tok->str() == "SHORT")
|
else if (tok->str() == "SHORT")
|
||||||
tok->str("short");
|
tok->str("short");
|
||||||
else if (tok->str() == "UINT")
|
else if (tok->str() == "UINT")
|
||||||
|
|
|
@ -5978,8 +5978,25 @@ private:
|
||||||
"ULONG s;"
|
"ULONG s;"
|
||||||
"USHORT t;"
|
"USHORT t;"
|
||||||
"WORD u;"
|
"WORD u;"
|
||||||
"VOID * v;";
|
"VOID *v;"
|
||||||
|
"LPBOOL w;"
|
||||||
|
"PBOOL x;"
|
||||||
|
"LPBYTE y;"
|
||||||
|
"PBOOLEAN z;"
|
||||||
|
"PBYTE A;"
|
||||||
|
"LPCSTR B;"
|
||||||
|
"PCSTR C;"
|
||||||
|
"LPCVOID D;"
|
||||||
|
"LPDWORD E;"
|
||||||
|
"LPINT F;"
|
||||||
|
"PINT G;"
|
||||||
|
"LPLONG H;"
|
||||||
|
"PLONG I;"
|
||||||
|
"LPSTR J;"
|
||||||
|
"PSTR K;"
|
||||||
|
"PCHAR L;"
|
||||||
|
"LPVOID M;"
|
||||||
|
"PVOID N;";
|
||||||
|
|
||||||
const char expected[] = "unsigned int sizeof_short ; sizeof_short = 2 ; "
|
const char expected[] = "unsigned int sizeof_short ; sizeof_short = 2 ; "
|
||||||
"unsigned int sizeof_unsigned_short ; sizeof_unsigned_short = 2 ; "
|
"unsigned int sizeof_unsigned_short ; sizeof_unsigned_short = 2 ; "
|
||||||
|
@ -6016,7 +6033,25 @@ private:
|
||||||
"unsigned long s ; "
|
"unsigned long s ; "
|
||||||
"unsigned short t ; "
|
"unsigned short t ; "
|
||||||
"unsigned short u ; "
|
"unsigned short u ; "
|
||||||
"void * v ;";
|
"void * v ; "
|
||||||
|
"int * w ; "
|
||||||
|
"int * x ; "
|
||||||
|
"unsigned char * y ; "
|
||||||
|
"unsigned char * z ; "
|
||||||
|
"unsigned char * A ; "
|
||||||
|
"const char * B ; "
|
||||||
|
"const char * C ; "
|
||||||
|
"const void * D ; "
|
||||||
|
"unsigned long * E ; "
|
||||||
|
"int * F ; "
|
||||||
|
"int * G ; "
|
||||||
|
"long * H ; "
|
||||||
|
"long * I ; "
|
||||||
|
"char * J ; "
|
||||||
|
"char * K ; "
|
||||||
|
"char * L ; "
|
||||||
|
"void * M ; "
|
||||||
|
"void * N ;";
|
||||||
|
|
||||||
ASSERT_EQUALS(expected, tokenizeAndStringify(code, true, true, Settings::Win32));
|
ASSERT_EQUALS(expected, tokenizeAndStringify(code, true, true, Settings::Win32));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue