summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--changelog.txt1
-rw-r--r--src/jomlib/preprocessor.cpp10
-rw-r--r--tests/makefiles/conditionals.mk28
-rw-r--r--tests/tests.cpp3
4 files changed, 42 insertions, 0 deletions
diff --git a/changelog.txt b/changelog.txt
index f53e009..951e3a1 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -3,6 +3,7 @@ This is the changelog for jom 1.1.5, the parallel make tool.
Changes since jom 1.1.4
- Fixed compound defined() preprocessor expressions (QTCREATORBUG-24134).
- A leading hyphen in MAKEFLAGS is now ignored.
+- Fixed !else if preprocessor expressions (QTCREATORBUG-32129).
Changes since jom 1.1.3
- Fixed handling of the command line option /j.
diff --git a/src/jomlib/preprocessor.cpp b/src/jomlib/preprocessor.cpp
index 97c28c2..b0e001c 100644
--- a/src/jomlib/preprocessor.cpp
+++ b/src/jomlib/preprocessor.cpp
@@ -392,6 +392,16 @@ bool Preprocessor::isPreprocessingDirective(const QString& line, QString& direct
if (result) {
directive = m_rexPreprocessingDirective.cap(1).toUpper();
value = m_rexPreprocessingDirective.cap(2).trimmed();
+
+ // Handle "!else if", "!else ifdef", "!else ifndef" as "!ELSEIF" etc.
+ if (directive == QLatin1String("ELSE")) {
+ static const QRegExp rex(QLatin1String("^(ifn?def|if)\\s+(.*)$"),
+ Qt::CaseInsensitive);
+ if (rex.exactMatch(value)) {
+ directive.append(rex.cap(1).toUpper());
+ value = rex.cap(2);
+ }
+ }
}
}
diff --git a/tests/makefiles/conditionals.mk b/tests/makefiles/conditionals.mk
index a783e60..aecd32a 100644
--- a/tests/makefiles/conditionals.mk
+++ b/tests/makefiles/conditionals.mk
@@ -93,5 +93,33 @@ boo \
hoo
!ENDIF
+# Test !else if syntax (alternative to !elseif with space)
+TEST11=false
+!if "A" == "B"
+TEST11=false
+!else if "A"=="A"
+TEST11=true
+!else
+TEST11=false
+!endif
+
+TEST12=false
+!ifdef NOT_DEFINED
+TEST12=false
+!else ifdef TEST1
+TEST12=true
+!else
+TEST12=false
+!endif
+
+TEST13=false
+!ifdef NOT_DEFINED
+TEST13=false
+!else ifndef NOT_DEFINED
+TEST13=true
+!else
+TEST13=false
+!endif
+
all:
diff --git a/tests/tests.cpp b/tests/tests.cpp
index 21e1df6..f1c3fe3 100644
--- a/tests/tests.cpp
+++ b/tests/tests.cpp
@@ -333,6 +333,9 @@ void Tests::conditionals()
QCOMPARE(macroTable->macroValue("TEST8"), QLatin1String("true"));
QCOMPARE(macroTable->macroValue("TEST9"), QLatin1String("foo bar baz"));
QCOMPARE(macroTable->macroValue("TEST10"), QLatin1String("foo bar boo hoo"));
+ QCOMPARE(macroTable->macroValue("TEST11"), QLatin1String("true"));
+ QCOMPARE(macroTable->macroValue("TEST12"), QLatin1String("true"));
+ QCOMPARE(macroTable->macroValue("TEST13"), QLatin1String("true"));
}
void Tests::dotDirectives()