summaryrefslogtreecommitdiffstats
path: root/src/tools
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/moc/preprocessor.cpp13
-rw-r--r--src/tools/uic/cpp/cppwriteinitialization.cpp7
2 files changed, 10 insertions, 10 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);
diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp
index 2fb44952be..ad9e040824 100644
--- a/src/tools/uic/cpp/cppwriteinitialization.cpp
+++ b/src/tools/uic/cpp/cppwriteinitialization.cpp
@@ -83,9 +83,10 @@ namespace {
int w = 0;
int h = 0;
if (const DomProperty *sh = properties.value(QLatin1String("sizeHint"))) {
- const DomSize *sizeHint = sh->elementSize();
- w = sizeHint->elementWidth();
- h = sizeHint->elementHeight();
+ if (const DomSize *sizeHint = sh->elementSize()) {
+ w = sizeHint->elementWidth();
+ h = sizeHint->elementHeight();
+ }
}
output << w << ", " << h << ", ";