summaryrefslogtreecommitdiffstats
path: root/src/tools/moc/preprocessor.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-06-19 13:25:11 +0200
committerLiang Qi <liang.qi@qt.io>2017-06-19 16:12:34 +0200
commitce09ef431373f45d14ce0a6e7de24aee3666093d (patch)
tree7c998b21f02db55e233e7eeb1599663f1c6b51ca /src/tools/moc/preprocessor.cpp
parent7ad55ca65f42351e231f31f7a9253ae6eaf1ebb3 (diff)
parent97eec16e4ff6367c233f8ea6c4a343c286c3a514 (diff)
Merge remote-tracking branch 'origin/5.9' into dev
Conflicts: src/corelib/io/qprocess_unix.cpp src/corelib/io/qprocess_win.cpp src/plugins/platforms/android/qandroidplatformintegration.h src/plugins/platforms/windows/qwindowscontext.cpp src/plugins/platforms/windows/windows.pri src/tools/uic/cpp/cppwriteinitialization.cpp src/widgets/doc/src/widgets-and-layouts/gallery.qdoc Change-Id: I8d0834c77f350ea7540140c2c7f372814afc2d0f
Diffstat (limited to 'src/tools/moc/preprocessor.cpp')
-rw-r--r--src/tools/moc/preprocessor.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/tools/moc/preprocessor.cpp b/src/tools/moc/preprocessor.cpp
index 32c94639ab..9a06fb38d0 100644
--- a/src/tools/moc/preprocessor.cpp
+++ b/src/tools/moc/preprocessor.cpp
@@ -1109,19 +1109,18 @@ void Preprocessor::preprocess(const QByteArray &filename, Symbols &preprocessed)
}
case PP_DEFINE:
{
- next(IDENTIFIER);
+ next();
QByteArray name = lexem();
+ if (name.isEmpty() || !is_ident_start(name[0]))
+ error();
Macro macro;
macro.isVariadic = false;
- Token t = next();
- if (t == LPAREN) {
+ if (test(LPAREN)) {
// we have a function macro
macro.isFunction = true;
parseDefineArguments(&macro);
- } else if (t == PP_WHITESPACE){
- macro.isFunction = false;
} else {
- error("Moc: internal error");
+ macro.isFunction = false;
}
int start = index;
until(PP_NEWLINE);
@@ -1160,7 +1159,7 @@ void Preprocessor::preprocess(const QByteArray &filename, Symbols &preprocessed)
continue;
}
case PP_UNDEF: {
- next(IDENTIFIER);
+ next();
QByteArray name = lexem();
until(PP_NEWLINE);
macros.remove(name);