summaryrefslogtreecommitdiffstats
path: root/src/linguist/lupdate/cpp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/linguist/lupdate/cpp.cpp')
-rw-r--r--src/linguist/lupdate/cpp.cpp25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/linguist/lupdate/cpp.cpp b/src/linguist/lupdate/cpp.cpp
index aac9a90ff..d8a4f9a37 100644
--- a/src/linguist/lupdate/cpp.cpp
+++ b/src/linguist/lupdate/cpp.cpp
@@ -239,6 +239,7 @@ private:
std::ostream &yyMsg(int line = 0);
int getChar();
+ TokenType lookAheadToSemicolonOrLeftBrace();
TokenType getToken();
void processComment();
@@ -450,6 +451,23 @@ int CppParser::getChar()
}
}
+CppParser::TokenType CppParser::lookAheadToSemicolonOrLeftBrace()
+{
+ if (*yyInPtr == 0)
+ return Tok_Eof;
+ const ushort *uc = yyInPtr + 1;
+ forever {
+ ushort c = *uc;
+ if (!c)
+ return Tok_Eof;
+ if (c == ';')
+ return Tok_Semicolon;
+ if (c == '{')
+ return Tok_LeftBrace;
+ ++uc;
+ }
+}
+
STRING(Q_OBJECT);
STRING(class);
STRING(final);
@@ -2182,8 +2200,11 @@ void CppParser::parseInternal(ConversionData &cd, const QStringList &includeStac
pendingContext = prospectiveContext;
prospectiveContext.clear();
}
- if (yyTok == Tok_Colon)
- yyTokColonSeen = true;
+ //ignore colons for bitfields (are usually followed by a semicolon)
+ if (yyTok == Tok_Colon) {
+ if (lookAheadToSemicolonOrLeftBrace() != Tok_Semicolon)
+ yyTokColonSeen = true;
+ }
}
metaExpected = true;
yyTok = getToken();