summaryrefslogtreecommitdiffstats
path: root/src/tools/moc/preprocessor.cpp
Commit message (Collapse)AuthorAgeFilesLines
* moc: rewrite mergeStringLiterals() to avoid O(N²) algorithmMarc Mutz2025-08-011-22/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The old code called QList::erase(it, it) in a loop; which causes quadratic behavior. Fix by writing a std::unique-inspired merge algorithm that works in linear time, at the cost of merging only pairs of consecutive STRING_LITERALs. The old code tried to merge maximal sequences of adjacent STRING_LITERALs. This should not make much of a difference, since QByteArray grows geometrically, so appends (and insert at end - 1 is almost append) take amortized linear time in the final size of the result. Symbol is a QByteArray version of QStringRef (i.e. a cheap substring: string, from, len), except with individual copies of the underlying string, so make sure to rid Symbol::lex of non-lexem() data before merging. Aurélien reports that `lex` may contain a whole file, so this is an important step. Aurélien reports a 6x speedup on one of his benchmark files. Amends 0c9d1f99dac5c118d49e7f2b04f70eae3ba7b837. Reported-by: Aurélien Brooke <aurelien@bahiasoft.fr> Done-with: Aurélien Brooke <aurelien@bahiasoft.fr> Pick-to: 6.10 6.9 6.8 6.5 Change-Id: I1093a43c3727fde1785795b1aac7417be011bad8 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Aurélien Brooke <aurelien@bahiasoft.fr>
* moc: pass Symbols by reference, not pointerMarc Mutz2025-07-291-3/+2
| | | | | | | | | | | The very first line converts the pointer into a reference, so just pass that. Amends 0c9d1f99dac5c118d49e7f2b04f70eae3ba7b837. Pick-to: 6.10 6.9 6.8 6.5 Change-Id: I3e8c863996fb6f2d35533f216336459ae547ba57 Reviewed-by: Aurélien Brooke <aurelien@bahiasoft.fr> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* moc: add lexem() functions that return QByteArrayViewsAurélien Brooke2025-07-211-8/+7
| | | | | | | | | | | | | | | | | In many cases, the result of the lexem() functions is only used as a view and is not stored. To avoid constructing thousands of temporary QByteArray instances, introduce lexemView() and unquotedLexemView() that return a QByteArrayView instead. We need to carefuly remove .constData() calls on previously-QByteArrays, because QByteArrayViews may not be NUL-terminated, so we must transfer the size information to e.g. QString::fromLocal8bit(). This saves only about 3 % of temporary allocs but enables further optimizations. Change-Id: I55e389f7602ac42d3e2f83b38161286d5c17bb48 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* moc: use the new QStack::push(T&&) function to push on the symbols stackAurélien Brooke2025-07-211-2/+2
| | | | | | | This avoids making costly copies of SafeSymbols. Change-Id: Ib29dec98ced43712ce758ffe4caaf123bd509dd1 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* moc: reserve() enough space for the SymbolStackAurélien Brooke2025-07-181-0/+1
| | | | | | | | | | | | | | | | | | We know that the "symbols" stack will be at least of size one, and runtime analysis shows that it can grow up to 7: Max size Occurences 2 3778 3 5157 4 10920 5 6888 6 281 7 18 Call reserve() so that we never need to reallocate and move SafeSymbols structs, which are not trivial to move. Change-Id: I2c4a1f8637ff3636bc78b19e7bef61371f614944 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* moc: support __has_includeFabian Kosmale2025-06-141-5/+45
| | | | | | | | | | | | | __has_include is part of C++17, but moc did not handle it so far. This commit fixes moc to correctly support it. It should be noted that support for __has_include relies on all necessary include paths being passed to moc. Pick-to: 6.10 6.9 6.8 Fixes: QTBUG-136097 Change-Id: I7284e97dea12d1637b38349d32e090c0102124e7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* moc: Treat number + characters as Identifier, not NumberFabian Kosmale2024-04-171-2/+11
| | | | | | | | | | | | | | | | | While <DIGIT>+<Character> is not a valid identifier by itself in the C++ language, it might become one when using it with the token pasting operator. This risks confusing some number literals with suffix as Identifiers, but those are currently not supported anyway, so this shouldn't break anything that is currently working. Fixes: QTBUG-87219 Fixes: QTBUG-124288 Pick-to: 6.7 Change-Id: If73255cc0e6649bc90c52b1d177aac8ff975ae69 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* moc: Remove remnants of USE_LEXEM_STOREFabian Kosmale2023-08-101-19/+2
| | | | | | | | | | Defining USE_LEXEM_STORE breaks compilation, and the commit that introduce it (in the pre-public history) does not shed any light on its usage. Change-Id: Ic616bf9f2584151dab3f654d64025fcdc0ade25c Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* moc: handle "L" integer suffixFabian Kosmale2023-07-281-3/+9
| | | | | | | | | | | | | | | | This commit adds some initial support for handling the 'L' suffix after numbers. This one is especially important given that the __cplusplus define is using it. Other suffixes will be handled in some later commit, which should also unify the already divergent parse behavior between DIGIT and PP_DIGIT parsing (e.g. when it comes to byte prefixes). Task-number: QTBUG-83160 Task-number: QTBUG-115558 Pick-to: 6.6 6.5 6.2 Change-Id: Ie61eae49c468abfaee80e7e4f7097917a254dc0e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* MOC: use methods from QtMiscUtilsAhmad Samir2023-06-221-8/+10
| | | | | | Change-Id: I20600357841aff36f68bcc9a81bfb3e96bf6e264 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Moc: fix narrowing conversion warnings by using iterator-based for-loopAhmad Samir2023-06-201-4/+7
| | | | | | | | | | | | | | The alternative would be to explicitly cast each list.size() to int. I think using iterators is a cleaner solution. Drive-by changes: - Give a std::pair's members better names than first/second, by using a structured binding - Port to qsizetype Pick-to: 6.6 6.5 Change-Id: Icff3126192f9813fba698d5722b209307011ca48 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Moc: port to qsizetypeAhmad Samir2023-06-201-5/+5
| | | | | | | Pick-to: 6.6 6.5 Change-Id: Ibacc9b4bd6c26b890a09f689c730286c2aa0894c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Moc: port to qsizetypeAhmad Samir2023-05-281-2/+2
| | | | | | | | Simple s/int/qsizetype/. Fixes some narrowing conversion warnings. Pick-to: 6.5 Change-Id: Ied82e861298fa9763089cadc7eae6e536f1bb9ca Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Moc: fix some narrowing conversion warnings by using range operationsAhmad Samir2023-05-181-7/+9
| | | | | | | | | | | | I.e. range-for and in one case QList::append(iterator, iterator). Drive-by changes: - Check a QByteArray isn't empty before using at() - Shorten a long line, QString::fromLocal8Bit() works with QByteArray Pick-to: 6.5 Change-Id: I7e54ce39f65ccb1fe5e60693ac98e239b9f0d794 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Port from container.count()/length() to size()Marc Mutz2022-10-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is semantic patch using ClangTidyTransformator: auto QtContainerClass = expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o) makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container'. <classes> are: // sequential: "QByteArray", "QList", "QQueue", "QStack", "QString", "QVarLengthArray", "QVector", // associative: "QHash", "QMultiHash", "QMap", "QMultiMap", "QSet", // Qt has no QMultiSet Change-Id: Ibe8837be96e8d30d1846881ecd65180c1bc459af Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-161-28/+3
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* moc: Add --debug-includes option to mocAlexandru Croitor2022-04-051-4/+37
| | | | | | | | | | | | Because moc silently ignores missing headers, or sometimes includes the wrong header, it is useful to have a facility to print which header paths were considered and found. Add a new --debug-includes option that does that. Task-number: QTBUG-101775 Change-Id: I72b294ae53d6e47252c7d8afe0f2245da78bfadb Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Core: Do not depend on transitive includesFabian Kosmale2022-03-171-0/+1
| | | | | Change-Id: I2c71188a4d27692a2d6ef1aa447b329627214b17 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Avoid signed overflow in mocFabian Kosmale2020-12-031-1/+9
| | | | | | | | | | | | | | | | moc's preprocessor needs to implement certain math operation to correctly handle #if conditions. Unfortunately, its implementation is not overflow safe. However, those are rare enough in practice that we in general do not need to care about them. This patch adds a workaround for one case where UBSAN run into an overflow related issue. A complete fix would require to make moc spec compliant (do math with std::max_(u)int_t operands; always wrap on overflow) in all operations. Pick-to: 6.0 5.15 Fixes: QTBUG-88825 Change-Id: Ic4d2cb097db2fa2f9d4681bbaab3068eaa2745aa Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Tidy nullptr usageAllan Sandfeld Jensen2019-12-061-1/+1
| | | | | | | | | | | Move away from using 0 as pointer literal. Done using clang-tidy. This is not complete as run-clang-tidy can't handle all of qtbase in one go. Change-Id: I1076a21f32aac0dab078af6f175f7508145eece0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Make moc grok binary literals with digit separatorsVille Voutilainen2019-05-101-1/+2
| | | | | | Task-number: QTBUG-75656 Change-Id: I6011ef2fb07497cc2a055d6828a1b6356927c281 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Simplify ifs since PP_WHITESPACE and WHITESPACE are the sameAlbert Astals Cid2018-01-151-3/+3
| | | | | Change-Id: Ib18c60270d9275840db051f1eec86227cc8f6c1c Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Fix clazy-strict-iteratorsFriedemann Kleint2017-10-251-1/+1
| | | | | Change-Id: I9276a85f0a8061b2636687cf694b8ed1abaa18b8 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* moc: Don't error out when defining a keywordOlivier Goffart2017-06-061-7/+6
| | | | | | | | | | | | Normaly, in C++ It's not valid to define a keyword, but it turns out that some system header do, so we just silently accept it. [ChangeLog][moc] moc no longer errors out if a C++ keyword is #define'ed Task-number: QTBUG-61204 Change-Id: Ia4d3ff9c77b6ff261b6140c220cfb81bd13f1d6d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* moc: Fix parsing of digit separatorOlivier Goffart2017-03-081-8/+8
| | | | | | | | | [ChangeLog][moc] Fixed parsing errors in presence of C++14 digit separators. Task-number: QTBUG-59351 Change-Id: Iea38ea7388853d84b819c2beb78a59371f57bf7d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* moc: Cache header lookups to reduce number of file stat'sThomas Sondergaard2016-11-031-8/+21
| | | | | | | | | | | | | | This improves moc performance on Windows where file-stat'ing is slow and where the number of project include paths to search is often high because project third-party headers are installed in separate directories rather than a shared include path such as /usr/include. In a real project of non-trivial size it reduces the total from-scratch build time of an optimized build using CMake+ninja with 32 cores by 11% from ~11m35s to ~10m15s. Change-Id: Ieed59646927ed75c55ed9efa97600c328b2fed2c Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* moc: Fix asserts on moc on empty token preceding ## operatorOlivier Goffart2016-09-161-3/+3
| | | | | | | | | | Regression introduced in c32ef0a725c7ac9d8a9ab053407389ef2fddc64e The expansion vector can be empty, in that case it is not allowed to call constLast() Task-number: QTBUG-55853 Change-Id: I47aa8eb7507ee91662215df42b4a66eebaa32bb5 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
* Support C++17 fallthrough attributeAllan Sandfeld Jensen2016-08-191-5/+5
| | | | | | | | | Replaces our mix of comments for annotating intended absence of break in switches with the C++17 attribute [[fallthrough]], or its earlier a clang extension counterpart. Change-Id: I4b2d0b9b5e4425819c7f1bf01608093c536b6d14 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge "Merge remote-tracking branch 'origin/5.7' into dev" into refs/staging/devEdward Welbourne2016-07-221-4/+4
|\
| * Merge remote-tracking branch 'origin/5.7' into devEdward Welbourne2016-07-191-4/+4
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: qmake/library/qmakebuiltins.cpp qmake/library/qmakeevaluator.cpp qmake/library/qmakeevaluator.h qmake/project.h QMakeEvaluator: * evaluateConditional(): one side changed return type, the other changed a parameter type. * split_value_list(): one side changed a parameter adjacent to where ... * expandVariableReferences(): ... the other killed one overload and changed the survivor src/corelib/io/qlockfile_unix.cpp One side changed a #if condition, the other moved NETBSD's part of what it controlled. src/corelib/tools/qdatetime.cpp One side fixed a reachable Q_UNREACHABLE in toMSecsSinceEpoch(), the other moved it from the private class to the public one, in the midst of the "short date-time" optimization, which confused diff entirely. One side changed a QStringLiteral to QLatin1String, the other rewrote adjoining code. src/network/kernel/qauthenticator.cpp Both rewrote a line, equivalently; kept the dev version. src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h One side changed #if-ery that the other removed. tools/configure/configureapp.cpp One side added a check to -target parsing; the other killed -target. tests/auto/testlib/selftests/expected_cmptest.lightxml tests/auto/testlib/selftests/expected_cmptest.teamcity tests/auto/testlib/selftests/expected_cmptest.txt tests/auto/testlib/selftests/expected_cmptest.xml tests/auto/testlib/selftests/expected_cmptest.xunitxml Regenerated using generate_expected_output.py I note that quite a few other expected_* come out changed, now. There was no git-conflict in src/widgets/kernel/qformlayout.cpp but it didn't compile; one side removed some unused methods; the other found uses for one of them. Put FixedColumnMatrix<>::removeRow(int) back for its new user. Change-Id: I8cc2a71add48c0a848e13cfc47b5a7754e8ca584
| | * Merge remote-tracking branch 'origin/5.6' into 5.7Edward Welbourne2016-07-151-4/+4
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: qmake/library/qmakeevaluator.cpp One side changed the iterator to use ranged-for, the other changed its body; they only conflicted because the latter had to add braces around the body, intruding on the for-line. Trivial resolution. Change-Id: Ib487bc3bd6e3c5225db15f94b9a8f6caaa33456b
| | | * moc: Fix a crash with malformed inputOlivier Goffart2016-07-151-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Do not increment 'data' past the buffer in case of invalid token. Remove the left over qDebug so we can make a test. Task-number: QTBUG-54609 Change-Id: I8f0dd3381fbdea3f07d3c05c9a44a16d92538117 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
* | | | moc: get the system #defines from the compiler itselfThiago Macieira2016-07-201-25/+33
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order for moc to properly parse #ifdefs and family, we've had QMAKE_COMPILER_DEFINES as a list of pre-defined macros from the compiler. That list is woefully incomplete. Instead, let's simply ask the compiler for the list. With GCC and family, we use the -dM flag while preprocessing. With ICC on Windows, the flag gains an extra "Q" but is otherwise the same. For MSVC, it requires using some undocumented switches and parsing environment variables (I've tested MSVC 2012, 2013 and 2015). The new moc option is called --include to be similar to GCC's -include option. It does more than just parse a list of pre-defined macros and can be used to insert any sort of code that moc needs to parse prior to the main file. Change-Id: I7de033f80b0e4431b7f1ffff13fca02dbb60a0a6 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* / / Don't error out on preprocessor concatenation of two stringsLars Knoll2016-07-131-5/+2
|/ / | | | | | | | | | | | | | | | | | | | | | | | | "foo" ## "bar" doesn't make a lot of sense, but MSVC allows them (although gcc errors out on them). Simply ignore the ## in this case instead of aborting with an error. Fixes parsing of the Windows winsock2.h header. Task-number: QTBUG-54560 Change-Id: I84cd5fbb56a006cf379430708c955cf0da475cff Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-05-191-2/+4
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp src/network/access/qnetworkaccessmanager.cpp src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.h src/widgets/widgets/qlineedit_p.cpp src/widgets/widgets/qlineedit_p.h src/winmain/winmain.pro tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp tests/auto/dbus/qdbusconnection/tst_qdbusconnection.h tests/auto/testlib/selftests/expected_cmptest.teamcity tests/auto/testlib/selftests/expected_cmptest.txt tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp tools/configure/configureapp.cpp Change-Id: Ib9997b0d0f91946e4081d36c0c6b696c5c983b2a
| * Moc: fix crash when a file ends with \\\rOlivier Goffart2016-05-181-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | make the 'cleaned' more robust by making sure we do not read past the buffer in some cases. We must also use resize and not reserve on the outpt buffer because reseve is meant as a hint and we are not supposed to write past the size of the QByteArray even if it is reserved. [ChangeLog][moc] Fixed crash on file ending with \\\r Task-number: QTBUG-53441 Change-Id: I901e6c0ffc7f8877de3d07fd08cf26495461d294 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com> Reviewed-by: Robert Loehning <robert.loehning@qt.io>
* | Moc: use QStringBuilder moreAnton Kudryavtsev2016-04-201-7/+7
| | | | | | | | | | | | | | | | | | | | Adding strings in a single expression gets mediated efficiently by QStringBuilder, where using += repeatedly forces premature consolidation. Change-Id: I6c1abb9c9801a016ce6c151cffdf8c7ac9502f4e Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Moc: use const (and const APIs) moreAnton Kudryavtsev2016-04-181-9/+9
| | | | | | | | | | | | | | | | For CoW types, prefer const methods to avoid needless detach()ing. Change-Id: Iefc33552d826aa30320e52acd2d421c9bdae127e Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Updated license headersJani Heikkinen2016-01-211-17/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Optimize moc: Preallocate space for list of preprocessed symbols.Milian Wolff2015-12-121-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Without this, the symbol list is frequently reallocated. The value is a guestimate. It corresponds to a block of memory with the size 262144 * 3 * 8 byte = ca. 6.3 megabytes on a 64 bit machine. Looking at the final size of the symbol list, this seems to fit the common case nicely. Change-Id: Ib546a1ea479f2c6d8ab57be783cdf630f9b54f77 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2015-10-231-1/+4
|\| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf configure src/corelib/global/qglobal.h src/tools/qdoc/node.cpp src/tools/qdoc/qdocdatabase.cpp tests/auto/corelib/io/qsettings/tst_qsettings.cpp tools/configure/configureapp.cpp Change-Id: I66028ae5e441a06b73ee85ba72a03a3af3e8593f
| * Split two error cases so they get reported distinctly.Edward Welbourne2015-10-161-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a macro is used with too few parameters, complaining about its definition using '#' followed by something other than a macro parameter name is apt to be confusing - reading the definition will reveal that the name in fact is a macro parameter after all. The reader needs attention directed to the invocation, not the definition. Split the test in two: one to test the prior error message does in fact get produced for an invalid macro definition, the other to test the invalid invocation case. Task-number: QTBUG-46210 Change-Id: Ie177a56d346e553bf9d67e2008a4352633afa1ae Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | Optimize moc: Preallocate some space for tokenization results.Milian Wolff2015-09-141-0/+5
|/ | | | | | | | The value was found by looking at the common ratio between input size and final size of the result list. Change-Id: I5762c15156afad4a7b8c1538e886058b3b5b0673 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* moc: Make toExpand const, we do not modify it.Milian Wolff2015-07-231-1/+1
| | | | | Change-Id: I7036ea7ee9e533670ebed425e6c4a8bb0063f751 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Optimize moc: Preallocate space for list of arguments on the stack.Milian Wolff2015-07-221-1/+1
| | | | | | | This removes the temporary QList allocations. Change-Id: I1f255e94730202f719e0a97b9ab4a83e28b805c1 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Optimize moc: Remove another temporary list allocation.Milian Wolff2015-07-141-5/+5
| | | | | | | | | | | In the common case, macroExpandIdentifier was called in the "not a macro" case, and a temporary vector with a single item was allocated. Now, we catch this common case at the caller site and put the single item directly into the result set, bypassing the temporary list. Change-Id: I71d92afc486ccdaae5930405d028f53f48073b8c Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Optimize moc: Remove temporary allocations during macro expansion.Milian Wolff2015-07-131-9/+6
| | | | | | | | | | Previously, a temporary list was allocated and then fed into the bigger list of results. Now, we push data into the final list directly, removing the overhead of the temporary allocation. Change-Id: I9bea0fd3c23b1434b4be2728c60ac22a66908efc Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* moc: Fix crash parsing invalid macro invocationOlivier Goffart2015-05-301-3/+5
| | | | | | | | | | | | | | When invoking a macro with less argument than it expect, we would crash trying to access the vector of arguments from the invocation as we are trying to substitute an argument. (Note that we do not show an error in case of argument mismatch because ithat might happen parsing valid code as moc's c++ parser is not 100% accurate (that was QTBUG-29331)) Task-number: QTBUG-46210 Change-Id: I3f08d7f5049e593a5bdc02a594ea63cadf66e7a4 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | 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>
* Merge remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2014-11-241-5/+1
|\ | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qiodevice.cpp src/plugins/bearer/linux_common/qofonoservice_linux.cpp src/plugins/bearer/linux_common/qofonoservice_linux_p.h src/plugins/platforms/android/qandroidplatformtheme.cpp src/tools/bootstrap/bootstrap.pro src/widgets/styles/qmacstyle_mac.mm Change-Id: Ia02aab6c4598ce74e9c30bb4666d5e2ef000f99b