aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2
Commit message (Collapse)AuthorAgeFilesLines
* shiboken: Remove unused code related to enumerationsFriedemann Kleint2018-02-282-29/+2
| | | | | | | | Remove class struct EnumValueRedirection and add explanatory comment to EnumValueTypeEntry. Change-Id: Ic4665436f301943805c7985188bc41c4ad3e8336 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Type system parser: Refactor convertBoolean()Friedemann Kleint2018-02-282-10/+10
| | | | | | | | Turn it into a static helper and use QString::compare() to avoid the call to toLower(). Change-Id: Ifc10a7e8b5df4df80ee23135e32aea34ed72d295 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Type system parser: Introduce QStringLiteral for attribute valuesFriedemann Kleint2018-02-281-29/+34
| | | | | | | Avoid QString allocations for them. Change-Id: Ia55fba30f790a938900e7b5217daeaa6098beaf6 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* shiboken/qtdocgenerator: Fix inline imagesFriedemann Kleint2018-02-282-14/+57
| | | | | | | | | | | | | | | | | | The rst ::image elements do not work inline, they require a line each. Work around as recommended by using rst substitution references instead, using a tag enclosed in '|' and defining it below. Split out a separate inline image handler and store the references to be written out later. Fixes warnings like: WARNING: image file not readable: PySide2/QtCore/images/cursor-cross.pngAcrosshaircursor,typicallyusedtohelptheuseraccuratelyselectapointonthescreen. Task-number: PYSIDE-363 Change-Id: I860875957688885ca48038aa3aa96bd9c38da709 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* shiboken/qtdocgenerator: Escape more charactersFriedemann Kleint2018-02-271-1/+6
| | | | | | | | | | Fix several warnings: Inline literal start-string without end-string. Task-number: PYSIDE-363 Change-Id: Iadd753d9e8c46b6f00e915e494b01f763e6ce035 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* shiboken/qtdocgenerator: Pass full name for inheritance diagramFriedemann Kleint2018-02-271-1/+1
| | | | | | | | | | | Fixing numerous warnings: WARNING: Could not import class '...' specified for inheritance diagram Task-number: PYSIDE-363 Task-number: PYSIDE-617 Change-Id: I84013d8be442c43212f0726a141ce0dc9b51c92c Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Fully qualify enum valuesFriedemann Kleint2018-02-263-71/+115
| | | | | | | | | | | | | | When using C++11 enum classes, enum values need to be fully qualified. Add the enum name where the values are written and handle it in the various resolve() functions. Split out ShibokenGenerator::guessScopeForDefaultFlagsValue() from ShibokenGenerator::guessScopeForDefaultValue() for clarity. Task-number: PYSIDE-487 Change-Id: Idf8d627ab88111ad67734bee8b4d130ef53e038d Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Fix generated initialization code for enum classesFriedemann Kleint2018-02-263-1/+7
| | | | | | | | | | Wrap value in int(), which is required for enum classes. Add a compile test to libsample. Task-number: PYSIDE-487 Change-Id: I78f07ae66da64caad1f75722308256e40e91eded Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* shiboken: Refactor finding of enumerationsFriedemann Kleint2018-02-235-75/+52
| | | | | | | | | | | | | | | - Add helper AbstractMetaEnum::findEnumValue() which finds unqualified as well as qualified enum values. - Remove unused function bstractMetaClass::findEnumForValue(QString). - Remove 2nd parameter from AbstractMetaClass::findEnumValue(QString, AbstractMetaEnum *). The comment claimed that it is excluded from the search, but the condition was the reverse. Just removing it apparently does not do harm. Task-number: PYSIDE-487 Change-Id: I32b036045ea335b805fba79df327cc42d787f18c Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Merge remote-tracking branch 'origin/5.6' into 5.9Friedemann Kleint2018-02-233-1/+3
|\ | | | | | | Change-Id: I5d1a4734e8f44785898ba62beaa0bdd2004fca22
| * Don't copy duplicate libraries on package installationAlexandru Croitor2018-02-223-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change makes sure to resolve symlinks and copy only one file for every dynamic shared library used (vs 3 before -> 2 symlinks + 1 actual library). This avoids duplicate files, as well as saves space when creating wheel (e.g. no 3 copies of standalone WebEngine library). This filtering happens copying from CMake install dir into pyside_package_dir (the symlinks are still present in the CMake dir, but that shouldn't harm anybody, and might be useful for users of shiboken only for example). Task-number: PYSIDE-495 Change-Id: I0fe454e16c6b254a8682aa7b1c702ec01a3064f0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | sphinx: Remove deprecated config keysFriedemann Kleint2018-02-232-8/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove - html_add_permalinks: the key has been changed to str and has a default. - html_use_smartypants: Replaced by smartquotes and defaults to true. Fixes warnings: WARNING: The config value `html_add_permalinks' has type `bool', defaults to `str'. WARNING: html_use_smartypants option is deprecated. Smart quotes are on by default; if you want to disable them, use the smartquotes option. Task-number: PYSIDE-363 Change-Id: I85092597a860f58cc012220edbf0c03749326432 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | QtDocGenerator/QtXmlToSphinx: Fix see-also linksFriedemann Kleint2018-02-222-93/+166
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "See also" links may appear in the qdoc WebXML output as nested links: <see-also>QAbstractXmlReceiver<link raw="isValid()" href="qxmlquery.html#isValid" type="function">isValid()</link> which was handled in handleLinkTag(), or as direct text: <see-also>rootIsDecorated()</see-also> which was not handled, causing numerous warnings: .../QAbstractXmlNodeModel.rst:448: WARNING: Content block expected for the "seealso" directive; none found. Refactor and split QtXmlToSphinx::handleLinkTag() into several functions to operate on a struct LinkContext and keep 2 instances for nested link tags and directly embedded links. Task-number: PYSIDE-363 Change-Id: I734884267209f3621bfc5db4bf4347b838eb0de6 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | Reduce number of warnings when running shiboken on a custom moduleAlexandru Croitor2018-02-221-8/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Running shiboken on a custom XML file (like the scriptableapplication example) would show tons of warnings about not being able to find certain types or enums or other things inside Qt modules. For scriptableapplication that was the case, because the wrappedclasses.h file would only include the <QMainWindow> header file, and not the rest of QtWidgets / QtGui headers, which means that shiboken found types declared in XML files, but could not find the actual declarations inside the preprocessed header file. This change adds some additional conditions so that warnings are not printed when a typesystem file is loaded with the generate="no" attribute, because no C++ code will actually be generated for types defined inside such a typesystem file. Task-number: PYSIDE-587 Change-Id: I1f166483c2f343796e08d3142e5e296c4ee43f27 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | QtDocGenerator: Indent the function list containerFriedemann Kleint2018-02-211-1/+1
| | | | | | | | | | | | | | | | | | Fix warnings: Content block expected for the "container" directive; none found Task-number: PYSIDE-363 Change-Id: Ie855ac355478060c0d280413a31dffcb03cf3935 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | QtDocGenerator: Ensure newline before tablesFriedemann Kleint2018-02-211-4/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix warnings like: warning: Undefined substitution referenced: "Constant |Description" on tables like: *amplitude**period* +-------------------------+-----------+ |Constant |Description| +=========================+===========+ |QEasingCurve.InOutElastic| | +-------------------------+-----------+ Task-number: PYSIDE-363 Change-Id: I56cd9b73dacbfd84260c059a8916db5540029816 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | QtDocGenerator: Add newline before Synopsis/Detailed DescriptionFriedemann Kleint2018-02-211-3/+5
| | | | | | | | | | | | | | | | | | Fix sphinx warnings: warning: Explicit markup ends without a blank line; unexpected unindent Task-number: PYSIDE-363 Change-Id: Iec9d8b35317dc9c1009db468284cb7b7a88104a0 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | QtDocParser: Fix and refactor queriesFriedemann Kleint2018-02-211-34/+58
| | | | | | | | | | | | | | | | | | | | | | | | - Use a QTextStream for better readability - Extract a helper function to format the function parameter type query: - Fix the function parameter type attribute ("left"->"type") - Fully qualify enumeration and other non-primitive types Task-number: PYSIDE-363 Change-Id: I529e839fb737f30bd9b70d10a48fcfb0c9141f8f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | Documentation extraction: Add error handlingFriedemann Kleint2018-02-216-13/+100
| | | | | | | | | | | | | | | | | | Trim the strings returned by the XPath queries and warn about failing queries. Task-number: PYSIDE-363 Change-Id: Ia0233d490497597cb78aa16b0908fe226270705c Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | DocParser: Add helper function to create list of documentable functionsFriedemann Kleint2018-02-215-35/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Move code from shouldSkip() helper of the doc generator into the doc parser and use that for the qdoc/doxygen parsers. The additional checks (most importantly the check for declaringClass != ownerClass excluding the virtual functions added by AbstractMetaClass::fixFunctions() to derived classes) avoid running unneeded XPATH queries. Task-number: PYSIDE-363 Change-Id: Ib1141a348c96b269a50c63dd94fe93931c12d1ec Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | shiboken/docgenerator: Refactor code doing the escapes for rstFriedemann Kleint2018-02-201-18/+39
| | | | | | | | | | | | | | | | | | | | Introduce a streamable class that does the escaping and some helpers for QString/QStringRef. Task-number: PYSIDE-363 Change-Id: Ica6d8a2ab43eeb597b4e9080330dc2ce700e0ed2 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | shiboken/docgenerator: Remove unneeed QStringRef::toString() callsFriedemann Kleint2018-02-201-5/+5
| | | | | | | | | | | | Change-Id: I4bbaa7d46bab2526906655c5f03bbd25a142bbc4 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | Merge "Merge remote-tracking branch 'origin/5.6' into 5.9" into refs/staging/5.9Friedemann Kleint2018-02-201-1/+0
|\ \
| * | Merge remote-tracking branch 'origin/5.6' into 5.9Friedemann Kleint2018-02-201-1/+0
| |\| | | | | | | | | | Change-Id: If56adeea2f888d8bc34e202b697f735508896c84
| | * Fix heap corruption crash on macOS 10.8 CI machineAlexandru Croitor2018-02-201-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The macOS 10.8, PySide2 branch 5.6 integrations were misteriously failing with crashes on exit in the objecttype_test.py test, with a stack trace similar to: 0x00007fff8899e90a _sigtramp + 26 0x0000000100784710 0x0 + 4302849808 (note the 0x0 address) 0x0000000100055408 dict_traverse + 168 0x0000000100107f77 collect + 407 0x00000001001089f4 PyGC_Collect + 52 0x00000001000ef503 Py_Finalize + 259 0x00000001000eefca handle_system_exit + 250 0x00000001000ef235 PyErr_PrintEx + 469 0x00000001000efebb PyRun_SimpleFileExFlags + 299 0x00000001001071dd Py_Main + 3101 Reproducing it on a CI VM was very difficult, requring dubious manipulation of PATH, PYTHONPATH and LD_LIBRARY_PATH environment variables. In the end the issue was diagnosed to be heap corruption, and thus the difficulty in reproducing it. The testParentFromCpp test in objecttype_test.py calls the destroyCppParent method to delete its parent. Because the deletion of the parent invokes the destructor ~ObjectType(), that in turn deletes the child. This lead to head corruption, because the child "o" by destroying its parent, destroys itself, and once the "delete m_parent" is done, the next "m_parent = 0" would write to invalid (freed) memory. In a release build of the Python interpreter, this ends up in accessing the freed memory in the GC collection phase (but under a debugger this crashed in several other random places). The fix is to delete the "m_parent = 0;" statement, so that nothing is written to freed memory. Change-Id: I2d7a41b99a3255ebb300e6157b3dd0d78eb27a54 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | | shiboken/docgenerator: Pad table rows up to header column countFriedemann Kleint2018-02-201-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix a warning about a malformed table (qcursor.cpp) whose last row has too few columns. Task-number: PYSIDE-363 Change-Id: I5eec88226e48064ee54e3abe1247d9dc06dc1d82 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | | shiboken/docgenerator: Refactor code using split()Friedemann Kleint2018-02-201-48/+38
|/ / | | | | | | | | | | | | | | Use splitRef() where applicable or rewrite. Task-number: PYSIDE-363 Change-Id: I08dcafbba82327f6ff4c02f582341083b4b48755 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | shiboken/docgenerator: Remove helper createRepeatedChar()Friedemann Kleint2018-02-201-10/+23
| | | | | | | | | | | | | | | | | | | | Add a streamable Pad class for these purposes or use the corresponding QString constructor. Task-number: PYSIDE-363 Change-Id: I7e58ae19d2b0f2e1e14c0a235a5ab311350174c2 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | shiboken: Fix loops in QtDocGenerator::writeConstructors()Friedemann Kleint2018-02-191-6/+7
| | | | | | | | | | | | | | | | | | Remove removed constructors and move constructors first before writing out documentation. Task-number: PYSIDE-363 Change-Id: I8dbe3e96ccc8f293253eb52e00c384d3ff458dcc Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | shiboken/docgenerator: Handle empty snippetsFriedemann Kleint2018-02-151-10/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | Empty snippets may actually be valid in case a single closing bracket in C++ is turned into an empty line in Python (customstyle.cpp[1]). Differentiate between those by using QString::isNull() for the fallback mechanism. Always output snippet identifier in messages. Amends 45f3126a04cd5493323b689c85a48106d0f8367e. Task-number: PYSIDE-363 Change-Id: I0391b18fafacbd4c57c4017adb08126a5e2c7c7e Reviewed-by: Christian Tismer <tismer@stackless.com>
* | shiboken/docgenerator: Fall back to C++ snippet when Python snippet cannot ↵Friedemann Kleint2018-02-151-13/+70
| | | | | | | | | | | | | | | | | | | | be found Use the "path" attribute. Task-number: PYSIDE-363 Change-Id: I27adc86cfb58d20a90f411842c2f78de9dbe1a60 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | Refactor QtXmlToSphinx::readFromLocation()Friedemann Kleint2018-02-131-9/+15
| | | | | | | | | | | | | | | | | | Split out the code path for empty identifier and port to QRegularExpression. Task-number: PYSIDE-363 Change-Id: I6c0eeba1d62762e475de12d503fdc1a9d495d349 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | Refactor QtDocGenerator::writeFormattedText()Friedemann Kleint2018-02-131-8/+15
| | | | | | | | | | | | | | | | | | Rewrite to use QStringRef and add some checks preventing overflow should the text contain empty lines. Task-number: PYSIDE-363 Change-Id: I850221bc6e7a6b88fc3b6078cf2cb2e01663ab15 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | Fix some spelling errors in qtdocgenerator.h/.cppFriedemann Kleint2018-02-132-15/+19
| | | | | | | | | | | | Task-number: PYSIDE-363 Change-Id: I781fc0dc195bc8f3222f9fce7c863b67d3d2c568 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | QtXmlToSphinx: Improve error handling for snippetsFriedemann Kleint2018-02-132-27/+53
| | | | | | | | | | | | | | | | | | | | Change the qCDebug() to qCWarning() for snippets issues and pass the errors up so that more context can be given. Task-number: PYSIDE-363 Change-Id: I23310cd55a1cdb3b040dd785db43717fa3c4c07d Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.9Friedemann Kleint2018-02-021-0/+2
|\| | | | | | | Change-Id: I777970f7bb17db766660d82556559eadd7293355
| * Fix signature extension disablingChristian Tismer2018-02-021-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The signature extension is a feature that can switch itself off, using the expression PY_VERSION_HEX >= 0x03040000 || \ (PY_VERSION_HEX < 0x03000000 && PY_VERSION_HEX >= 0x02070000) Unfortunately, the use of this constant when disabled became inconsistent over time. This patch corrects that and also adds a cosmetic improvement that was lost. Task-number: PYSIDE-510 Change-Id: Id1653c391d921a2c51008db2bc222d6f4bec9e90 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | shiboken/QtDocGenerator: Copy imagesFriedemann Kleint2018-02-022-7/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, the doc generator would rewrite the URLs to point to QTDIR/doc/src/images where the images were located in Qt 4. Add a function to copy the images from the webxml/images directory to a matching directory under rst where they can be picked up by sphinx. Task-number: PYSIDE-363 Change-Id: I1da83a7717dd61a9c0b80a7cc18444e00a1f4c1b Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | libshiboken: Code cleanupFriedemann Kleint2018-01-272-47/+0
| | | | | | | | | | | | | | | | Remove apparently unused/deprecated code. Change-Id: I566014bafdcbf0b3b46e9dc836c451c64d409511 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Fix clazy warnings in the doc generatorsFriedemann Kleint2018-01-262-8/+5
| | | | | | | | | | | | | | | | | | | | | | - Unused variables - Mixing const/non-const iterators - Signedness - Missing const ref in range-based for - Uninitialized variable Change-Id: I02e6d4c5b0416aa8462f7b9d567b562a702a5740 Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Shiboken: Handle private abstract methodsFriedemann Kleint2018-01-197-4/+22
| | | | | | | | | | | | | | | | | | Remove the exclusion. Required for Qt3dExtras::QAbstractCameraController::moveCamera() in 5.10. Task-number: PYSIDE-487 Change-Id: I67ae24d4cda2d90ac30c97f77457c2eaf65099ab Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | shiboken tests: Introduce overrideFriedemann Kleint2018-01-196-24/+24
| | | | | | | | | | | | | | | | Replace virtual by override where appropriate to make the code clearer. Change-Id: I143daf29f1c162b2de959411a5f4acdc43a2b253 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.9Friedemann Kleint2018-01-191-2/+12
|\| | | | | | | Change-Id: I5f2e1660a27efafa445592898db4dfe3250306e0
| * Do not link shared libraries against the python shared library on UnixAlexandru Croitor2018-01-151-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is no need to link against the python shared library (or static library) on Linux / macOS because the python symbols will already be loaded by the dynamic linker, by the time when a PySide2 module is imported. This is especially relevant on Debian distributions, which ship a statically built python interpreter, as well as a python shared library (which is not used by the interpreter). The python shared library package is intended for native application that want to embed a Python interpreter inside the application. So far PySide2 would have linked against the python shared library, which means that on Debian distributions when running a PySide2 example, the executable would load two versions of the same python symbols (one from the static interpreter, and one from the shared library), and this might cause issues. On Windows we still need to link against the python.lib import library, because otherwise the python symbols would not be resolved. Task-number: PYSIDE-522 Change-Id: I4483ded96461c04f8e7a17d39068d07f772a973c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Handle QObject-derived arguments correctly in constructor overloadCristian Maureira-Fredes2018-01-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Shiboken generated conditions to select which constructor overload needed to be used in an unexpected order. These conditions were incorrect, and hence produced an error. Handling QObjects in the inheritance relationship process solved the issue. Task-number: PYSIDE-203 Change-Id: Iee3a8c8fe48671cd752cc0e3d92b740c823656ad Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | shiboken: replace first()/last() by constFirst/constLast()Friedemann Kleint2018-01-177-62/+59
| | | | | | | | | | | | | | | | Fix clazy warnings about possibly detaching containers. Change-Id: I3c3a229de5e0c71f17c1f26273e1b0be3b0d7e81 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | shiboken: Fix some clazy warningsFriedemann Kleint2018-01-1712-60/+45
| | | | | | | | | | | | | | | | | | | | | | | | - Mixing const/non-const iterators - Do not use operator[] on temporaries of type QVector - Remove unused nontrivial variables - Add Q_FALLTHROUGH() - Potential detach in range-based for Change-Id: I89391fdda616f119eadd7de529eb6cee69343f85 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | Add quotes to Shiboken cmakeCristian Maureira-Fredes2018-01-161-1/+1
| | | | | | | | | | | | | | | | | | For paths containing spaces, the lack of quotes will make the process to fail. Task-number: PYSIDE-169 Change-Id: Iee99eb4fe6ed1045b7c6053ef199c49714fab32f Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Prevent infinite loop due to bad __getitem__ implCristian Maureira-Fredes2018-01-151-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Looking at PYSIDE-441 there was an issue regarding overloading the __getitem__ method on a class that inherits from QObject. The bug report showed that setting an object of the same class to be the parent of another object of the same class ended up causing an infinite loop when trying to get the parent element. Overloading __getitem__ implicitly converts the class into an iterator, and the developer *must* include a proper implementation of the method which raises a StopIteration exception when needed. Commonly, people that overload this method included access to class data structures where in most of the cases an IndexError is raised which forces the iteration to stop. Since the bug report did not include this code and also there was no access to any internal variable, no exception was raised and ended up causing an infinite loop. This can be replicated in python as folows: class A(object): def __getitem__(self, arg=None): print("getitem called:", arg) #raise StopIteration a = A() print(list(a)) This small fix avoids the infinite loop when the method __len__ is not implemented (length = -1) or when the length of the pyObj is zero. Without a proper implementation of __getitem__ (Raising IndexError or StopIteration) the infinite loop will happen. If __len__ is not implemented, then the application will complain, but does not matter since this is never checked during the iteration. Change-Id: I74e7bf1755c265dbc309bb6c5a760f11643fd7ed Task-number: PYSIDE-441 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Fix system header inclusions for proper support of C primitive typesAlexandru Croitor2018-01-151-1/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order for GL types like GLint64 to be available on macOS, the macOS-specific system header "gltypes.h" has to be parsed by libclang. Before this change, shiboken skipped parsing system headers (except for gl.h) because there are issues when trying to parse C++ std headers (ostream for example). The file "gltypes.h" contains the typedef declarations for GL numeric types. A few other system headers like "cstdint" are also needed (which contain the actual typedefs from int32_t to int for example). A few different system headers are also needed on Linux (also for GL -> numeric typedefs). This system header exclusion mechanism is far from a clean solution, but it seems like current versions of libclang do not provide enough preprocessor information to be able to limit the parsing to specific chunks of code (for example everything included by gltypes.h), thus we need to limit ourselves to exclusion by file paths. Change-Id: I58c151e2cb083e16f7cafb3dc9df2d757442bb59 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>