summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libs/cplusplus/pp-engine.cpp43
-rw-r--r--src/shared/cplusplus/Keywords.cpp12
2 files changed, 27 insertions, 28 deletions
diff --git a/src/libs/cplusplus/pp-engine.cpp b/src/libs/cplusplus/pp-engine.cpp
index 3f3c7099a1..6a6e527427 100644
--- a/src/libs/cplusplus/pp-engine.cpp
+++ b/src/libs/cplusplus/pp-engine.cpp
@@ -766,34 +766,27 @@ void Preprocessor::preprocess(const QString &fileName, const QByteArray &source,
expandBuiltinMacro(identifierToken, spell);
else {
- if (spell != "Q_PROPERTY"
- && spell != "Q_INVOKABLE"
- && spell != "Q_ENUMS"
- && spell != "Q_FLAGS") {
-
- // ### FIXME: shouldn't this be T_Q_PROPERTY & friends?
-
- if (Macro *m = env->resolve(spell)) {
- if (! m->isFunctionLike()) {
- if (0 == (m = processObjectLikeMacro(identifierToken, spell, m)))
- continue;
+ if (Macro *m = env->resolve(spell)) {
+ if (! m->isFunctionLike()) {
+ if (0 == (m = processObjectLikeMacro(identifierToken, spell, m)))
+ continue;
- // the macro expansion generated something that looks like
- // a function-like macro.
- }
+ // the macro expansion generated something that looks like
+ // a function-like macro.
+ }
- // `m' is function-like macro.
- if (_dot->is(T_LPAREN)) {
- QVector<MacroArgumentReference> actuals;
- collectActualArguments(&actuals);
+ // `m' is function-like macro.
+ if (_dot->is(T_LPAREN)) {
+ QVector<MacroArgumentReference> actuals;
+ collectActualArguments(&actuals);
- if (_dot->is(T_RPAREN)) {
- expandFunctionLikeMacro(identifierToken, m, actuals);
- continue;
- }
+ if (_dot->is(T_RPAREN)) {
+ expandFunctionLikeMacro(identifierToken, m, actuals);
+ continue;
}
}
}
+
// it's not a function or object-like macro.
out(spell);
}
@@ -1390,6 +1383,12 @@ bool Preprocessor::isQtReservedWord(const QByteArray &macroId) const
return true;
else if (size == 3 && macroId.at(0) == 'Q' && macroId == "Q_Q")
return true;
+ else if (size == 10 && macroId.at(0) == 'Q' && macroId == "Q_PROPERTY")
+ return true;
+ else if (size == 7 && macroId.at(0) == 'Q' && macroId == "Q_ENUMS")
+ return true;
+ else if (size == 7 && macroId.at(0) == 'Q' && macroId == "Q_FLAGS")
+ return true;
else if (size == 6 && macroId.at(0) == 'S' && macroId == "SIGNAL")
return true;
else if (size == 4 && macroId.at(0) == 'S' && macroId == "SLOT")
diff --git a/src/shared/cplusplus/Keywords.cpp b/src/shared/cplusplus/Keywords.cpp
index e1e45373ea..3ea26e2419 100644
--- a/src/shared/cplusplus/Keywords.cpp
+++ b/src/shared/cplusplus/Keywords.cpp
@@ -745,7 +745,7 @@ static inline int classify7(const char *s, bool q) {
return T_IDENTIFIER;
}
-static inline int classify8(const char *s, bool) {
+static inline int classify8(const char *s, bool q) {
if (s[0] == '_') {
if (s[1] == '_') {
if (s[2] == 'i') {
@@ -910,7 +910,7 @@ static inline int classify8(const char *s, bool) {
}
}
}
- else if (s[0] == 'Q') {
+ else if (q && s[0] == 'Q') {
if (s[1] == '_') {
if (s[2] == 'S') {
if (s[3] == 'I') {
@@ -1024,7 +1024,7 @@ static inline int classify9(const char *s, bool q) {
return T_IDENTIFIER;
}
-static inline int classify10(const char *s, bool) {
+static inline int classify10(const char *s, bool q) {
if (s[0] == '_') {
if (s[1] == '_') {
if (s[2] == 'i') {
@@ -1101,7 +1101,7 @@ static inline int classify10(const char *s, bool) {
}
}
}
- else if (s[0] == 'Q') {
+ else if (q && s[0] == 'Q') {
if (s[1] == '_') {
if (s[2] == 'P') {
if (s[3] == 'R') {
@@ -1125,7 +1125,7 @@ static inline int classify10(const char *s, bool) {
return T_IDENTIFIER;
}
-static inline int classify11(const char *s, bool) {
+static inline int classify11(const char *s, bool q) {
if (s[0] == '_') {
if (s[1] == '_') {
if (s[2] == 'a') {
@@ -1172,7 +1172,7 @@ static inline int classify11(const char *s, bool) {
}
}
}
- else if (s[0] == 'Q') {
+ else if (q && s[0] == 'Q') {
if (s[1] == '_') {
if (s[2] == 'I') {
if (s[3] == 'N') {