Improved handling of the __FILE__ macro
This commit is contained in:
parent
fd26bad6fa
commit
f95b29db06
|
@ -2289,7 +2289,7 @@ void Tokenizer::simplifyFileAndLineMacro()
|
||||||
{
|
{
|
||||||
for (Token *tok = list.front(); tok; tok = tok->next()) {
|
for (Token *tok = list.front(); tok; tok = tok->next()) {
|
||||||
if (tok->str() == "__FILE__")
|
if (tok->str() == "__FILE__")
|
||||||
tok->str(list.file(tok));
|
tok->str("\"" + list.file(tok) + "\"");
|
||||||
else if (tok->str() == "__LINE__")
|
else if (tok->str() == "__LINE__")
|
||||||
tok->str(MathLib::longToString(tok->linenr()));
|
tok->str(MathLib::longToString(tok->linenr()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -921,6 +921,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
void simplifyFileAndLineMacro() { // tokenize 'return - __LINE__' correctly
|
void simplifyFileAndLineMacro() { // tokenize 'return - __LINE__' correctly
|
||||||
|
ASSERT_EQUALS("\"test.cpp\"", tokenizeAndStringify("__FILE__"));
|
||||||
ASSERT_EQUALS("return -1 ;", tokenizeAndStringify("return - __LINE__;"));
|
ASSERT_EQUALS("return -1 ;", tokenizeAndStringify("return - __LINE__;"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue