diff options
author | Joerg Bornemann <joerg.bornemann@theqtcompany.com> | 2015-03-17 11:07:33 +0100 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@theqtcompany.com> | 2015-03-17 15:14:33 +0000 |
commit | 11e2e036bf7f06cc62b4ed31e356725a4a479ff8 (patch) | |
tree | 555f328e5ce78dee9e16a6b814c3283743d0ae5f | |
parent | 7bbe5cb1a3a9af08feda8f9a173fc354b8a18f4b (diff) |
allow multiple minus characters before commands
All but the first minus before a command are ignored.
This is in line with nmake behavior.
Change-Id: I8a1bc8f284d36d293cc14ab21fb3ec0ecf26d242
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
-rw-r--r-- | src/jomlib/makefile.cpp | 9 | ||||
-rw-r--r-- | tests/makefiles/blackbox/ignoreExitCodes/test.mk | 5 |
2 files changed, 11 insertions, 3 deletions
diff --git a/src/jomlib/makefile.cpp b/src/jomlib/makefile.cpp index 6ec1e07..255b47f 100644 --- a/src/jomlib/makefile.cpp +++ b/src/jomlib/makefile.cpp @@ -77,9 +77,14 @@ void Command::evaluateModifiers() break; const QCharRef firstChar = m_commandLine[0]; if (firstChar == QLatin1Char('-')) { - m_commandLine.remove(0, 1); - int i = 0; + // Remove all minus characters. Yes, nmake allows commands like -----7dir + int i = 1; + for (; i < m_commandLine.length() && m_commandLine.at(i) == QLatin1Char('-'); ++i) + ; + m_commandLine.remove(0, i); + // Read the (optional) number after the minus. + i = 0; while (i < m_commandLine.length() && m_commandLine.at(i).isDigit()) ++i; if (i > 0) { diff --git a/tests/makefiles/blackbox/ignoreExitCodes/test.mk b/tests/makefiles/blackbox/ignoreExitCodes/test.mk index 11d1d4a..5c443a1 100644 --- a/tests/makefiles/blackbox/ignoreExitCodes/test.mk +++ b/tests/makefiles/blackbox/ignoreExitCodes/test.mk @@ -1,6 +1,6 @@ # test ignore exit codes in make files -test1: testNonexistentCommand testExitCode1 testExitCode2 +test1: testNonexistentCommand testExitCode1 testExitCode2 testExitCode3 @echo ---SUCCESS--- testNonexistentCommand: @@ -12,6 +12,9 @@ testExitCode1: testExitCode2: -1cmd /k exit 1 +testExitCode3: + ------1234cmd /k exit 1234 + # target test2 is supposed to fail test2: -6cmd /k exit 7 |