Commit Graph

47 Commits

Author SHA1 Message Date
Marc Mutz
d9229d849f qmake: eradicate Q_FOREACH loops [already const]
(or trivially marked const) ... by replacing them
with C++11 range-for loops.

Change-Id: I1522e220a57ecb1c5ee0d4281233b3c3931a2ff8
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-28 20:25:21 +00:00
Marc Mutz
e31541fa6f qmake: eradicate Q_FOREACH loops [needing qAsConst()]
... by replacing them with C++11 range-for loops.
To avoid detaches of these mutable Qt containers,
wrap the container in qAsConst().

Change-Id: If086bea06fe26232a7bb99fad8b09fce4dc74c27
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-28 20:25:18 +00:00
Marc Mutz
8d7e913248 qmake: eradicate Q_FOREACH loops [rvalues]
... by replacing them with C++11 range-for loops.

This is the simplest of the patch series: Q_FOREACH took a
copy, so we do, too. Except we don't, since we're just
catching the return value that comes out of the function
(RVO). We can't feed the rvalues into range-for, because
they are non-const and would thus detach.

Change-Id: I5834620bf82f3442da7b2838363d351a0fb960a0
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-28 20:25:15 +00:00
Marc Mutz
c9cb20c01a qmake: don't iterate over .keys()
... iterate over the container itself instead. Avoids
temporary QList creation as well as the lookup cost
when actually calling value(key).

Change-Id: Icac867c30e63863cfa44a382eedd4d6df2070a59
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-28 20:25:07 +00:00
Jani Heikkinen
f776595cc1 Updated license headers
From Qt 5.7 -> tools & applications are lisenced under GPL v3 with some
exceptions, see
http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/

Updated license headers to use new GPL-EXCEPT header instead of LGPL21 one
(in those files which will be under GPL 3 with exceptions)

Change-Id: I42a473ddc97101492a60b9287d90979d9eb35ae1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-21 18:55:18 +00:00
Oswald Buddenhagen
e5f3b653f0 add enablers for printing project errors in cumulative mode
this doesn't actually do anything in qmake.

Change-Id: Ia14953a5a9dc31af56ad6c338017dd5b85bb4494
Reviewed-by: hjk <hjk121@nokiamail.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
(cherry picked from qttools/08d0cb6f8e90a818bf6d3bec7a6d00f16419b8c0)
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2015-12-21 16:39:31 +00:00
Oswald Buddenhagen
57ca8d2698 make write_file() capable of making files (not) executable
Change-Id: I9ca96bc3408160261781697a3471c1f446c86c3a
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2015-12-21 16:34:26 +00:00
Oswald Buddenhagen
a8010f2d03 fix raw data leak in $$sprintf()
it could be only triggered by abusing the function (no expansion
actually done), and nobody is using this to start with, but still ...

Change-Id: I3d4a23ae4d1eea07955572d8213094e0dc218f6d
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
(cherry picked from qtcreator/cdc2a0f72334268684e0407e9b04b3188e00d4bf)
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2015-10-27 17:54:11 +00:00
Oswald Buddenhagen
07ada2fb60 micro-optimization: use ProStringList::join(QChar) overload
Change-Id: I25c6205df78da7fbee0ad1b04476f528f376b7a6
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
(cherry picked from qtcreator/701a82d3a2185702c09dfecb361853fc18947807)
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2015-10-27 17:54:08 +00:00
Tobias Hunger
eba9769b7e QmakeParser: Do not leak temporaries into cache of files
This prevents an access to free'd memory when opening qtcreator.pro.

Looks like qml2puppet.pro gets added to that cache in QMakeVfs::writeFile
with part of the including pro-file's filename in it. That part gets
cleaned when that containing ProFile goes out of scope, leaving a key in
QMakeVfs::m_files free'd but accessible.

Change-Id: I80b43d2fbb66c214647497ea97e6e3a587e274d6
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
(cherry picked from qtcreator/336c3159617cdb3edd35021b5fb312d4d43f9a84)
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2015-10-27 17:54:05 +00:00
Oswald Buddenhagen
bbf2f1dbbf don't complain about missing include()s during cumulative evaluation
it produces simply too many false positives.

Change-Id: I3dfa109866450babe5c16f84665ad22024d99e42
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
(cherry picked from qttools/08bae158320f6d73bf44fcf43f45f51a01334544)
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2015-10-27 17:53:58 +00:00
Oswald Buddenhagen
637a0889b2 remove bogus parens from error messages
Change-Id: I2683a4fb19a7251dc537e3265db3ba28079eb4b8
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2015-05-20 18:11:26 +00:00
Oswald Buddenhagen
fe9baf7e5b trim whitespace from windows error messages
the messages contain a trailing CRLF, which is not helpful.

Change-Id: I4a27115a191dc416a62e28a41f2a9c5893bdc64b
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2015-05-20 18:11:23 +00:00
Oswald Buddenhagen
4334ddc76b remove trailing dots from some error messages
the i/o functions are not very consistent about having the dot already
in the message. the windows api does, and qt passes this on.

Change-Id: I2d1a213965e15478985d6eff205689ea44aa2a03
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2015-05-20 18:11:19 +00:00
Oswald Buddenhagen
109e3fa0ae make defined() error message tell about "var" type
Change-Id: I21d994ebaee2db0d9b114812a8f89bb680ca311e
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2015-05-20 18:11:17 +00:00
Oswald Buddenhagen
ab74cf09a8 move some functions into ProStringList for saner OO design
Change-Id: I60f00f38f459fc9f8eebee9187158e4198fc9546
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2015-02-12 19:00:36 +00:00
Jani Heikkinen
83a5694dc2 Update copyright headers
Qt copyrights are now in The Qt Company, so we could update the source
code headers accordingly. In the same go we should also fix the links to
point to qt.io.

Outdated header.LGPL removed (use header.LGPL21 instead)

Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing
combination. New header.LGPL-COMM taken in the use file which were
using old header.LGPL3 (src/plugins/platforms/android/extract.cpp)

Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license
combination

Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe
Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
2015-02-11 06:49:51 +00:00
Oswald Buddenhagen
009df82f1a make quoting in the prl writer more robust
Change-Id: Idd9f64ac608b7e4ed840d5d9925bf741e03d78ab
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2015-02-05 14:26:54 +00:00
Oswald Buddenhagen
030c3a6197 remove pointless return value from QMakeParser::read()
it always returned true nowadays.

an obvious followup effect is that the return value of parsedProBlock()
doesn't need to be null-checked any more as well.

Change-Id: I782785cab9b721a78a342a010921a73e642ebe7f
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2015-02-04 16:32:57 +00:00
Matti Paaso
974c210835 Update license headers and add new license files
- Renamed LICENSE.LGPL to LICENSE.LGPLv21
- Added LICENSE.LGPLv3
- Removed LICENSE.GPL

Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2
Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
2014-09-24 12:26:19 +02:00
Oswald Buddenhagen
26bbc40db9 add priority sorting to $$resolve_depends()
all else being equal, items with a higher numerical priority will appear
first in the result.

Change-Id: I4ee37ff404a53c4152a1e4fc2fc3c23ef525234d
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
2014-07-30 10:31:53 +02:00
Alessandro Portale
01ce104a3e qmake: Use QDir::toNativeSeparators on paths printed as info
Change-Id: I8c587164bcff742f7ac8ad3f3f28e0b16645cb2a
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2014-05-08 16:37:59 +02:00
Oswald Buddenhagen
d52b00e1d3 fix $$shell_path() for mingw+sh
the msys shell expects unix-like paths with drives converted
from d:\ to /d/.

Change-Id: I09e25ed2c868702e5d7d8b9cc8c04cc13410eeff
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
2014-04-30 16:57:09 +02:00
Oswald Buddenhagen
fb143abbfb de-duplicate code
Change-Id: Ic056acf739659215241c1cab6a462b1ab591dc78
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
2014-04-04 19:32:21 +02:00
Joerg Bornemann
b73d6be6a0 qmake: add replacement function getenv
This is useful for querying environment variables which have
parentheses in their name. Such jewels exist on Windows.
The usual $$(VARNAME) syntax fails for those.

Change-Id: I1d2766cabdc7f637caa9ae6408967685e02f5029
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2014-03-20 08:35:24 +01:00
Oswald Buddenhagen
ff31d87cc8 support a cache that is really just a cache
unlike .qmake.cache & co., the presence of this file has no magic
effects on where mkspecs, modules and other things are searched.

as the obvious name "cache" is of course already taken, we call it
"stash".

the file is searched up to the super cache (if present), otherwise up to
the normal cache/conf (if present), otherwise up to the root.
if it's not found, it is created next to the super cache (if present),
otherwise next to the cache/conf (if present), otherwise in the current
output directory.

note that the cache really should be created and populated by the
top-level project if there are subprojects: otherwise, if there is an
"anchor" (super/cache/conf), subprojects would race for updating the
cache and make a mess. without an "anchor", each subproject would just
create its own cache, kind of defeating its purpose. this is no
different from the existing "cache", but it's worth mentioning that
removing the "anchoring" function does not remove the "nesting order"
constraint.

Task-number: QTBUG-31340
Change-Id: I786d40cef40d14582a0dd4a9407863001bec4c98
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
2013-11-14 19:26:20 +01:00
Oswald Buddenhagen
72075656cf clean superfile and cachefile paths upon creation
otherwise, if the output dir is the root, the path would be denormalized.

the code for finding existing files already does that.

Change-Id: I56d70477e9c9ffcd936325068624a84df10ffd87
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
2013-11-14 19:26:20 +01:00
Morten Johan Sørvig
89ef515177 Add JSON parsing support to qmake.
Add qjson* implementation files from corelib/json
to the qmake build. Add a read-only compile mode,
enabled by defining QT_JSON_READONLY.

Add qmake built-in function parseJson(file, into)
which parses a json file into the given variable.

qmake uses a flat key -> value-list implementation
for storing variables, which means that some hackery
is need to represent arbitrarily nested JSON. Use a
special "_KEYS_" variable for arrays and objects:

Arrays:
["item1", "item2"]
$${array._KEYS_} -> 0 1 2
$${array.0} -> "item1"
$${array.1} -> "item2"

Objects:
{ "key1" : "value1", "key2" : "value2" }
$${object._KEYS_} -> key1 key2
$${object.key1} -> value1
$${object.key2} -> value2

Change-Id: I0aa2e4e4ae14fa25be8242bc16d3cffce32504d2
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-10-17 08:07:25 +02:00
Tor Arne Vestbø
413ec67fc4 qmake: add $$title() function to convert strings to title case
Change-Id: Ic535a8f7cc2ab7b7f1948b2d0237ebe9a71c7ec7
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
2013-09-24 14:33:00 +02:00
Oswald Buddenhagen
e0f2603f49 avoid deadlock in cache() during spec/cache loading
sync up; this doesn't actually do anything in qmake.

if we end up calling cache() from within the initialization of the base
context, we cannot wait for for the completion of that initialization
before we proceed, obviously.

Change-Id: If30c6f3665fe423e767373a8821c406b2f5e0eca
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
(cherry picked from qtcreator/b64b4431c20afd9e39c1463e736f998ef450688f)
2013-08-27 13:36:34 +02:00
Oswald Buddenhagen
652bdb8894 lock baseEnv in cache()
sync up; this doesn't actually do anything in qmake.

as we modify the environment, it must be properly locked.
this implies that initFrom() also needs to be called with a lock.

Task-number: QTCREATORBUG-9835
Change-Id: I48bae9af9adaa0518e5a9db0ba08ff057ae14f9f
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
(cherry picked from qtcreator/d022a2d19cecb00397c2a215fc4e3bf64b1e627b)
2013-08-27 13:36:31 +02:00
Oswald Buddenhagen
b215176da3 implement simple VFS to support caching during project parsing
sync up with qt creator - for qmake itself, this is just a minor
refactoring.

Change-Id: I833253f81c3159056fab2ff888f293b36cc2ef56
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
(cherry picked from qtcreator/66802ef8bf7989dc025e34bf91d93576189c483c)
(cherry picked from qtcreator/69542826fa643a0fed2fc9e717f072c2852dc017)
(cherry picked from qtcreator/196424115338fb9a535810704b7d814d318b0462)
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
2013-08-07 13:58:41 +02:00
Oswald Buddenhagen
4b600bd3c1 don't unnecessarily use QFileInfo::filePath()
just directly use the filename we constructed it from.

Change-Id: Ia428a2cb4b192fea6bde62dfbf35361bcfc4b21e
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
(cherry picked from qtcreator/571234786a3ff7e8e3a9220f12d22a9f74f7a53c)
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
2013-07-19 17:15:16 +02:00
Oswald Buddenhagen
fe8dcfaef1 make stubs for dangerous/useless qmake functions in limited mode
sync up implementation with lupdate & creator. no actual effect on
qmake.

Change-Id: I1bdeb759e895e4200f09332dadf8a6cef348182f
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
(cherry picked from qttools/94ab2efb2d155d3c1ca7b91c1daf443a149bcf1f)
2013-06-12 16:27:04 +02:00
Orgad Shaneh
81f4ecdd79 Fix warning
Warnings came up using MinGW 4.4:
* qmakebuiltins.cpp: 'QString windowsErrorCode()' defined but not used
[...]

Change-Id: I80827f7f740ff380f13cef96d6b43baaa7e179cb
(cherry picked from qtcreator/0e13cf3faffc7463ae2bf535dfdb008202112cc4)
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
2013-05-20 15:20:26 +02:00
Oswald Buddenhagen
ae94bf2b7a 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>
2013-03-16 00:12:47 +01:00
Orgad Shaneh
601ab660af Remove braces for single lines of conditions
#!/usr/bin/env ruby

Dir.glob('**/*.cpp') { |file|
  # skip ast (excluding paste, astpath, and canv'ast'imer)
  next if file =~ /ast[^eip]|keywords\.|qualifiers|preprocessor|names.cpp/i
  s = File.read(file)
  next if s.include?('qlalr')
  orig = s.dup
  s.gsub!(/\n *if [^\n]*{\n[^\n]*\n\s+}(\s+else if [^\n]* {\n[^\n]*\n\s+})*(\s+else {\n[^\n]*\n\s+})?\n/m) { |m|
    res = $&
    if res =~ /^\s*(\/\/|[A-Z_]{3,})/ # C++ comment or macro (Q_UNUSED, SDEBUG), do not touch braces
      res
    else
      res.gsub!('} else', 'else')
      res.gsub!(/\n +} *\n/m, "\n")
      res.gsub(/ *{$/, '')
    end
  }
  s.gsub!(/ *$/, '')
  File.open(file, 'wb').write(s) if s != orig
}

Change-Id: I3b30ee60df0986f66c02132c65fc38a3fbb6bbdc
Reviewed-by: hjk <qthjk@ovi.com>
(cherry picked from qtcreator/29a93998df8405e8799ad23934a56cd99fb36403)
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
2013-02-06 14:21:44 +01:00
Oswald Buddenhagen
8705480587 support alternative and multiple suffixes in $$resolve_depends()
this is undeniably a new feature, but it's needed for a bugfix.

Change-Id: I951a3128eb580404ee0c7e3cdcb4d6170e899f70
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
2013-02-04 15:10:19 +01:00
Sergio Ahumada
48e0c4df23 Update copyright year in Digia's license headers
Change-Id: Ic804938fc352291d011800d21e549c10acac66fb
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-01-18 09:07:35 +01:00
Simon Hausmann
f45d6414ad Fix qmake's pro file cache to interact correctly with write_file
When writing a file with write_file() we have to inform the pro file parser
cache to discard the file if it's existant in the cache, to ensure that
calling include() after write_file() always works.

Change-Id: I7d09269a57de55ca30b0e11dd40770de9f919f64
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2012-10-25 16:22:00 +02:00
Iikka Eklund
be15856f61 Change copyrights from Nokia to Digia
Change copyrights and license headers from Nokia to Digia

Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
2012-09-22 19:20:11 +02:00
Oswald Buddenhagen
0da7f09724 make error() abort the qmake run, not just the current file
Change-Id: I82fc55680f9ffb227e25acb39c797596225ba89e
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2012-09-21 02:44:22 +02:00
Oswald Buddenhagen
d92fd4ca54 fix non-bootstrapped $$system()'s line end conversions on windows
Change-Id: I026da1312bc28619dc7aa5974b7f4c00710517ac
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
2012-09-18 17:39:50 +02:00
Oswald Buddenhagen
849f1f9efd don't allow overloading of built-in functions
the functions are not versioned or scoped, so user-defined overloads would
mess up qmake's own feature files. it seems safer to break user projects
than to allow the user to break qmake.

Change-Id: I020a2e6416bbb6e2fd2ece339629d848c00c8398
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2012-09-18 07:47:14 +02:00
Oswald Buddenhagen
b04192d94b remove support for non-lowercased $$eXpaNd() functions
we have been warning about such functions for a while now, now execute.
the qmake language is (generally) case-sensitive, so this wasn't all
that useful anyway.

Change-Id: I1388ac2d5a1104389aeb3347e739a0d5e69e138d
Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
2012-09-13 03:42:57 +02:00
Oswald Buddenhagen
8400896cfe 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>
2012-09-13 03:42:44 +02:00
Oswald Buddenhagen
0e78e50802 port qmake to qt creator's qmake language evaluator
this is a monster commit which does the following things:
- import the evaluator as-is from qt creator into qmake/library/
  - integrate it into qmake's makefiles
  - overwrite proitems.h with actual special types
- remove the parts of Option which are redundant with QMakeGlobals
- make QMakeProperty a singleton owned by Option::globals. the dynamic
  handling so far made no sense.
- make QMakeProject a subclass of QMakeEvaluator, with relatively few
  extensions

the changes to existing qmake code outside project.* and option.* are
minor. implementing the changes gradually would mean changing a lot of
code which will be just replaced in the next commit, so i'm not wasting
my time on it.

Change-Id: I9746650423b8c5b3fbd8c3979a73228982a46195
Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
2012-09-11 00:13:01 +02:00