Fixed #9730 (Regression: TEXT macro not handled in windows code)
This commit is contained in:
parent
79c3af56e4
commit
7ff692341e
|
@ -2484,14 +2484,19 @@ void Tokenizer::combineOperators()
|
||||||
void Tokenizer::combineStringAndCharLiterals()
|
void Tokenizer::combineStringAndCharLiterals()
|
||||||
{
|
{
|
||||||
// Combine strings
|
// Combine strings
|
||||||
for (Token *tok = list.front();
|
for (Token *tok = list.front(); tok; tok = tok->next()) {
|
||||||
tok;
|
|
||||||
tok = tok->next()) {
|
|
||||||
if (!isStringLiteral(tok->str()))
|
if (!isStringLiteral(tok->str()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
tok->str(simplifyString(tok->str()));
|
tok->str(simplifyString(tok->str()));
|
||||||
while (tok->next() && tok->next()->tokType() == Token::eString) {
|
|
||||||
|
while (Token::Match(tok->next(), "%str%") || Token::Match(tok->next(), "_T|_TEXT|TEXT ( %str% )")) {
|
||||||
|
if (tok->next()->isName()) {
|
||||||
|
if (!mSettings->isWindowsPlatform())
|
||||||
|
break;
|
||||||
|
tok->deleteNext(2);
|
||||||
|
tok->next()->deleteNext();
|
||||||
|
}
|
||||||
// Two strings after each other, combine them
|
// Two strings after each other, combine them
|
||||||
tok->concatStr(simplifyString(tok->next()->str()));
|
tok->concatStr(simplifyString(tok->next()->str()));
|
||||||
tok->deleteNext();
|
tok->deleteNext();
|
||||||
|
|
|
@ -1800,6 +1800,12 @@ private:
|
||||||
"};\n"
|
"};\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
ASSERT_EQUALS(tok(code2), tok(code1));
|
ASSERT_EQUALS(tok(code2), tok(code1));
|
||||||
|
|
||||||
|
const char code3[] = "x = L\"1\" TEXT(\"2\") L\"3\";";
|
||||||
|
ASSERT_EQUALS("x = L\"123\" ;", tok(code3, false, Settings::Win64));
|
||||||
|
|
||||||
|
const char code4[] = "x = TEXT(\"1\") L\"2\";";
|
||||||
|
ASSERT_EQUALS("x = L\"1\" L\"2\" ;", tok(code4, false, Settings::Win64));
|
||||||
}
|
}
|
||||||
|
|
||||||
void combine_wstrings() {
|
void combine_wstrings() {
|
||||||
|
|
Loading…
Reference in New Issue