diff options
author | Lars Knoll <lars.knoll@qt.io> | 2016-07-05 11:06:55 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2016-07-13 19:50:48 +0000 |
commit | c32ef0a725c7ac9d8a9ab053407389ef2fddc64e (patch) | |
tree | 11b161a1a522749b5f51d658ebaa87d92c514d33 /src/tools | |
parent | 31b6760e64498727765b210c4285d127980aa75f (diff) |
Don't error out on preprocessor concatenation of two strings
"foo" ## "bar" doesn't make a lot of sense, but MSVC allows them
(although gcc errors out on them). Simply ignore the ## in this case
instead of aborting with an error.
Fixes parsing of the Windows winsock2.h header.
Task-number: QTBUG-54560
Change-Id: I84cd5fbb56a006cf379430708c955cf0da475cff
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/moc/preprocessor.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/tools/moc/preprocessor.cpp b/src/tools/moc/preprocessor.cpp index 6ae785f417..14d1cd46dc 100644 --- a/src/tools/moc/preprocessor.cpp +++ b/src/tools/moc/preprocessor.cpp @@ -695,13 +695,10 @@ Symbols Preprocessor::macroExpandIdentifier(Preprocessor *that, SymbolStack &sym next = arg.at(0); } - if (!expansion.isEmpty() && expansion.constLast().token == s.token) { - Symbol last = expansion.constLast(); + Symbol last = expansion.constLast(); + if (!expansion.isEmpty() && last.token == s.token && last.token != STRING_LITERAL) { expansion.pop_back(); - if (last.token == STRING_LITERAL || s.token == STRING_LITERAL) - that->error("Can't concatenate non identifier tokens"); - QByteArray lexem = last.lexem() + next.lexem(); expansion += Symbol(lineNum, last.token, lexem); } else { |