Changed handling of type wchar_t:

- Don't simplify wchar_t to unsigned short on Win32 platforms to ensure that checking of strings and nullpointer dereferences works.
- Added it as standard type
This commit is contained in:
PKEuS 2012-11-11 14:47:16 +01:00
parent 17b720ef7d
commit 4ea2df8671
2 changed files with 3 additions and 4 deletions

View File

@ -120,7 +120,7 @@ void Token::update_property_isStandardType()
if (_str.size() < 3)
return;
static const char * const stdtype[] = {"int", "char", "bool", "long", "short", "float", "double", "size_t", 0};
static const char * const stdtype[] = {"int", "char", "bool", "long", "short", "float", "double", "wchar_t", "size_t", 0};
for (int i = 0; stdtype[i]; i++) {
if (_str == stdtype[i]) {
_isStandardType = true;

View File

@ -5252,7 +5252,7 @@ void Tokenizer::simplifyPlatformTypes()
} else {
tok->insertToken("int");
}
} else if (Token::Match(tok, "USHORT|WORD|WCHAR|ATOM|wchar_t|LANGID")) {
} else if (Token::Match(tok, "USHORT|WORD|ATOM|LANGID")) {
tok->str("unsigned");
tok->insertToken("short");
} else if (tok->str() == "VOID")
@ -5261,8 +5261,7 @@ void Tokenizer::simplifyPlatformTypes()
if (_settings->platformType == Settings::Win32A)
tok->str("char");
else {
tok->str("unsigned");
tok->insertToken("short");
tok->str("wchar_t");
}
} else if (tok->str() == "TBYTE") {
tok->str("unsigned");