improve parse error recovery paths

to reduce collateral damage from parse errors.

(cherry picked from qtcreator/00c0d0d5e42d28e03c2846c17d3acbcd8420859d)
Change-Id: Ic59700d657069d3b15372509b4bff966057d27a9
Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
(cherry picked from qtbase/ae3f95a951334dee001e37c305e4d7bf91c0d1b3)
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
don't pretend that break()/next()/return() are functions

it's a pretty braindead thing to implement control flow statements as
(built-in) functions.

as a "side effect", this fixes return() value handling for lists.

(cherry picked from qtcreator/f53ed6c4b3feca59a94d4f0de8b1a7411122e30e)
(cherry picked from qtcreator/f529e22ec38fb9a656d74394e484d2453cf42c69)
Change-Id: I59c8efa0e4d65329327115f7f8ed20719e7f7546
Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
(cherry picked from qtbase/8400896cfe3fbef7666329a2920bd0dbdd5890af)
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
remove automatic splitting from $$() expansions

$$(FOO) would automatically split the contents of the environment
variable at whitespace (and interpret quoting inside it). the way to
prevent the splitting (but not the quote interpretation) would be using
"$$(FOO)".

this behavior is entirely unexpected and thus an incredibly effective
source of quoting problems - according to a grep over the whole qt
sources, there isn't a single case where things were done right. in qt
creator, well over half the cases are wrong.

also, the "feature" seems entirely pointless: nobody uses spaces as
separators in environment variables.

consequently, simply remove it, even in a patch release. i'm postulating
that nobody will complain.

Change-Id: I9ed3df1b0d1ef602acd78ceb118611d294561da6
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
(cherry picked from qtbase/566d28316dd73bfe4a8ea34839989ee9df7e3895)
Update feature paths on assignment to QMAKE_PLATFORM

Instead of after parsing the makespecs, were we assumed QMAKE_PLATFORM
had been set by the makespec and did an explicit update.

Allows loading platform specific features from within a makespec after
updating QMAKE_PLATFORM.

Change-Id: I0eb3b7fb88ce48b00a384850c5d87223c06234d7
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
(cherry picked from qtbase/4dd29248cd43ff730f7432b51a443b72fad3523d)
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
remove pointless initialization of qmakespec

we have proper fallback paths further down the line.

Change-Id: I3648cc985d21bbec4c2c24e179830db4467af210
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
(cherry picked from qtbase/0dedf8c3403923b963c51eb65d9cbe838d5ba0d4)
permit returning from files

this allows skipping an entire feature file if a condition is not
fulfilled, without putting the whole body inside a conditional.

Change-Id: I84fe9c94dda58c794fb52c3f163b40563b0db30a
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
(cherry picked from qtbase/525eb337670f61078383c20ad9be274dcf2d0928)
make split_value_list() mostly sane

don't count parentheses, don't nest quotes, don't create empty elements.
the backslash still escapes only quotes (and itself) - $$list() (one of
the main users of this function) is commonly used with (windows) path
lists, so letting it escape anything would make a royal mess.

Change-Id: I29252fbe14fd6d28217450ec41cf8acfb2e30681
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
(cherry picked from qtbase/6c22b9b3e86d1617665f7b81b105c032f43c6d72)
(cherry picked from qtbase/a5c2ab47867a558d6f8f62126fb8e4f2777cfe06)
clean paths of found files in prepareProject()

any of the directories may be the root, which would lead to double slashes
in the constructed filenames.

Change-Id: I053e167a19b795b40e780fc29db356c7f24d286a
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
(cherry picked from qtbase/97be79012cd39d1d0e7748d5c500d86c3becc258)
don't send output of $$join() and $$sprintf() through split_value_list()

in the case of sprintf it's surprising, in the case of join it's
anti-thetical.

Change-Id: I4eb7e56d31ac6ed68adf852f1a19b33554d38eb4
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
(cherry picked from qtbase/ae94bf2b7a6373def9239ae5f54b143e1f6ffe09)
make stubs for dangerous/useless qmake functions in limited mode

instead of having them "not implemented" (and consequently getting
errors), just let requires(), system(), mkpath(), write_file(), touch()
and cache() do nothing. this is likely to cause followup failures which
are harder to detect, but the amount of scary noise we are producing now
is not really acceptable. furthermore, in qtcreator these failures
actually terminate the "precise" evaluation, which breaks Run
Configurations.

Task-number: QTBUG-28159
Task-number: QTCREATORBUG-8550 (in different repo)
Change-Id: I1bdeb759e895e4200f09332dadf8a6cef348182f
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
create a .qmake.cache for the lupdate tests

mac mkspecs are really noisy without it now, which makes the tests fail.

Change-Id: I6b4900c51d0b8aedd9309482a30055e48c3b9f69
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>