add support for Microsoft TCHAR character constants

This commit is contained in:
Robert Reif 2011-09-26 22:08:24 -04:00
parent 2d717d77cd
commit ec377d24eb
2 changed files with 16 additions and 0 deletions

View File

@ -10633,6 +10633,12 @@ void Tokenizer::simplifyMicrosoftStringFunctions()
tok->deleteThis();
tok->deleteNext();
}
else if (Token::Match(tok, "_T ( %any% )") && tok->strAt(2)[0] == '\'')
{
tok->deleteThis();
tok->deleteThis();
tok->deleteNext();
}
}
}
else if (_settings->platformType == Settings::Win32W ||
@ -10690,6 +10696,12 @@ void Tokenizer::simplifyMicrosoftStringFunctions()
tok->deleteThis();
tok->deleteNext();
}
else if (Token::Match(tok, "_T ( %any% )") && tok->strAt(2)[0] == '\'')
{
tok->deleteThis();
tok->deleteThis();
tok->deleteNext();
}
}
}
}

View File

@ -6101,6 +6101,7 @@ private:
"PCTSTR pctstr;"
"LPCTSTR lpctstr;"
"void foo() {"
" TCHAR tc = _T(\'c\'); "
" TCHAR src[10] = _T(\"123456789\");"
" TCHAR dst[10];"
" _tcscpy(dst, src);"
@ -6119,6 +6120,7 @@ private:
"const char * pctstr ; "
"const char * lpctstr ; "
"void foo ( ) { "
"char tc ; tc = \'c\' ; "
"char src [ 10 ] = \"123456789\" ; "
"char dst [ 10 ] ; "
"strcpy ( dst , src ) ; "
@ -6142,6 +6144,7 @@ private:
"PCTSTR pctstr;"
"LPCTSTR lpctstr;"
"void foo() {"
" TCHAR tc = _T(\'c\');"
" TCHAR src[10] = _T(\"123456789\");"
" TCHAR dst[10];"
" _tcscpy(dst, src);"
@ -6160,6 +6163,7 @@ private:
"const unsigned short * pctstr ; "
"const unsigned short * lpctstr ; "
"void foo ( ) { "
"unsigned short tc ; tc = \'c\' ; "
"unsigned short src [ 10 ] = \"123456789\" ; "
"unsigned short dst [ 10 ] ; "
"wcscpy ( dst , src ) ; "