summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2024-02-02 09:54:08 +0100
committerJoerg Bornemann <joerg.bornemann@qt.io>2024-02-02 10:53:26 +0000
commit5b295dbee66504d21b8cc7d05d5e88e87644d586 (patch)
treecd3745a3b7e4ac8d558af2a22ade4c0ab9551800 /tests
parent1878664e9a4ee146297fd55290e673b235ab1b29 (diff)
Fix compound defined() preprocessor expressionHEADmaster
Expressions like !if defined(foo) && defined(bar) checked for the existence of the macro "foo) && defined(bar" due to an overly greedy regular expression in the lexer of the preprocessor. NMake macro names cannot contain parentheses, so we can change the regex to not eat the closing parenthesis. The lexer was regenerated with flex 2.6.4. Fixes: QTCREATORBUG-24134 Change-Id: I0e5f4f5b5603cf1d2a53ad6ff9224e18e5649a7d Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/tests.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/tests/tests.cpp b/tests/tests.cpp
index 21184de..21e1df6 100644
--- a/tests/tests.cpp
+++ b/tests/tests.cpp
@@ -190,6 +190,7 @@ void Tests::preprocessorExpressions_data()
QTest::newRow("macro defined 2") << QByteArray("DeFiNeD(\"ThisIsDefined\")") << 1;
QTest::newRow("macro defined 3") << QByteArray("DEFINED\t(ThisIsDefinedButEmpty)") << 1;
QTest::newRow("macro defined 4") << QByteArray("defined ( ThisIsUnfortunatelyNotDefined )") << 0;
+ QTest::newRow("macro defined 5") << QByteArray("defined(ThisIsDefined) && defined(ThisIsDefinedButEmpty)") << 1;
QTest::newRow("shellcommand") << QByteArray("[ cmd /c exit 12 ]") << 12;
QTest::newRow("ops +*") << QByteArray("2+3*5") << 17;
QTest::newRow("ops (+)*") << QByteArray("(2+3)*5") << 25;